perf: skip update from GIF timer if no animated elements are shown (#5042)
This commit is contained in:
@@ -196,8 +196,10 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags flags)
|
||||
}
|
||||
|
||||
// Painting
|
||||
void MessageLayout::paint(const MessagePaintContext &ctx)
|
||||
MessagePaintResult MessageLayout::paint(const MessagePaintContext &ctx)
|
||||
{
|
||||
MessagePaintResult result;
|
||||
|
||||
QPixmap *pixmap = this->ensureBuffer(ctx.painter, ctx.canvasWidth);
|
||||
|
||||
if (!this->bufferValid_)
|
||||
@@ -209,7 +211,8 @@ void MessageLayout::paint(const MessagePaintContext &ctx)
|
||||
ctx.painter.drawPixmap(0, ctx.y, *pixmap);
|
||||
|
||||
// draw gif emotes
|
||||
this->container_.paintAnimatedElements(ctx.painter, ctx.y);
|
||||
result.hasAnimatedElements =
|
||||
this->container_.paintAnimatedElements(ctx.painter, ctx.y);
|
||||
|
||||
// draw disabled
|
||||
if (this->message_->flags.has(MessageFlag::Disabled))
|
||||
@@ -270,6 +273,8 @@ void MessageLayout::paint(const MessagePaintContext &ctx)
|
||||
}
|
||||
|
||||
this->bufferValid_ = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QPixmap *MessageLayout::ensureBuffer(QPainter &painter, int width)
|
||||
|
||||
Reference in New Issue
Block a user