diff --git a/Telegram/SourceFiles/ui/image/image_source.cpp b/Telegram/SourceFiles/ui/image/image_source.cpp index 88e7f4d79e..0351676164 100644 --- a/Telegram/SourceFiles/ui/image/image_source.cpp +++ b/Telegram/SourceFiles/ui/image/image_source.cpp @@ -18,7 +18,9 @@ namespace Images { ImageSource::ImageSource(QImage &&data, const QByteArray &format) : _data(std::move(data)) -, _format(format) { +, _format(format) +, _width(_data.width()) +, _height(_data.height()) { } void ImageSource::load( @@ -108,11 +110,11 @@ void ImageSource::setImageBytes(const QByteArray &bytes) { } int ImageSource::width() { - return _data.width(); + return _width; } int ImageSource::height() { - return _data.height(); + return _height; } int ImageSource::bytesSize() { @@ -120,6 +122,10 @@ int ImageSource::bytesSize() { } void ImageSource::setInformation(int size, int width, int height) { + if (width && height) { + _width = width; + _height = height; + } } QByteArray ImageSource::bytesForCache() { diff --git a/Telegram/SourceFiles/ui/image/image_source.h b/Telegram/SourceFiles/ui/image/image_source.h index e4afc44bf4..94f92ff6c8 100644 --- a/Telegram/SourceFiles/ui/image/image_source.h +++ b/Telegram/SourceFiles/ui/image/image_source.h @@ -57,6 +57,8 @@ private: QImage _data; QByteArray _format; QByteArray _bytes; + int _width = 0; + int _height = 0; };