CheckBox: Center the check mark again
See 46b39e83 Changed rounding behavior for StrokeLine.
This effectively undoes the change in rounding behavior from that commit.
This commit is contained in:
@@ -486,10 +486,22 @@ BControlLook::DrawCheckBox(BView* view, BRect& rect, const BRect& updateRect,
|
|||||||
if (_RadioButtonAndCheckBoxMarkColor(base, markColor, flags)) {
|
if (_RadioButtonAndCheckBoxMarkColor(base, markColor, flags)) {
|
||||||
view->SetHighColor(markColor);
|
view->SetHighColor(markColor);
|
||||||
|
|
||||||
rect.InsetBy(2, 2);
|
BFont font;
|
||||||
view->SetPenSize(std::max(1.0f, ceilf(rect.Width() / 3.5)));
|
view->GetFont(&font);
|
||||||
view->SetDrawingMode(B_OP_OVER);
|
float inset = std::max(2.0f, roundf(font.Size() / 6));
|
||||||
|
rect.InsetBy(inset, inset);
|
||||||
|
|
||||||
|
float penSize = std::max(1.0f, ceilf(rect.Width() / 3.5f));
|
||||||
|
if (penSize > 1.0f && fmodf(penSize, 2.0f) == 0.0f) {
|
||||||
|
// Tweak ends to "include" the pixel at the index,
|
||||||
|
// we need to do this in order to produce results like R5,
|
||||||
|
// where coordinates were inclusive
|
||||||
|
rect.right++;
|
||||||
|
rect.bottom++;
|
||||||
|
}
|
||||||
|
|
||||||
|
view->SetPenSize(penSize);
|
||||||
|
view->SetDrawingMode(B_OP_OVER);
|
||||||
view->StrokeLine(rect.LeftTop(), rect.RightBottom());
|
view->StrokeLine(rect.LeftTop(), rect.RightBottom());
|
||||||
view->StrokeLine(rect.LeftBottom(), rect.RightTop());
|
view->StrokeLine(rect.LeftBottom(), rect.RightTop());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user