From 2e5d1e032d353884a1f391d9e55ca1be3f7a0b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 14 Feb 2017 08:57:50 +0000 Subject: [PATCH] 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 --- .../source/processor2d/vclpixelprocessor2d.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index b8e9795..216be6b 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(); -- 2.9.3