22ac1a5
From 15cdcd0346b7aa98d4697edec8aeea9c810efa62 Mon Sep 17 00:00:00 2001
22ac1a5
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
22ac1a5
Date: Tue, 5 Dec 2017 17:13:28 +0000
22ac1a5
Subject: [PATCH] Related: tdf#105998 except cut and paste as bitmap instead of
22ac1a5
 export
22ac1a5
MIME-Version: 1.0
22ac1a5
Content-Type: text/plain; charset=UTF-8
22ac1a5
Content-Transfer-Encoding: 8bit
22ac1a5
22ac1a5
Take a drawing rectangle in draw and cut and paste as bitmap to writer.  The
22ac1a5
hairline border along the very right/bottom edge of the bitmap appear missing.
22ac1a5
22ac1a5
fallback to default handlers which can distort the hairline to be visible
22ac1a5
22ac1a5
Change-Id: Iedb580f65879628839c83e41092745ae7c11267c
22ac1a5
Reviewed-on: https://gerrit.libreoffice.org/45902
22ac1a5
Tested-by: Jenkins <ci@libreoffice.org>
22ac1a5
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
22ac1a5
Tested-by: Caolán McNamara <caolanm@redhat.com>
22ac1a5
---
22ac1a5
 .../source/processor2d/vclpixelprocessor2d.cxx     | 25 +++++++++++++++++-----
22ac1a5
 1 file changed, 20 insertions(+), 5 deletions(-)
22ac1a5
22ac1a5
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
22ac1a5
index 9c21c83ee..5c5c0bb 100644
22ac1a5
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
22ac1a5
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
22ac1a5
@@ -41,6 +41,7 @@
22ac1a5
 #include "helperwrongspellrenderer.hxx"
22ac1a5
 #include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
22ac1a5
 #include <basegfx/polygon/b2dpolygontools.hxx>
22ac1a5
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
22ac1a5
 #include <vcl/hatch.hxx>
22ac1a5
 #include <tools/diagnose_ex.h>
22ac1a5
 #include <com/sun/star/awt/PosSize.hpp>
22ac1a5
@@ -210,10 +211,6 @@ namespace drawinglayer
22ac1a5
                 maBColorModifierStack.getModifiedColor(
22ac1a5
                     rSource.getLineAttribute().getColor()));
22ac1a5
 
22ac1a5
-            mpOutputDevice->SetFillColor();
22ac1a5
-            mpOutputDevice->SetLineColor(Color(aLineColor));
22ac1a5
-            aHairLinePolyPolygon.transform(maCurrentTransformation);
22ac1a5
-
22ac1a5
             double fLineWidth(rSource.getLineAttribute().getWidth());
22ac1a5
 
22ac1a5
             if(basegfx::fTools::more(fLineWidth, 0.0))
22ac1a5
@@ -234,6 +231,24 @@ namespace drawinglayer
22ac1a5
                 fLineWidth = 0.0;
22ac1a5
             }
22ac1a5
 
22ac1a5
+            //Related: tdf#105998 cut and paste as bitmap of shape from draw to
22ac1a5
+            //writer.  If we are a hairline along the very right/bottom edge of
22ac1a5
+            //the canvas then fallback to defaults which can distort the
22ac1a5
+            //hairline inside the paintable area
22ac1a5
+            if (fLineWidth == 0.0)
22ac1a5
+            {
22ac1a5
+                Size aSize = mpOutputDevice->GetOutputSize();
22ac1a5
+                basegfx::B2DRange aRange = aHairLinePolyPolygon.getB2DRange();
22ac1a5
+                basegfx::B2DRange aOutputRange = aRange;
22ac1a5
+                aOutputRange.transform(maCurrentTransformation);
22ac1a5
+                if (std::round(aOutputRange.getMaxX()) == aSize.Width() || std::round(aOutputRange.getMaxY()) == aSize.Height())
22ac1a5
+                    return false;
22ac1a5
+            }
22ac1a5
+
22ac1a5
+            mpOutputDevice->SetFillColor();
22ac1a5
+            mpOutputDevice->SetLineColor(Color(aLineColor));
22ac1a5
+            aHairLinePolyPolygon.transform(maCurrentTransformation);
22ac1a5
+
22ac1a5
             bool bHasPoints(false);
22ac1a5
             bool bTryWorked(false);
22ac1a5
 
22ac1a5
-- 
22ac1a5
2.9.5
22ac1a5