kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0001-Related-tdf-105998-except-cut-and-paste-as-bitmap-in.patch

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