2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

Render webm stickers in StickersListWidget.

This commit is contained in:
John Preston
2022-01-25 00:40:26 +03:00
parent 20dbf18106
commit 8e749173de
12 changed files with 483 additions and 319 deletions

View File

@@ -1910,12 +1910,10 @@ void Gif::clipCallback(Media::Clip::Notification notification) {
} else {
auto height = st::inlineMediaHeight;
auto frame = countFrameSize();
_gif->start(
frame.width(),
frame.height(),
_width,
height,
ImageRoundRadius::None, RectPart::None);
_gif->start({
.frame = countFrameSize(),
.outer = { _width, st::inlineMediaHeight },
});
}
} else if (_gif->autoPausedGif()
&& !delegate()->itemVisible(this)) {
@@ -1997,26 +1995,20 @@ void Gif::paint(
}
const auto radial = isRadialAnimation();
int32 height = st::inlineMediaHeight;
QSize frame = countFrameSize();
QRect r(0, 0, _width, height);
const auto frame = countFrameSize();
const auto r = QRect(0, 0, _width, st::inlineMediaHeight);
if (animating) {
const auto pixmap = _gif->current(
frame.width(),
frame.height(),
_width,
height,
ImageRoundRadius::None,
RectPart::None,
/*context->paused ? 0 : */context->ms);
const auto pixmap = _gif->current({
.frame = frame,
.outer = r.size(),
}, /*context->paused ? 0 : */context->ms);
if (_thumb.isNull()) {
_thumb = pixmap;
_thumbGood = true;
}
p.drawPixmap(r.topLeft(), pixmap);
} else {
prepareThumbnail({ _width, height }, frame);
prepareThumbnail(r.size(), frame);
if (_thumb.isNull()) {
p.fillRect(r, st::overviewPhotoBg);
} else {
@@ -2044,7 +2036,11 @@ void Gif::paint(
return &st::historyFileInDownload;
}();
const auto size = st::overviewVideoRadialSize;
QRect inner((_width - size) / 2, (height - size) / 2, size, size);
QRect inner(
(r.width() - size) / 2,
(r.height() - size) / 2,
size,
size);
icon->paintInCenter(p, inner);
if (radial) {
p.setOpacity(1);