Kaydet (Commit) 7de7cbfe authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Andras Timar

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)

Reviewed-on: https://gerrit.libreoffice.org/70146
Tested-by: Jenkins
Reviewed-by: 's avatarArmin Le Grand <Armin.Le.Grand@me.com>
(cherry picked from commit 362c1cf2)

Conflicts:
	sw/source/core/doc/notxtfrm.cxx

Change-Id: If3f75223144eba8eb23909a7c701ad544346099b
Reviewed-on: https://gerrit.libreoffice.org/70158Tested-by: 's avatarXisco Faulí <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 38ad1050
...@@ -1047,9 +1047,34 @@ void paintGraphicUsingPrimitivesHelper( ...@@ -1047,9 +1047,34 @@ void paintGraphicUsingPrimitivesHelper(
ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()), ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()),
ceil(aClipRange.getMaxY() + aSinglePixelXY.getY())); 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( aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D(
basegfx::B2DPolyPolygon( aTarget,
basegfx::utils::createPolygonFromRect(aExpandedClipRange)),
aContent); aContent);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment