2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +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

@@ -659,7 +659,7 @@ bool BackgroundPreviewBox::setScaledFromThumb() {
: _media
? _media->thumbnail()
: nullptr;
if (!thumbnail || !thumbnail->loaded()) {
if (!thumbnail) {
return false;
} else if (_paper.isPattern() && _paper.document() != nullptr) {
return false;

View File

@@ -979,7 +979,6 @@ void ConfirmInviteBox::paintEvent(QPaintEvent *e) {
(width() - st::confirmInvitePhotoSize) / 2,
st::confirmInvitePhotoTop,
image->pixCircled(
Data::FileOrigin(),
st::confirmInvitePhotoSize,
st::confirmInvitePhotoSize));
}

View File

@@ -132,7 +132,7 @@ EditCaptionBox::EditCaptionBox(
| Images::Option::RoundedBottomLeft
| Images::Option::RoundedBottomRight;
_thumb = App::pixmapFromImageInPlace(Images::prepare(
image->pix(_msgId).toImage(),
image->original(),
_thumbw * cIntRetinaFactor(),
0,
options,
@@ -180,7 +180,6 @@ EditCaptionBox::EditCaptionBox(
const auto options = Images::Option::Smooth
| Images::Option::Blurred;
_thumb = image->pixNoCache(
_msgId,
maxW * cIntRetinaFactor(),
maxH * cIntRetinaFactor(),
options,
@@ -206,7 +205,6 @@ EditCaptionBox::EditCaptionBox(
? Images::Option::Blurred
: Images::Option(0));
_thumb = use->pixNoCache(
_msgId,
maxW * cIntRetinaFactor(),
maxH * cIntRetinaFactor(),
options,
@@ -282,7 +280,7 @@ EditCaptionBox::EditCaptionBox(
_thumbnailImageLoaded = _photoMedia
? (_photoMedia->image(Data::PhotoSize::Large) != nullptr)
: _thumbnailImage
? _thumbnailImage->loaded()
? true
: _documentMedia
? !_documentMedia->owner()->hasThumbnail()
: true;
@@ -299,7 +297,7 @@ EditCaptionBox::EditCaptionBox(
&& _documentMedia->owner()->hasThumbnail()) {
_thumbnailImage = _documentMedia->thumbnail();
}
if (_thumbnailImage && _thumbnailImage->loaded()) {
if (_thumbnailImage) {
_thumbnailImageLoaded = !_photoMedia
|| _photoMedia->image(PhotoSize::Large);
if (_thumbnailImageLoaded) {

View File

@@ -665,7 +665,7 @@ void StickerSetBox::Inner::paintSticker(
p.drawPixmapLeft(
ppos,
width(),
image->pix(document->stickerSetOrigin(), w, h));
image->pix(w, h));
}
}

View File

@@ -940,7 +940,7 @@ void StickersBox::Inner::paintRowThumbnail(
left + (st::contactsPhotoSize - row->pixw) / 2,
st::contactsPadding.top() + (st::contactsPhotoSize - row->pixh) / 2,
width(),
thumb->pix(origin, row->pixw, row->pixh));
thumb->pix(row->pixw, row->pixh));
} else if (row->lottie->ready()) {
const auto frame = row->lottie->frame();
const auto size = frame.size() / cIntRetinaFactor();