mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-03 16:05:57 +00:00
Fix video thumbnails in video overview.
This commit is contained in:
@@ -394,6 +394,11 @@ Video::Video(
|
||||
, _duration(formatDurationText(_data->getDuration())) {
|
||||
setDocumentLinks(_data);
|
||||
_data->loadThumbnail(parent->fullId());
|
||||
if (_data->hasThumbnail() && !_data->thumbnail()->loaded()) {
|
||||
if (const auto good = _data->goodThumbnail()) {
|
||||
good->load({});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Video::initDimensions() {
|
||||
@@ -428,7 +433,8 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
|
||||
const auto radialOpacity = radial ? _radial->opacity() : 0.;
|
||||
|
||||
if ((blurred || thumbLoaded || goodLoaded)
|
||||
&& (_pix.width() != _width * cIntRetinaFactor())) {
|
||||
&& ((_pix.width() != _width * cIntRetinaFactor())
|
||||
|| (_pixBlurred && (thumbLoaded || goodLoaded)))) {
|
||||
auto size = _width * cIntRetinaFactor();
|
||||
auto img = goodLoaded
|
||||
? _data->goodThumbnail()->original()
|
||||
@@ -445,9 +451,9 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
|
||||
img = img.copy(0, (img.height() - img.width()) / 2, img.width(), img.width()).scaled(size, size, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
|
||||
}
|
||||
img.setDevicePixelRatio(cRetinaFactor());
|
||||
_data->unload();
|
||||
|
||||
_pix = App::pixmapFromImageInPlace(std::move(img));
|
||||
_pixBlurred = !(thumbLoaded || goodLoaded);
|
||||
}
|
||||
|
||||
if (_pix.isNull()) {
|
||||
|
@@ -247,6 +247,7 @@ private:
|
||||
|
||||
QString _duration;
|
||||
QPixmap _pix;
|
||||
bool _pixBlurred = true;
|
||||
|
||||
void updateStatusText();
|
||||
|
||||
|
Reference in New Issue
Block a user