]> Shamusworld >> Repos - architektonas/blobdiff - src/rect.cpp
Fix for Print Preview for centering of drawing on page.
[architektonas] / src / rect.cpp
index 693cf31582e34b3533bb1df7bbd73a9a60b71fa6..54f44ddf73abcb404c95d1b6d397674a90a16b8c 100644 (file)
 #include "rect.h"
 //#include <stdio.h>
 
-
 Rect::Rect(): l(0), r(0), t(0), b(0)
 {
 }
 
-
 Rect::Rect(double ll, double rr, double tt, double bb):
        l(ll), r(rr), t(tt), b(bb)
 {
        Normalize();
 }
 
-
 Rect::Rect(Point tl, Point br): l(tl.x), r(br.x), t(tl.y), b(br.y)
 {
        Normalize();
 }
 
-
 Rect & Rect::operator*=(double scale)
 {
        l *= scale;
        r *= scale;
        t *= scale;
        b *= scale;
+
        return *this;
 }
 
-
 Rect & Rect::operator|=(Rect r2)
 {
 //printf("operatore|=\nthis = (%lf, %lf, %lf, %lf), r = (%lf, %lf, %lf, %lf)\n", l, t, r, b, r2.l, r2.t, r2.r, r2.b);
@@ -62,7 +58,6 @@ Rect & Rect::operator|=(Rect r2)
        return *this;
 }
 
-
 void Rect::Normalize(void)
 {
        if (l > r)
@@ -80,7 +75,6 @@ void Rect::Normalize(void)
        }
 }
 
-
 void Rect::Translate(Point p)
 {
        l += p.x;
@@ -89,7 +83,6 @@ void Rect::Translate(Point p)
        b += p.y;
 }
 
-
 void Rect::Expand(double amt)
 {
        l -= amt;
@@ -98,33 +91,37 @@ void Rect::Expand(double amt)
        b -= amt;
 }
 
-
 double Rect::Width(void)
 {
        return r - l;
 }
 
-
 double Rect::Height(void)
 {
        return t - b;
 }
 
-
 bool Rect::Contains(Point p)
 {
        return ((p.x >= l) && (p.x <= r) && (p.y >= b) && (p.y <= t) ? true : false);
 }
 
-
 Point Rect::TopLeft(void)
 {
        return Point(l, t);
 }
 
+Point Rect::TopRight(void)
+{
+       return Point(r, t);
+}
+
+Point Rect::BottomLeft(void)
+{
+       return Point(l, b);
+}
 
 Point Rect::BottomRight(void)
 {
        return Point(r, b);
 }
-