diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-07 09:08:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-09 11:06:19 +0200 |
commit | 1501da01092d4ad4e5f3c8499fd8d1e18f87bc0c (patch) | |
tree | 38ddfacf96c179b45a9bcf8789d2f63afb29aea4 /sw | |
parent | 7af90cc93b76996f0f338c6a1285997531281e75 (diff) |
loplugin:oncevar
Change-Id: Id295dc0db174a448ef73db9de34f2de07d47f09a
Reviewed-on: https://gerrit.libreoffice.org/57108
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/notxtfrm.cxx | 98 |
1 files changed, 47 insertions, 51 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 6dd910fab9ee..de13c4d8b7b2 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -939,60 +939,56 @@ void paintGraphicUsingPrimitivesHelper( // -> the primitive renderer will create the needed pdf export data // -> if bitmap content, it will be cached system-dependent drawinglayer::primitive2d::Primitive2DContainer aContent(1); - bool bDone(false); - if(!bDone) + aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D( + rGraphicTransform, + rGrfObj, + rGraphicAttr); + + // RotateFlyFrame3: If ClipRegion is set at OutputDevice, we + // need to use that. Usually the renderer would be a VCL-based + // PrimitiveRenderer, but there are system-specific shortcuts that + // will *not* use the VCL-Paint of Bitmap and thus ignore this. + // Anyways, indirectly using a CLipRegion set at the target OutDev + // when using a PrimitiveRenderer is a non-valid implication. + // First tried only to use when HasPolyPolygonOrB2DPolyPolygon(), + // but there is an optimization at ClipRegion creation that detects + // a single Rectangle in a tools::PolyPolygon and forces to a simple + // RegionBand-based implementation, so cannot use it here. + if(rOutputDevice.IsClipRegion()) { - aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D( - rGraphicTransform, - rGrfObj, - rGraphicAttr); - - // RotateFlyFrame3: If ClipRegion is set at OutputDevice, we - // need to use that. Usually the renderer would be a VCL-based - // PrimitiveRenderer, but there are system-specific shortcuts that - // will *not* use the VCL-Paint of Bitmap and thus ignore this. - // Anyways, indirectly using a CLipRegion set at the target OutDev - // when using a PrimitiveRenderer is a non-valid implication. - // First tried only to use when HasPolyPolygonOrB2DPolyPolygon(), - // but there is an optimization at ClipRegion creation that detects - // a single Rectangle in a tools::PolyPolygon and forces to a simple - // RegionBand-based implementation, so cannot use it here. - if(rOutputDevice.IsClipRegion()) - { - const basegfx::B2DPolyPolygon aClip(rOutputDevice.GetClipRegion().GetAsB2DPolyPolygon()); + const basegfx::B2DPolyPolygon aClip(rOutputDevice.GetClipRegion().GetAsB2DPolyPolygon()); - 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( - basegfx::B2DPolyPolygon( - basegfx::utils::createPolygonFromRect(aExpandedClipRange)), - aContent); - } + 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( + basegfx::B2DPolyPolygon( + basegfx::utils::createPolygonFromRect(aExpandedClipRange)), + aContent); } } |