BScrollBar: Avoid unnecessary invalidations when changing properties.

* _UpdateThumbFrame() calls Invalidate() already, don't call it again
   in SetRange unnecessarily.

 * If the new and old thumb frames are the same, skip invalidation.

Saves a lot of Invalidate() calls in HaikuDepot on building the
"all packages" list especially.
This commit is contained in:
Augustin Cavalier
2025-02-15 21:12:30 -05:00
parent fbb27923df
commit 341d251a45
+2 -4
View File
@@ -846,10 +846,8 @@ BScrollBar::SetRange(float min, float max)
if (fValue < fMin || fValue > fMax)
SetValue(fValue);
else {
else
_UpdateThumbFrame();
Invalidate();
}
}
@@ -1255,7 +1253,7 @@ BScrollBar::_UpdateThumbFrame()
fPrivateData->fThumbFrame.OffsetBy(offset, 0.0);
}
if (Window() != NULL) {
if (Window() != NULL && fPrivateData->fThumbFrame != oldFrame) {
BRect invalid = oldFrame.IsValid()
? oldFrame | fPrivateData->fThumbFrame
: fPrivateData->fThumbFrame;