[Libreoffice-commits] core.git: vcl/inc vcl/source

Andre Fischer af at apache.org
Sun Apr 14 15:58:04 PDT 2013


 vcl/inc/vcl/region.hxx    |    1 +
 vcl/source/gdi/region.cxx |   12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit a5aeb9e0a0e8766ddaefb147f24ca858f0fff75b
Author: Andre Fischer <af at apache.org>
Date:   Thu Jul 5 14:49:29 2012 +0000

    Resolves: #i120096# Detect empty polygon in Region constructor...
    
    and set impl object accordingly.
    
    Reported by: Du Jing
    Fixed by: Andre Fischer
    (cherry picked from commit dbd0cea6052c5198fc960883830c3daebb989a4c)
    
    Change-Id: I210ec0e696e673309aad64a1e157e207bea10a66

diff --git a/vcl/inc/vcl/region.hxx b/vcl/inc/vcl/region.hxx
index 9a5ed68..02eebc7 100644
--- a/vcl/inc/vcl/region.hxx
+++ b/vcl/inc/vcl/region.hxx
@@ -57,6 +57,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 b46972a..e359f59 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -1100,7 +1100,7 @@ Region::Region( const basegfx::B2DPolyPolygon& rPolyPoly )
     DBG_CTOR( Region, ImplDbgTestRegion );
     DBG_CHKOBJ( &rPolyPoly, PolyPolygon, NULL );
 
-    mpImplRegion = new ImplRegion( rPolyPoly );
+    ImplCreatePolyPolyRegion( rPolyPoly );
 }
 
 // -----------------------------------------------------------------------
@@ -1190,6 +1190,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


More information about the Libreoffice-commits mailing list