From ddc9530b4d9581be01dace0c266edf7da5629735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 20 Mar 2011 12:59:01 +0000 Subject: [PATCH] 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 --- src/kits/shared/IconButton.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/kits/shared/IconButton.cpp b/src/kits/shared/IconButton.cpp index d5c50960f7..4453a09f4a 100644 --- a/src/kits/shared/IconButton.cpp +++ b/src/kits/shared/IconButton.cpp @@ -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)); } }