diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-14 08:57:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-03-13 15:28:18 +0000 |
commit | 512afb41899a78f1e19ba79f237608aec15cc8bc (patch) | |
tree | 5143809f3859a2aad52fe0f60d159db0882d1bf9 /drawinglayer | |
parent | e1f36eddf4596901a51de42322ccbf8d1df9d139 (diff) |
Resolves: tdf#105998 distort hairline borders to fall inside the canvas
if we are a hairline along the very right/bottom edge
of the canvas then distory the polygon inwards one pixel right/bottom so that
the hairline falls inside the paintable area and becomes visible
Change-Id: Ie5713f6916cf5b47fdf14f86f034e38cda9900fd
Reviewed-on: https://gerrit.libreoffice.org/34243
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index b8e979548049..216be6b2e88e 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -165,6 +165,27 @@ namespace drawinglayer return true; } + //Resolves: tdf#105998 if we are a hairline along the very right/bottom edge + //of the canvas then distory the polygon inwards one pixel right/bottom so that + //the hairline falls inside the paintable area and becomes visible + Size aSize = mpOutputDevice->GetOutputSize(); + basegfx::B2DRange aRange = aLocalPolygon.getB2DRange(); + basegfx::B2DRange aOutputRange = aRange; + aOutputRange.transform(maCurrentTransformation); + if (std::round(aOutputRange.getMaxX()) == aSize.Width() || std::round(aOutputRange.getMaxY()) == aSize.Height()) + { + basegfx::B2DRange aOnePixel(0, 0, 1, 1); + aOnePixel.transform(maCurrentTransformation); + double fXOnePixel = 1.0 / aOnePixel.getMaxX(); + double fYOnePixel = 1.0 / aOnePixel.getMaxY(); + + basegfx::B2DPoint aTopLeft(aRange.getMinX(), aRange.getMinY()); + basegfx::B2DPoint aTopRight(aRange.getMaxX() - fXOnePixel, aRange.getMinY()); + basegfx::B2DPoint aBottomLeft(aRange.getMinX(), aRange.getMaxY() - fYOnePixel); + basegfx::B2DPoint aBottomRight(aRange.getMaxX() - fXOnePixel, aRange.getMaxY() - fYOnePixel); + aLocalPolygon = basegfx::tools::distort(aLocalPolygon, aRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight); + } + const basegfx::BColor aLineColor(maBColorModifierStack.getModifiedColor(rSource.getBColor())); mpOutputDevice->SetFillColor(); |