fix: use integers for message layout bounds (#6254)
This commit is contained in:
@@ -56,14 +56,14 @@ const MessagePtr &MessageLayout::getMessagePtr() const
|
||||
}
|
||||
|
||||
// Height
|
||||
qreal MessageLayout::getHeight() const
|
||||
int MessageLayout::getHeight() const
|
||||
{
|
||||
return this->container_.getHeight();
|
||||
return static_cast<int>(this->container_.getHeight());
|
||||
}
|
||||
|
||||
qreal MessageLayout::getWidth() const
|
||||
int MessageLayout::getWidth() const
|
||||
{
|
||||
return this->container_.getWidth();
|
||||
return static_cast<int>(this->container_.getWidth());
|
||||
}
|
||||
|
||||
// Layout
|
||||
@@ -236,7 +236,7 @@ MessagePaintResult MessageLayout::paint(const MessagePaintContext &ctx)
|
||||
}
|
||||
|
||||
// draw on buffer
|
||||
ctx.painter.drawPixmap(QPointF{0, ctx.y}, *pixmap);
|
||||
ctx.painter.drawPixmap(QPoint{0, ctx.y}, *pixmap);
|
||||
|
||||
// draw gif emotes
|
||||
result.hasAnimatedElements =
|
||||
@@ -246,11 +246,11 @@ MessagePaintResult MessageLayout::paint(const MessagePaintContext &ctx)
|
||||
if (this->message_->flags.has(MessageFlag::Disabled))
|
||||
{
|
||||
ctx.painter.fillRect(
|
||||
QRectF{
|
||||
QRect{
|
||||
0,
|
||||
ctx.y,
|
||||
static_cast<qreal>(pixmap->width()),
|
||||
static_cast<qreal>(pixmap->height()),
|
||||
pixmap->width(),
|
||||
pixmap->height(),
|
||||
},
|
||||
ctx.messageColors.disabled);
|
||||
}
|
||||
@@ -259,11 +259,11 @@ MessagePaintResult MessageLayout::paint(const MessagePaintContext &ctx)
|
||||
ctx.preferences.fadeMessageHistory)
|
||||
{
|
||||
ctx.painter.fillRect(
|
||||
QRectF{
|
||||
QRect{
|
||||
0,
|
||||
ctx.y,
|
||||
static_cast<qreal>(pixmap->width()),
|
||||
static_cast<qreal>(pixmap->height()),
|
||||
pixmap->width(),
|
||||
pixmap->height(),
|
||||
},
|
||||
ctx.messageColors.disabled);
|
||||
}
|
||||
@@ -274,11 +274,11 @@ MessagePaintResult MessageLayout::paint(const MessagePaintContext &ctx)
|
||||
ctx.preferences.enableRedeemedHighlight)
|
||||
{
|
||||
ctx.painter.fillRect(
|
||||
QRectF{
|
||||
QRect{
|
||||
0,
|
||||
ctx.y,
|
||||
this->scale_ * 4,
|
||||
static_cast<qreal>(pixmap->height()),
|
||||
static_cast<int>(this->scale_ * 4),
|
||||
pixmap->height(),
|
||||
},
|
||||
*ColorProvider::instance().color(ColorType::RedeemedHighlight));
|
||||
}
|
||||
|
||||
@@ -52,8 +52,10 @@ public:
|
||||
const Message *getMessage();
|
||||
const MessagePtr &getMessagePtr() const;
|
||||
|
||||
qreal getHeight() const;
|
||||
qreal getWidth() const;
|
||||
/// In contrast to other metrics, the height and width are integers because
|
||||
/// this is how the backing pixmap is measured - it needs whole integers.
|
||||
int getHeight() const;
|
||||
int getWidth() const;
|
||||
|
||||
MessageLayoutFlags flags;
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ struct MessagePaintContext {
|
||||
const bool isMentions{};
|
||||
|
||||
// y coordinate we're currently painting at
|
||||
qreal y{};
|
||||
int y{};
|
||||
|
||||
// Index of the message that is currently being painted
|
||||
// This index refers to the snapshot being used in the painting
|
||||
|
||||
Reference in New Issue
Block a user