[Libreoffice-commits] core.git: Branch 'libreoffice-6-2-3' - sw/source

Armin Le Grand (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 4 12:39:43 UTC 2019


 sw/source/core/doc/notxtfrm.cxx |   29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

New commits:
commit 1100ca5407e7ffd9ce58fc0c2f4afe7e8e60e0f8
Author:     Armin Le Grand <Armin.Le.Grand at me.com>
AuthorDate: Tue Apr 2 17:59:40 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Apr 4 14:39:14 2019 +0200

    tdf#124272 use ClipRegion's geometry if not a rectangle
    
    By error the ClipRegion's geometry was replaced by it's
    BoundRect expanded to PixelBounds. If the ClipRegion
    is not a rectangle, this will create wrong results. To
    do both - extend to PixelBounds and have the original
    geometry included - use the PolyPolygon topology as
    needed (see comment in code for details)
    
    Change-Id: If3f75223144eba8eb23909a7c701ad544346099b
    Reviewed-on: https://gerrit.libreoffice.org/70146
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at me.com>
    (cherry picked from commit 362c1cf2bd580f6dc8bf27bdcd79174111bc1b5c)
    Reviewed-on: https://gerrit.libreoffice.org/70154
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 2b7b1a1501b88474ed5d691bafb45d465d8ab9f6)
    Reviewed-on: https://gerrit.libreoffice.org/70181
    Tested-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 51c43fa0e2a1..04e556277738 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -982,9 +982,34 @@ void paintGraphicUsingPrimitivesHelper(
                 ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()),
                 ceil(aClipRange.getMaxY() + aSinglePixelXY.getY()));
 
+            // create the enclosing rectangle as polygon
+            basegfx::B2DPolyPolygon aTarget(basegfx::utils::createPolygonFromRect(aExpandedClipRange));
+
+            // tdf#124272 the fix above (tdf#114076) was too rough - the
+            // clip region used may be a PolyPolygon. In that case that
+            // PolyPolygon would have to be scaled to mentioned PixelBounds.
+            // Since that is not really possible geometrically (would need
+            // more some 'grow in outside direction' but with unequal grow
+            // values in all directions - just maaany problems
+            // involved), use a graphical trick: The topology of the
+            // PolyPolygon uses the stndard FillRule, so adding the now
+            // guaranteed to be bigger or equal bounding (enclosing)
+            // rectangle twice as polygon will expand the BoundRange, but
+            // not change the geometry visualization at all
+            if(!rOutputDevice.GetClipRegion().IsRectangle())
+            {
+                // double the outer rectangle range polygon to have it
+                // included twice
+                aTarget.append(aTarget.getB2DPolygon(0));
+
+                // add the original clip 'inside' (due to being smaller
+                // or equal). That PolyPolygon may have an unknown number
+                // of polygons (>=1)
+                aTarget.append(aClip);
+            }
+
             aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D(
-                basegfx::B2DPolyPolygon(
-                    basegfx::utils::createPolygonFromRect(aExpandedClipRange)),
+                aTarget,
                 aContent);
         }
     }


More information about the Libreoffice-commits mailing list