ControlLook: fix DrawActiveTab with subpixel rectangle

Fixes #4078.

When font hinting is disabled, the width of a string may not be an
integer number of pixels. This results in the tab position also being
non-integer, and the drawing code doesn't handle this, resulting in part
of the tab being shifted 1px to the right.

Snap the rectangle to the pixel grid so the runding error doesn't
happen.
This commit is contained in:
Adrien Destugues 2014-12-10 13:50:19 +01:00
parent cbb8ebbbbb
commit 6f20778781
1 changed files with 6 additions and 0 deletions

View File

@ -1344,6 +1344,12 @@ BControlLook::DrawActiveTab(BView* view, BRect& rect, const BRect& updateRect,
if (!rect.IsValid() || !rect.Intersects(updateRect))
return;
// Snap the rectangle to pixels to avoid rounding errors.
rect.left = floorf(rect.left);
rect.right = floorf(rect.right);
rect.top = floorf(rect.top);
rect.bottom = floorf(rect.bottom);
// save the clipping constraints of the view
view->PushState();