fix: use integers for message layout bounds (#6254)

This commit is contained in:
nerix
2025-06-07 12:54:53 +02:00
committed by GitHub
parent 37a752a231
commit c2e0fd8efe
5 changed files with 30 additions and 29 deletions
+10 -11
View File
@@ -764,7 +764,7 @@ void ChannelView::updateScrollbar(
{
this->scrollBar_->setPageSize(
static_cast<qreal>(messages.size() - i) +
(h / std::max(1.0, message->getHeight())));
(h / std::max(1, message->getHeight())));
showScrollbar = true;
break;
@@ -1608,8 +1608,9 @@ void ChannelView::drawMessages(QPainter &painter, const QRect &area)
.isMentions = this->underlyingChannel_ ==
getApp()->getTwitch()->getMentionsChannel(),
.y = -(messagesSnapshot[start]->getHeight() *
(fmod(this->scrollBar_->getRelativeCurrentValue(), 1))),
.y = -static_cast<int>(
messagesSnapshot[start]->getHeight() *
(fmod(this->scrollBar_->getRelativeCurrentValue(), 1))),
.messageIndex = start,
.isLastReadMessage = false,
@@ -1646,25 +1647,23 @@ void ChannelView::drawMessages(QPainter &painter, const QRect &area)
{
animationArea = QRect{
0,
static_cast<int>(ctx.y),
static_cast<int>(layout->getWidth()),
static_cast<int>(layout->getHeight()),
ctx.y,
layout->getWidth(),
layout->getHeight(),
};
}
else
{
animationArea.setBottom(
static_cast<int>(ctx.y + layout->getHeight()));
animationArea.setBottom((ctx.y + layout->getHeight()));
animationArea.setWidth(
std::max(static_cast<int>(layout->getWidth()),
animationArea.width()));
std::max(layout->getWidth(), animationArea.width()));
}
}
if (this->highlightedMessage_ == layout)
{
painter.fillRect(
QRectF{
QRect{
0,
ctx.y,
layout->getWidth(),