The frame that the bitmap is centered in has already
an appropriate offset when the button is drawn in pressed look. Fixes the bitmap being drawn with a much too big offset. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41056 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
cf0d830818
commit
ddc9530b4d
|
@ -109,19 +109,16 @@ BIconButton::Draw(BRect updateRect)
|
|||
}
|
||||
|
||||
if (bitmap && bitmap->IsValid()) {
|
||||
float x = r.left + floorf((r.Width()
|
||||
- bitmap->Bounds().Width()) / 2.0 + 0.5);
|
||||
float y = r.top + floorf((r.Height()
|
||||
- bitmap->Bounds().Height()) / 2.0 + 0.5);
|
||||
BPoint point(x, y);
|
||||
if (_HasFlags(STATE_PRESSED) || _HasFlags(STATE_FORCE_PRESSED))
|
||||
point += BPoint(1.0, 1.0);
|
||||
if (bitmap->ColorSpace() == B_RGBA32
|
||||
|| bitmap->ColorSpace() == B_RGBA32_BIG) {
|
||||
SetDrawingMode(B_OP_ALPHA);
|
||||
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||
}
|
||||
DrawBitmap(bitmap, point);
|
||||
float x = r.left + floorf((r.Width()
|
||||
- bitmap->Bounds().Width()) / 2.0 + 0.5);
|
||||
float y = r.top + floorf((r.Height()
|
||||
- bitmap->Bounds().Height()) / 2.0 + 0.5);
|
||||
DrawBitmap(bitmap, BPoint(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue