diff options
author | Tomofumi Yagi <yagit@mknada.sakura.ne.jp> | 2011-10-26 11:36:47 -0400 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2011-10-31 17:20:22 +0100 |
commit | 551fd132dc68652942ebb0c339a6e36b3e299f19 (patch) | |
tree | 656ae3e960f183a4e6a89648660f83084c273ab2 | |
parent | 09b4daf62aa69e1f23d2c03fba84ad3bcbc8c73e (diff) |
fdo#37129: Fix the drawing of dotted and dashed borders in Calc.
Signed-off-by: Kohei Yoshida <kohei.yoshida@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Signed-off-by: Cedric Bosdonnat <cedric.bosdonnat.ooo@free.fr>
3 files changed, 20 insertions, 4 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx index 1428a10a92..84139b05b9 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -33,6 +33,7 @@ #include <basegfx/color/bcolor.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> +#include <svtools/ctrlbox.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -110,6 +111,11 @@ namespace drawinglayer return basegfx::fTools::equal(1.0, mfRightWidth); } + bool isSolidLine() const + { + return (mnStyle==STYLE_SOLID); + } + bool isInsideUsed() const { return !basegfx::fTools::equalZero(mfLeftWidth); diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index 33df59c9f2..1a3b66c1ac 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -29,6 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_drawinglayer.hxx" +#include <drawinglayer/geometry/viewinformation2d.hxx> #include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <basegfx/polygon/b2dpolygon.hxx> @@ -79,7 +80,7 @@ namespace drawinglayer return basegfx::B2DPolyPolygon( clipPolygon ); } - Primitive2DSequence BorderLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DSequence BorderLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { Primitive2DSequence xRetval; @@ -214,6 +215,7 @@ namespace drawinglayer // Get which is the line to show bool bIsHairline = leftIsHairline(); + bool bIsSolidline = isSolidLine(); double nWidth = getCorrectedLeftWidth(); basegfx::BColor aColor = getRGBColorLeft(); if ( basegfx::fTools::equal( 0.0, mfLeftWidth ) ) @@ -223,7 +225,7 @@ namespace drawinglayer aColor = getRGBColorRight(); } - if(bIsHairline) + if(bIsHairline && bIsSolidline) { // create hairline primitive aPolygon.append( getStart() ); @@ -237,12 +239,13 @@ namespace drawinglayer { // create filled polygon primitive const basegfx::B2DVector aLineWidthOffset(((nWidth + 1) * 0.5) * aPerpendicular); + basegfx::B2DVector aScale( rViewInformation.getInverseObjectToViewTransformation() * aVector ); aPolygon.append( aTmpStart ); aPolygon.append( aTmpEnd ); basegfx::B2DPolyPolygon aDashed = svtools::ApplyLineDashing( - aPolygon, getStyle(), MAP_100TH_MM ); + aPolygon, getStyle(), MAP_PIXEL, aScale.getLength() ); for (sal_uInt32 i = 0; i < aDashed.count(); i++ ) { basegfx::B2DPolygon aDash = aDashed.getB2DPolygon( i ); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 19648d472c..4806cde99f 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -766,9 +766,13 @@ namespace drawinglayer } else { + // remember that we enter a PolygonStrokePrimitive2D decomposition, + // used for AA thick line drawing + mnPolygonStrokePrimitive2D++; + mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); - if(mnPolygonStrokePrimitive2D + if(mnPolygonStrokePrimitive2D && getOptionsDrawinglayer().IsAntiAliasing() && (mpOutputDevice->GetAntialiasing() & ANTIALIASING_ENABLE_B2DDRAW)) { @@ -783,6 +787,9 @@ namespace drawinglayer mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0); } } + + // leave PolygonStrokePrimitive2D + mnPolygonStrokePrimitive2D--; } } |