diff options
Diffstat (limited to 'lib/avatar.cpp')
-rw-r--r-- | lib/avatar.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/avatar.cpp b/lib/avatar.cpp index 7e6dc50b..be9b6a78 100644 --- a/lib/avatar.cpp +++ b/lib/avatar.cpp @@ -126,6 +126,14 @@ QImage Avatar::Private::get(Connection* connection, QSize size, if (callback) callbacks.emplace_back(move(callback)); _thumbnailRequest = connection->getThumbnail(_url, size); + if (_originalImage.isNull() && !_defaultIcon.isNull()) + { + _originalImage = QImage(_defaultIcon.actualSize(size), + QImage::Format_ARGB32_Premultiplied); + _originalImage.fill(Qt::transparent); + QPainter p { &_originalImage }; + _defaultIcon.paint(&p, { QPoint(), _defaultIcon.actualSize(size) }); + } QObject::connect( _thumbnailRequest, &MediaThumbnailJob::success, _thumbnailRequest, [this] { _fetched = true; @@ -138,15 +146,6 @@ QImage Avatar::Private::get(Connection* connection, QSize size, }); } - if( _originalImage.isNull() ) - { - if (_defaultIcon.isNull()) - return _originalImage; - - QPainter p { &_originalImage }; - _defaultIcon.paint(&p, { QPoint(), _defaultIcon.actualSize(size) }); - } - for (const auto& p: _scaledImages) if (p.first == size) return p.second; |