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

Armin Le Grand alg at apache.org
Wed Jun 12 06:43:54 PDT 2013


 vcl/source/gdi/region.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit ad80a95695b95999b8fe0f60bcec1e5e5b76f4e8
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Oct 25 08:36:02 2012 +0000

    Related: #i121237# Corrected Region export
    
    was missing to write an end marker when RegionBand was empty
    
    (cherry picked from commit a6b23e539771d5c22a575ff418ffafacf7c2bc06)
    
    Change-Id: I0dbcb27aa0936b061062c94cdf4a2c7f1f306b0e

diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index fd91eb6..bf4a7c1 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -1386,8 +1386,7 @@ bool Region::IsInside( const Point& rPoint ) const
     //}
 
     // ensure RegionBand existance
-    const_cast< Region* >(this)->GetAsRegionBand();
-    const RegionBand* pRegionBand = getRegionBand();
+    const RegionBand* pRegionBand = GetAsRegionBand();
 
     if(pRegionBand)
     {
@@ -1670,6 +1669,14 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion )
     {
         pRegionBand->save(rOStrm);
     }
+    else
+    {
+        // for compatibility, write an empty RegionBand (will only write
+        // the end marker STREAMENTRY_END, but this *is* needed)
+        const RegionBand aRegionBand;
+
+        aRegionBand.save(rOStrm);
+    }
 
     // write polypolygon if available
     const sal_Bool bHasPolyPolygon(rRegion.HasPolyPolygonOrB2DPolyPolygon());
@@ -1693,8 +1700,7 @@ void Region::GetRegionRectangles(RectangleVector& rTarget) const
     rTarget.clear();
 
     // ensure RegionBand existance
-    const_cast< Region* >(this)->GetAsRegionBand();
-    const RegionBand* pRegionBand = getRegionBand();
+    const RegionBand* pRegionBand = GetAsRegionBand();
 
     if(pRegionBand)
     {


More information about the Libreoffice-commits mailing list