Blame SOURCES/0001-Resolves-tdf-105998-distort-hairline-borders-to-fall.patch

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