Hi All,
This patch will solve the problem that a thin line is drawn instead dotted and dashed line.
In addition, to solve the problem when drawing thick dotted and dashed lines.
Bug URL: https://bugs.freedesktop.org/show_bug.cgi?id=37129
My patch is being submitted under LGPLv3+/MPL.
Regards,
Tomofumi Yagi.
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
index 1428a10..61f7a17 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 33df59c..f0347d4 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 +82,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 +217,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 +227,7 @@ namespace drawinglayer
aColor = getRGBColorRight();
}
- if(bIsHairline)
+ if(bIsHairline && bIsSolidline)
{
// create hairline primitive
aPolygon.append( getStart() );
@@ -237,12 +241,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 19648d4..dff42c3 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -766,6 +766,10 @@ namespace drawinglayer
}
else
{
+ // remeber that we enter a PolygonStrokePrimitive2D decomposition,
+ // used for AA thick line drawing
+ mnPolygonStrokePrimitive2D++;
+
mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
if(mnPolygonStrokePrimitive2D
@@ -783,6 +787,9 @@ namespace drawinglayer
mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0);
}
}
+
+ // leave PolygonStrokePrimitive2D
+ mnPolygonStrokePrimitive2D--;
}
}
diff --git a/svtools/inc/svtools/borderhelper.hxx b/svtools/inc/svtools/borderhelper.hxx
index de24369..97e03a8 100644
--- a/svtools/inc/svtools/borderhelper.hxx
+++ b/svtools/inc/svtools/borderhelper.hxx
@@ -42,6 +42,9 @@ namespace svtools
SVT_DLLPUBLIC basegfx::B2DPolyPolygon ApplyLineDashing( const basegfx::B2DPolygon& rPolygon,
sal_uInt16 nDashing, MapUnit eUnit );
+ SVT_DLLPUBLIC basegfx::B2DPolyPolygon ApplyLineDashing( const basegfx::B2DPolygon& rPolygon,
+ sal_uInt16 nDashing, MapUnit eUnit, double fScale );
+
SVT_DLLPUBLIC void DrawLine( OutputDevice& rDev, const basegfx::B2DPoint& rBeg,
const basegfx::B2DPoint& rEnd, sal_uInt32 nWidth, sal_uInt16 nDashing );
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 9305e18..904df6e 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -579,6 +579,24 @@ namespace svtools
return aPolygons;
}
+ basegfx::B2DPolyPolygon ApplyLineDashing( const basegfx::B2DPolygon& rPolygon, sal_uInt16
nDashing, MapUnit eUnit, double fScale )
+ {
+ std::vector< double > aPattern = GetDashing( nDashing, eUnit );
+ std::vector< double >::iterator i = aPattern.begin();
+ while( i != aPattern.end() ) {
+ (*i) *= fScale;
+ ++i;
+ }
+
+ basegfx::B2DPolyPolygon aPolygons;
+ if ( ! aPattern.empty() )
+ basegfx::tools::applyLineDashing( rPolygon, aPattern, &aPolygons );
+ else
+ aPolygons.append( rPolygon );
+
+ return aPolygons;
+ }
+
void DrawLine( OutputDevice& rDev, const Point& rP1, const Point& rP2,
sal_uInt32 nWidth, sal_uInt16 nDashing )
{
Context
- [Libreoffice] [PATCH] fix for fdo#37129 - Dotted and Dashed table borders are not drawn correctly · Tomofumi Yagi
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.