[Libreoffice-commits] core.git: drawinglayer/source

Caolán McNamara caolanm at redhat.com
Mon Mar 13 15:28:58 UTC 2017


 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   21 ++++++++++++++++
 1 file changed, 21 insertions(+)

New commits:
commit 512afb41899a78f1e19ba79f237608aec15cc8bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 14 08:57:50 2017 +0000

    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 at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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();


More information about the Libreoffice-commits mailing list