From 7b94dab18fc6c19b5ac137771081c7edb695f127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 8 Jan 2008 18:56:04 +0000 Subject: [PATCH] * fix some invalidation problems with the triangle thumb which are caused by non-traight lines extending past the thumb frame because of anti-aliasing effects git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23286 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Slider.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp index 9e3b55b5a6..749b7dec99 100644 --- a/src/kits/interface/Slider.cpp +++ b/src/kits/interface/Slider.cpp @@ -615,15 +615,6 @@ BSlider::SetValue(int32 value) BRect oldThumbFrame = ThumbFrame(); - if (IsFocus() && Style() == B_TRIANGLE_THUMB) { - // we need to update the region with the focus mark as well - // (a method BSlider::FocusMarkFrame() would be nice as well) - if (fOrientation == B_HORIZONTAL) - oldThumbFrame.bottom += 2; - else - oldThumbFrame.left -= 2; - } - // While it would be enough to do this dependent on fUseFillColor, // that doesn't work out if DrawBar() has been overridden by a sub class if (fOrientation == B_HORIZONTAL) @@ -634,7 +625,25 @@ BSlider::SetValue(int32 value) _SetLocation(loc); BControl::SetValueNoUpdate(value); - Invalidate(oldThumbFrame | ThumbFrame()); + BRect invalid = oldThumbFrame | ThumbFrame(); + + if (Style() == B_TRIANGLE_THUMB) { + // 1) we need to take care of pixels touched because of + // anti-aliasing + // 2) we need to update the region with the focus mark as well + // (a method BSlider::FocusMarkFrame() would be nice as well) + if (fOrientation == B_HORIZONTAL) { + if (IsFocus()) + invalid.bottom += 2; + invalid.InsetBy(-1, 0); + } else { + if (IsFocus()) + invalid.left -= 2; + invalid.InsetBy(0, -1); + } + } + + Invalidate(invalid); // update text label