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