kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

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

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