[haiku-commits] r40984 - haiku/trunk/headers/os/interface

  • From: jonas@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 17 Mar 2011 02:08:02 +0100 (CET)

Author: kirilla
Date: 2011-03-17 02:08:01 +0100 (Thu, 17 Mar 2011)
New Revision: 40984
Changeset: https://dev.haiku-os.org/changeset/40984

Modified:
   haiku/trunk/headers/os/interface/Rect.h
Log:
Cleanup. Addition of constructor BRect(float side), allowing e.g. 
BRect(B_LARGE_ICON).

Modified: haiku/trunk/headers/os/interface/Rect.h
===================================================================
--- haiku/trunk/headers/os/interface/Rect.h     2011-03-17 00:45:30 UTC (rev 
40983)
+++ haiku/trunk/headers/os/interface/Rect.h     2011-03-17 01:08:01 UTC (rev 
40984)
@@ -25,6 +25,7 @@
                                                                        float 
bottom);
                                                                BRect(BPoint 
leftTop, BPoint rightBottom);
                                                                BRect(BPoint 
leftTop, BSize size);
+                                                               BRect(float 
side);
 
                        BRect&                          operator=(const BRect& 
other);
                        void                            Set(float left, float 
top, float right,
@@ -90,14 +91,14 @@
 inline BPoint
 BRect::LeftTop() const
 {
-       return *(const BPoint *)&left;
+       return *(const BPoint*)&left;
 }
 
 
 inline BPoint
 BRect::RightBottom() const
 {
-       return *(const BPoint *)&right;
+       return *(const BPoint*)&right;
 }
 
 
@@ -117,52 +118,70 @@
 
 inline
 BRect::BRect()
+       :
+       left(0),
+       top(0), 
+       right(-1),
+       bottom(-1)
 {
-       top = left = 0;
-       bottom = right = -1;
 }
 
 
 inline
 BRect::BRect(float l, float t, float r, float b)
+       :
+       left(l),
+       top(t),
+       right(r),
+       bottom(b)
 {
-       left = l;
-       top = t;
-       right = r;
-       bottom = b;
 }
 
 
 inline
 BRect::BRect(const BRect& r)
+       :
+       left(r.left),
+       top(r.top),
+       right(r.right),
+       bottom(r.bottom)
 {
-       left = r.left;
-       top = r.top;
-       right = r.right;
-       bottom = r.bottom;
 }
 
 
 inline
 BRect::BRect(BPoint leftTop, BPoint rightBottom)
+       :
+       left(leftTop.x),
+       top(leftTop.y),
+       right(rightBottom.x),
+       bottom(rightBottom.y)
 {
-       left = leftTop.x;
-       top = leftTop.y;
-       right = rightBottom.x;
-       bottom = rightBottom.y;
 }
 
 
 inline
 BRect::BRect(BPoint leftTop, BSize size)
-       : left(leftTop.x),
-         top(leftTop.y),
-         right(leftTop.x + size.width),
-         bottom(leftTop.y + size.height)
+       :
+       left(leftTop.x),
+       top(leftTop.y),
+       right(leftTop.x + size.width),
+       bottom(leftTop.y + size.height)
 {
 }
 
 
+inline
+BRect::BRect(float side)
+       :
+       left(0),
+       top(0),
+       right(side - 1),
+       bottom(side - 1)
+{
+}
+
+
 inline BRect&
 BRect::operator=(const BRect& from)
 {
@@ -218,6 +237,7 @@
        return bottom - top;
 }
 
+
 inline BSize
 BRect::Size() const
 {


Other related posts:

  • » [haiku-commits] r40984 - haiku/trunk/headers/os/interface - jonas