aboutsummaryrefslogtreecommitdiff
path: root/lib/gdi/region.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2004-09-25 16:13:48 +0000
committerFelix Domke <tmbinc@elitedvb.net>2004-09-25 16:13:48 +0000
commit1aeefd997cc362c3b37c1587c5f08891b35c3a75 (patch)
tree621600d89b20531ee9e6497dbc9fb50db8a4d759 /lib/gdi/region.cpp
parent636a782d8920b4b52a881a4565c46c06f68785b5 (diff)
downloadenigma2-1aeefd997cc362c3b37c1587c5f08891b35c3a75.tar.gz
enigma2-1aeefd997cc362c3b37c1587c5f08891b35c3a75.zip
- new GUI lib
- fixes
Diffstat (limited to 'lib/gdi/region.cpp')
-rw-r--r--lib/gdi/region.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/gdi/region.cpp b/lib/gdi/region.cpp
index cbac53f8..f79b403f 100644
--- a/lib/gdi/region.cpp
+++ b/lib/gdi/region.cpp
@@ -26,10 +26,11 @@
gRegion::gRegion(const eRect &rect) : extends(rect)
{
- rects.push_back(rect);
+ if (rect.valid() && !rect.empty())
+ rects.push_back(rect);
}
-gRegion::gRegion()
+gRegion::gRegion() : extends(eRect::emptyRect())
{
}
@@ -265,8 +266,8 @@ void gRegion::regionOp(const gRegion &reg1, const gRegion &reg2, int opcode, int
bot = min(r1->y2, r2y1);
if (top != bot) {
curBand = rects.size();
- appendNonO(r1, r1BandEnd, top, bot);
- coalesce(prevBand, curBand);
+ appendNonO(r1, r1BandEnd, top, bot);
+ coalesce(prevBand, curBand);
}
}
ytop = r2y1;
@@ -319,22 +320,24 @@ void gRegion::regionOp(const gRegion &reg1, const gRegion &reg2, int opcode, int
coalesce(prevBand, curBand);
AppendRegions(r2BandEnd, r2End);
}
+
extends = eRect();
- for (int a=0; a<rects.size(); ++a)
- extends = extends | eRect(rects[0].topLeft(), rects[rects.size()-1].bottomRight());
+ for (unsigned int a = 0; a<rects.size(); ++a)
+ extends = extends | rects[a];
}
void gRegion::intersect(const gRegion &r1, const gRegion &r2)
{
+ /* in case one region is empty, the resulting regions is empty, too. */
if (r1.rects.empty())
{
- *this = r2;
+ *this = r1;
return;
}
if (r2.rects.empty())
{
- *this = r1;
+ *this = r2;
return;
}
int overlap;
@@ -416,7 +419,7 @@ gRegion &gRegion::operator|=(const gRegion &r2)
void gRegion::moveBy(ePoint offset)
{
extends.moveBy(offset);
- int i;
+ unsigned int i;
for (i=0; i<rects.size(); ++i)
rects[i].moveBy(offset);
}