[haiku-commits] r41056 - haiku/trunk/src/kits/shared

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 20 Mar 2011 13:59:01 +0100 (CET)

Author: stippi
Date: 2011-03-20 13:59:01 +0100 (Sun, 20 Mar 2011)
New Revision: 41056
Changeset: https://dev.haiku-os.org/changeset/41056

Modified:
   haiku/trunk/src/kits/shared/IconButton.cpp
Log:
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.


Modified: haiku/trunk/src/kits/shared/IconButton.cpp
===================================================================
--- haiku/trunk/src/kits/shared/IconButton.cpp  2011-03-20 12:53:38 UTC (rev 
41055)
+++ haiku/trunk/src/kits/shared/IconButton.cpp  2011-03-20 12:59:01 UTC (rev 
41056)
@@ -109,19 +109,16 @@
        }
 
        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));
        }
 }
 


Other related posts:

  • » [haiku-commits] r41056 - haiku/trunk/src/kits/shared - superstippi