From ee359c263a2c534db6a94601f1d7906cdd9f04c7 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Wed, 3 Jun 2009 14:49:58 +0200 Subject: [PATCH 1/1] allow scale rects, regions --- lib/gdi/erect.h | 8 ++++++++ lib/gdi/region.cpp | 7 +++++++ lib/gdi/region.h | 2 ++ 3 files changed, 17 insertions(+) diff --git a/lib/gdi/erect.h b/lib/gdi/erect.h index d95b8c0f..83981403 100644 --- a/lib/gdi/erect.h +++ b/lib/gdi/erect.h @@ -119,6 +119,14 @@ public: static eRect emptyRect() { return eRect(0, 0, 0, 0); } static eRect invalidRect() { return eRect(); } + inline void scale(int x_n, int x_d, int y_n, int y_d) + { + x1 *= x_n; x1 /= x_d; + x2 *= x_n; x2 /= x_d; + y1 *= y_n; y1 /= y_d; + y2 *= y_n; y2 /= y_d; + } + private: int x1; int y1; diff --git a/lib/gdi/region.cpp b/lib/gdi/region.cpp index bbad3aa0..1208c97e 100644 --- a/lib/gdi/region.cpp +++ b/lib/gdi/region.cpp @@ -426,3 +426,10 @@ void gRegion::moveBy(ePoint offset) rects[i].moveBy(offset); } +void gRegion::scale(int x_n, int x_d, int y_n, int y_d) +{ + int i; + for (i=0; i