Fix crash in video message without a thumbnail.

This commit is contained in:
John Preston 2022-02-04 22:55:36 +03:00
parent da18ab3d41
commit 2dda044dd1

View file

@ -473,16 +473,23 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
} else if (const auto blurred = _dataMedia->thumbnailInline()) { } else if (const auto blurred = _dataMedia->thumbnailInline()) {
p.drawPixmap(rthumb.topLeft(), blurred->pixSingle(size, args.blurred())); p.drawPixmap(rthumb.topLeft(), blurred->pixSingle(size, args.blurred()));
} else if (!unwrapped) { } else if (!unwrapped) {
const auto roundTop = (roundCorners & RectPart::TopLeft); if (roundRadius == ImageRoundRadius::Ellipse) {
const auto roundBottom = (roundCorners & RectPart::BottomLeft); PainterHighQualityEnabler hq(p);
const auto margin = inWebPage p.setPen(Qt::NoPen);
? st::roundRadiusSmall p.setBrush(st->imageBg());
: st::historyMessageRadius; p.drawEllipse(rthumb);
const auto parts = roundCorners } else {
| RectPart::NoTopBottom const auto roundTop = (roundCorners & RectPart::TopLeft);
| (roundTop ? RectPart::Top : RectPart::None) const auto roundBottom = (roundCorners & RectPart::BottomLeft);
| (roundBottom ? RectPart::Bottom : RectPart::None); const auto margin = inWebPage
Ui::FillRoundRect(p, rthumb.marginsAdded({ 0, roundTop ? 0 : margin, 0, roundBottom ? 0 : margin }), st->imageBg(), roundRadius, parts); ? st::roundRadiusSmall
: st::historyMessageRadius;
const auto parts = roundCorners
| RectPart::NoTopBottom
| (roundTop ? RectPart::Top : RectPart::None)
| (roundBottom ? RectPart::Bottom : RectPart::None);
Ui::FillRoundRect(p, rthumb.marginsAdded({ 0, roundTop ? 0 : margin, 0, roundBottom ? 0 : margin }), st->imageBg(), roundRadius, parts);
}
} else { } else {
paintPath(p, context, rthumb); paintPath(p, context, rthumb);
} }