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,22 +287,28 @@ void Scrollbar::paintEvent(QPaintEvent *)
|
||||||
int highlightHeight =
|
int highlightHeight =
|
||||||
int(std::ceil(std::max<float>(this->scale() * 2, dY)));
|
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];
|
ScrollbarHighlight const &highlight = snapshot[i];
|
||||||
|
|
||||||
if (!highlight.isNull())
|
if (highlight.isNull())
|
||||||
{
|
{
|
||||||
if (!highlight.isRedeemedHighlight() || enableRedeemedHighlights)
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (highlight.isRedeemedHighlight() && !enableRedeemedHighlights)
|
||||||
{
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
QColor color = highlight.getColor();
|
QColor color = highlight.getColor();
|
||||||
color.setAlpha(255);
|
color.setAlpha(255);
|
||||||
|
|
||||||
switch (highlight.getStyle())
|
switch (highlight.getStyle())
|
||||||
{
|
{
|
||||||
case ScrollbarHighlight::Default: {
|
case ScrollbarHighlight::Default: {
|
||||||
painter.fillRect(w / 8 * 3, int(y), w / 4,
|
painter.fillRect(w / 8 * 3, int(y), w / 4, highlightHeight,
|
||||||
highlightHeight, color);
|
color);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -314,10 +320,6 @@ void Scrollbar::paintEvent(QPaintEvent *)
|
||||||
case ScrollbarHighlight::None:;
|
case ScrollbarHighlight::None:;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
y += dY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrollbar::resizeEvent(QResizeEvent *)
|
void Scrollbar::resizeEvent(QResizeEvent *)
|
||||||
|
|
Loading…
Reference in a new issue