summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2012-07-05 14:49:29 +0000
committerAndre Fischer <af@apache.org>2012-07-05 14:49:29 +0000
commitdbd0cea6052c5198fc960883830c3daebb989a4c (patch)
tree8bdeba36fc749944577203e7cd7ad915943e6556
parent2df66d39b4303e673ab43b97d2a5df5f09d04285 (diff)
#i120096# Detect empty polygon in Region constructor and set impl object accordingly.
Reported by: Du Jing Fixed by: Andre Fischer
Notes
Notes: merged as: a5aeb9e0a0e8766ddaefb147f24ca858f0fff75b
-rwxr-xr-xvcl/inc/vcl/region.hxx1
-rw-r--r--vcl/source/gdi/region.cxx12
2 files changed, 12 insertions, 1 deletions
diff --git a/vcl/inc/vcl/region.hxx b/vcl/inc/vcl/region.hxx
index cf6fde99faf9..c01be8240444 100755
--- a/vcl/inc/vcl/region.hxx
+++ b/vcl/inc/vcl/region.hxx
@@ -61,6 +61,7 @@ private:
SAL_DLLPRIVATE void ImplCopyData();
SAL_DLLPRIVATE void ImplCreateRectRegion( const Rectangle& rRect );
SAL_DLLPRIVATE void ImplCreatePolyPolyRegion( const PolyPolygon& rPolyPoly );
+ SAL_DLLPRIVATE void ImplCreatePolyPolyRegion( const basegfx::B2DPolyPolygon& rPolyPoly );
SAL_DLLPRIVATE void ImplPolyPolyRegionToBandRegionFunc();
SAL_DLLPRIVATE inline void ImplPolyPolyRegionToBandRegion();
SAL_DLLPRIVATE const ImplRegion* ImplGetImplRegion() const { return mpImplRegion; }
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index a4aee2122c12..1e82b2f7090b 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -1136,7 +1136,7 @@ Region::Region( const basegfx::B2DPolyPolygon& rPolyPoly )
DBG_CTOR( Region, ImplDbgTestRegion );
DBG_CHKOBJ( &rPolyPoly, PolyPolygon, NULL );
- mpImplRegion = new ImplRegion( rPolyPoly );
+ ImplCreatePolyPolyRegion( rPolyPoly );
}
// -----------------------------------------------------------------------
@@ -1226,6 +1226,16 @@ void Region::ImplCreatePolyPolyRegion( const PolyPolygon& rPolyPoly )
// -----------------------------------------------------------------------
+void Region::ImplCreatePolyPolyRegion( const basegfx::B2DPolyPolygon& rPolyPoly )
+{
+ if (rPolyPoly.count()==0 || rPolyPoly.getB2DRange().isEmpty())
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ else
+ mpImplRegion = new ImplRegion( rPolyPoly );
+}
+
+// -----------------------------------------------------------------------
+
void Region::ImplPolyPolyRegionToBandRegionFunc()
{
// ensure to subdivide when bezier segemnts are used, it's going to