summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de (CIB)>2018-02-26 15:13:06 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-02-27 17:13:45 +0100
commite4d0e964b5be550c88c8c6693beca483c2ca1a1b (patch)
treedc24b27a13474dd215315586a33c90404715fdf1
parentd1114a44cef9c54dc6d5b35578ce272a3cb74811 (diff)
tdf#114076: Expand ClipRange to next PixelBound
Do this by going to basegfx::B2DRange, adding a single pixel size and using floor/ceil to go to full integer (as needed for pixels). Also need to go back to basegfx::B2DPolyPolygon for the creation of the needed MaskPrimitive2D. The general problem is that Writer is scrolling using blitting the unchanged parts, this forces this part of the scroll to pixel coordinate steps, while the ViewTransformation for paint nowadays has a sub-pixel precision. This results in an offset up to one pixel in radius. To solve this for now, we need to expand to the next outer pixel bound. Hopefully in the future we will someday be able to stay on the full available precision, but this will need a change in the repaint/scroll paradigm. Change-Id: Idb4a596bc298d1b80aab6f36ad4204afe94d54f7 Reviewed-on: https://gerrit.libreoffice.org/50369 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de> (cherry picked from commit c1230cede19ae3633e51c7ca780cb34d9dbaa20f) Reviewed-on: https://gerrit.libreoffice.org/50410 Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r--sw/source/core/doc/notxtfrm.cxx28
1 files changed, 27 insertions, 1 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 1ff730d580fb..4a5176d50e6b 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -79,6 +79,7 @@
#include <vcl/graphicfilter.hxx>
#include <vcl/pdfextoutdevdata.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
using namespace com::sun::star;
@@ -1022,8 +1023,33 @@ void paintGraphicUsingPrimitivesHelper(
if(0 != aClip.count())
{
+ // tdf#114076: Expand ClipRange to next PixelBound
+ // Do this by going to basegfx::B2DRange, adding a
+ // single pixel size and using floor/ceil to go to
+ // full integer (as needed for pixels). Also need
+ // to go back to basegfx::B2DPolyPolygon for the
+ // creation of the needed MaskPrimitive2D.
+ // The general problem is that Writer is scrolling
+ // using blitting the unchanged parts, this forces
+ // this part of the scroll to pixel coordinate steps,
+ // while the ViewTransformation for paint nowadays has
+ // a sub-pixel precision. This results in an offset
+ // up to one pixel in radius. To solve this for now,
+ // we need to expand to the next outer pixel bound.
+ // Hopefully in the future we will someday be able to
+ // stay on the full available precision, but this
+ // will need a change in the repaint/scroll paradigm.
+ const basegfx::B2DRange aClipRange(aClip.getB2DRange());
+ const basegfx::B2DVector aSinglePixelXY(rOutputDevice.GetInverseViewTransformation() * basegfx::B2DVector(1.0, 1.0));
+ const basegfx::B2DRange aExpandedClipRange(
+ floor(aClipRange.getMinX() - aSinglePixelXY.getX()),
+ floor(aClipRange.getMinY() - aSinglePixelXY.getY()),
+ ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()),
+ ceil(aClipRange.getMaxY() + aSinglePixelXY.getY()));
+
aContent[0] = new drawinglayer::primitive2d::MaskPrimitive2D(
- aClip,
+ basegfx::B2DPolyPolygon(
+ basegfx::utils::createPolygonFromRect(aExpandedClipRange)),
aContent);
}
}