2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

fixed reading recent inline bots, fixed cached photos inline results, beta 9015006

This commit is contained in:
John Preston
2016-01-01 23:08:56 +08:00
parent cb2df51af6
commit 67d77bd114
2 changed files with 66 additions and 54 deletions

View File

@@ -1529,13 +1529,14 @@ LayoutInlineGif::~LayoutInlineGif() {
}
void LayoutInlineGif::prepareThumb(int32 width, int32 height, const QSize &frame) const {
if (_doc && !_doc->thumb->isNull()) {
if (_doc->thumb->loaded()) {
DocumentData *doc = _doc ? _doc : (_result ? _result->doc : 0);
if (doc && !doc->thumb->isNull()) {
if (doc->thumb->loaded()) {
if (_thumb.width() != width * cIntRetinaFactor() || _thumb.height() != height * cIntRetinaFactor()) {
_thumb = _doc->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height);
_thumb = doc->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height);
}
} else {
_doc->thumb->load();
doc->thumb->load();
}
} else if (_result && !_result->thumb_url.isEmpty()) {
if (_result->thumb->loaded()) {
@@ -1746,19 +1747,20 @@ QSize LayoutInlinePhoto::countFrameSize() const {
}
void LayoutInlinePhoto::prepareThumb(int32 width, int32 height, const QSize &frame) const {
if (_photo) {
if (_photo->medium->loaded()) {
PhotoData *photo = _photo ? _photo : (_result ? _result->photo : 0);
if (photo) {
if (photo->medium->loaded()) {
if (!_thumbLoaded || _thumb.width() != width * cIntRetinaFactor() || _thumb.height() != height * cIntRetinaFactor()) {
_thumb = _photo->medium->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height);
_thumb = photo->medium->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height);
}
_thumbLoaded = true;
} else {
if (_photo->thumb->loaded()) {
if (photo->thumb->loaded()) {
if (_thumb.width() != width * cIntRetinaFactor() || _thumb.height() != height * cIntRetinaFactor()) {
_thumb = _photo->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height);
_thumb = photo->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height);
}
}
_photo->medium->load();
photo->medium->load();
}
} else {
if (_result->thumb->loaded()) {