mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Flatten the scrollbar highlight iteration (#3326)
This commit is contained in:
parent
c33efab751
commit
8ead95b959
1 changed files with 26 additions and 24 deletions
|
@ -287,36 +287,38 @@ void Scrollbar::paintEvent(QPaintEvent *)
|
|||
int highlightHeight =
|
||||
int(std::ceil(std::max<float>(this->scale() * 2, dY)));
|
||||
|
||||
for (size_t i = 0; i < snapshotLength; i++)
|
||||
for (size_t i = 0; i < snapshotLength; i++, y += dY)
|
||||
{
|
||||
ScrollbarHighlight const &highlight = snapshot[i];
|
||||
|
||||
if (!highlight.isNull())
|
||||
if (highlight.isNull())
|
||||
{
|
||||
if (!highlight.isRedeemedHighlight() || enableRedeemedHighlights)
|
||||
{
|
||||
QColor color = highlight.getColor();
|
||||
color.setAlpha(255);
|
||||
|
||||
switch (highlight.getStyle())
|
||||
{
|
||||
case ScrollbarHighlight::Default: {
|
||||
painter.fillRect(w / 8 * 3, int(y), w / 4,
|
||||
highlightHeight, color);
|
||||
}
|
||||
break;
|
||||
|
||||
case ScrollbarHighlight::Line: {
|
||||
painter.fillRect(0, int(y), w, 1, color);
|
||||
}
|
||||
break;
|
||||
|
||||
case ScrollbarHighlight::None:;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
y += dY;
|
||||
if (highlight.isRedeemedHighlight() && !enableRedeemedHighlights)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QColor color = highlight.getColor();
|
||||
color.setAlpha(255);
|
||||
|
||||
switch (highlight.getStyle())
|
||||
{
|
||||
case ScrollbarHighlight::Default: {
|
||||
painter.fillRect(w / 8 * 3, int(y), w / 4, highlightHeight,
|
||||
color);
|
||||
}
|
||||
break;
|
||||
|
||||
case ScrollbarHighlight::Line: {
|
||||
painter.fillRect(0, int(y), w, 1, color);
|
||||
}
|
||||
break;
|
||||
|
||||
case ScrollbarHighlight::None:;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue