69cc7b
From 2e5d1e032d353884a1f391d9e55ca1be3f7a0b9d Mon Sep 17 00:00:00 2001
69cc7b
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
69cc7b
Date: Tue, 14 Feb 2017 08:57:50 +0000
69cc7b
Subject: [PATCH] Resolves: tdf#105998 distort hairline borders to fall inside
69cc7b
 the canvas
69cc7b
69cc7b
if we are a hairline along the very right/bottom edge
69cc7b
of the canvas then distory the polygon inwards one pixel right/bottom so that
69cc7b
the hairline falls inside the paintable area and becomes visible
69cc7b
69cc7b
Change-Id: Ie5713f6916cf5b47fdf14f86f034e38cda9900fd
69cc7b
---
69cc7b
 .../source/processor2d/vclpixelprocessor2d.cxx      | 21 +++++++++++++++++++++
69cc7b
 1 file changed, 21 insertions(+)
69cc7b
69cc7b
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
69cc7b
index b8e9795..216be6b 100644
69cc7b
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
69cc7b
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
69cc7b
@@ -165,6 +165,27 @@ namespace drawinglayer
69cc7b
                 return true;
69cc7b
             }
69cc7b
 
69cc7b
+            //Resolves: tdf#105998 if we are a hairline along the very right/bottom edge
69cc7b
+            //of the canvas then distory the polygon inwards one pixel right/bottom so that
69cc7b
+            //the hairline falls inside the paintable area and becomes visible
69cc7b
+            Size aSize = mpOutputDevice->GetOutputSize();
69cc7b
+            basegfx::B2DRange aRange = aLocalPolygon.getB2DRange();
69cc7b
+            basegfx::B2DRange aOutputRange = aRange;
69cc7b
+            aOutputRange.transform(maCurrentTransformation);
69cc7b
+            if (std::round(aOutputRange.getMaxX()) == aSize.Width() || std::round(aOutputRange.getMaxY()) == aSize.Height())
69cc7b
+            {
69cc7b
+                basegfx::B2DRange aOnePixel(0, 0, 1, 1);
69cc7b
+                aOnePixel.transform(maCurrentTransformation);
69cc7b
+                double fXOnePixel = 1.0 / aOnePixel.getMaxX();
69cc7b
+                double fYOnePixel = 1.0 / aOnePixel.getMaxY();
69cc7b
+
69cc7b
+                basegfx::B2DPoint aTopLeft(aRange.getMinX(), aRange.getMinY());
69cc7b
+                basegfx::B2DPoint aTopRight(aRange.getMaxX() - fXOnePixel, aRange.getMinY());
69cc7b
+                basegfx::B2DPoint aBottomLeft(aRange.getMinX(), aRange.getMaxY() - fYOnePixel);
69cc7b
+                basegfx::B2DPoint aBottomRight(aRange.getMaxX() - fXOnePixel, aRange.getMaxY() - fYOnePixel);
69cc7b
+                aLocalPolygon = basegfx::tools::distort(aLocalPolygon, aRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
69cc7b
+            }
69cc7b
+
69cc7b
             const basegfx::BColor aLineColor(maBColorModifierStack.getModifiedColor(rSource.getBColor()));
69cc7b
 
69cc7b
             mpOutputDevice->SetFillColor();
69cc7b
-- 
69cc7b
2.9.3
69cc7b