2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Simplify Image, remove ImageSource.

This commit is contained in:
John Preston
2020-05-29 19:10:25 +04:00
parent d0c78eaddd
commit 36fbdfb380
49 changed files with 306 additions and 512 deletions

View File

@@ -685,7 +685,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
}
} else if (const auto image = media->getStickerSmall()) {
QPoint ppos = pos + QPoint((st::stickerPanSize.width() - w) / 2, (st::stickerPanSize.height() - h) / 2);
p.drawPixmapLeft(ppos, width(), image->pix(document->stickerSetOrigin(), w, h));
p.drawPixmapLeft(ppos, width(), image->pix(w, h));
}
}
}

View File

@@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lottie/lottie_common.h"
#include "ui/emoji_config.h"
#include "ui/text/text_isolated_emoji.h"
#include "ui/image/image_source.h"
#include "ui/image/image.h"
#include "main/main_session.h"
#include "data/data_file_origin.h"
#include "data/data_session.h"
@@ -310,9 +310,7 @@ std::shared_ptr<LargeEmojiImage> EmojiPack::image(EmojiPtr emoji) {
if (const auto strong = i->second.lock()) {
if (!strong->image) {
strong->load = nullptr;
strong->image.emplace(
std::make_unique<Images::ImageSource>(
std::move(image)));
strong->image.emplace(std::move(image));
_session->downloaderTaskFinished().notify();
}
}

View File

@@ -788,8 +788,8 @@ void StickersListWidget::Footer::paintSetIcon(
|| (!icon.lottie->ready() && !icon.savedFrame.isNull())) {
const auto pixmap = !icon.savedFrame.isNull()
? icon.savedFrame
: (!icon.lottie && thumb && thumb->loaded())
? thumb->pix(origin, icon.pixw, icon.pixh)
: (!icon.lottie && thumb)
? thumb->pix(icon.pixw, icon.pixh)
: QPixmap();
if (pixmap.isNull()) {
return;
@@ -1866,9 +1866,8 @@ void StickersListWidget::paintSticker(Painter &p, Set &set, int y, int section,
const auto image = media->getStickerSmall();
const auto pixmap = !sticker.savedFrame.isNull()
? sticker.savedFrame
: (image && image->loaded())
: image
? image->pixSingle(
document->stickerSetOrigin(),
w,
h,
w,

View File

@@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_file_origin.h"
#include "storage/file_download.h"
#include "ui/image/image_source.h"
#include "ui/image/image.h"
#include "app.h"
namespace Stickers {
@@ -30,8 +30,7 @@ void SetThumbnailView::set(
if (image.isNull()) {
_content = std::move(content);
} else {
_image = std::make_unique<Image>(
std::make_unique<Images::ImageSource>(std::move(image)));
_image = std::make_unique<Image>(std::move(image));
}
session->downloaderTaskFinished().notify();
}