summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand (Collabora) <Armin.Le.Grand@me.com>2020-02-06 18:53:12 +0100
committerMichael Meeks <michael.meeks@collabora.com>2020-05-23 17:26:28 +0100
commit7bb7c4362fff2bb3ea58a372e5e4cb833fa54603 (patch)
tree6010eeb8b16908783b7a5d68fc083d94d319e567 /drawinglayer
parentd57bbeb0501c2d1864712b035b150c68fa18a3d2 (diff)
tdf#130478 Enhance Dashed line drawing on all systems
For more info and explanation including state of process information and discussion(s) see task please. Adding corrections for gerrit build Change-Id: Ie10fb8093a86459dee80db5ab4355b47e46c1f8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88130 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/polygonprimitive2d.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx92
2 files changed, 29 insertions, 65 deletions
diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index bcf1fc6bbc3b..10f91b7ff4bb 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -290,6 +290,7 @@ namespace drawinglayer
maLineAttribute(rLineAttribute),
maStrokeAttribute(rStrokeAttribute)
{
+ // MM01: keep these - these are no curve-decompposers but just checks
// simplify curve segments: moved here to not need to use it
// at VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect
maPolygon = basegfx::utils::simplifyCurveSegments(maPolygon);
@@ -303,6 +304,7 @@ namespace drawinglayer
maLineAttribute(rLineAttribute),
maStrokeAttribute()
{
+ // MM01: keep these - these are no curve-decompposers but just checks
// simplify curve segments: moved here to not need to use it
// at VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect
maPolygon = basegfx::utils::simplifyCurveSegments(maPolygon);
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index f5ad3de9f417..0cc87e6eaa20 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -108,7 +108,7 @@ namespace drawinglayer
void VclPixelProcessor2D::tryDrawPolyPolygonColorPrimitive2DDirect(const drawinglayer::primitive2d::PolyPolygonColorPrimitive2D& rSource, double fTransparency)
{
- if(!rSource.getB2DPolyPolygon().count())
+ if(!rSource.getB2DPolyPolygon().count() || fTransparency < 0.0 || fTransparency >= 1.0)
{
// no geometry, done
return;
@@ -128,7 +128,7 @@ namespace drawinglayer
{
const basegfx::B2DPolygon& rLocalPolygon(rSource.getB2DPolygon());
- if(!rLocalPolygon.count())
+ if(!rLocalPolygon.count() || fTransparency < 0.0 || fTransparency >= 1.0)
{
// no geometry, done
return true;
@@ -150,41 +150,28 @@ namespace drawinglayer
bool VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect(const drawinglayer::primitive2d::PolygonStrokePrimitive2D& rSource, double fTransparency)
{
- if(!rSource.getB2DPolygon().count())
+ const basegfx::B2DPolygon& rLocalPolygon(rSource.getB2DPolygon());
+
+ if(!rLocalPolygon.count() || fTransparency < 0.0 || fTransparency >= 1.0)
{
// no geometry, done
return true;
}
- // get geometry data, prepare hairline data
- const basegfx::B2DPolygon& aLocalPolygon(rSource.getB2DPolygon());
- basegfx::B2DPolyPolygon aHairLinePolyPolygon;
-
- // simplify curve segments
- // moved to PolygonStrokePrimitive2D::PolygonStrokePrimitive2D
- // aLocalPolygon = basegfx::utils::simplifyCurveSegments(aLocalPolygon);
-
- if(rSource.getStrokeAttribute().isDefault() || 0.0 == rSource.getStrokeAttribute().getFullDotDashLen())
- {
- // no line dashing, just copy
- aHairLinePolyPolygon.append(aLocalPolygon);
- }
- else
+ if (basegfx::B2DLineJoin::NONE == rSource.getLineAttribute().getLineJoin()
+ && css::drawing::LineCap_BUTT != rSource.getLineAttribute().getLineCap())
{
- // apply LineStyle
- basegfx::utils::applyLineDashing(
- aLocalPolygon,
- rSource.getStrokeAttribute().getDotDashArray(),
- &aHairLinePolyPolygon,
- nullptr,
- rSource.getStrokeAttribute().getFullDotDashLen());
+ // better use decompose to get that combination done for now, see discussion
+ // at https://bugs.documentfoundation.org/show_bug.cgi?id=130478#c17 and ff
+ return false;
}
- if(!aHairLinePolyPolygon.count())
- {
- // no geometry, done
- return true;
- }
+ // MM01: Radically change here - no dismantle/applyLineDashing,
+ // let that happen low-level at DrawPolyLineDirect implementations
+ // to open up for buffering and evtl. direct draw with sys-dep
+ // graphic systems. Check for stroke is in use
+ const bool bStrokeAttributeNotUsed(rSource.getStrokeAttribute().isDefault()
+ || 0.0 == rSource.getStrokeAttribute().getFullDotDashLen());
// check if LineWidth can be simplified in world coordinates
double fLineWidth(rSource.getLineAttribute().getWidth());
@@ -213,42 +200,17 @@ namespace drawinglayer
mpOutputDevice->SetFillColor();
mpOutputDevice->SetLineColor(Color(aLineColor));
- // do not transform self
- // aHairLinePolyPolygon.transform(maCurrentTransformation);
-
- bool bHasPoints(false);
- bool bTryWorked(false);
-
- for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++)
- {
- const basegfx::B2DPolygon& aSingle(aHairLinePolyPolygon.getB2DPolygon(a));
-
- if(aSingle.count())
- {
- bHasPoints = true;
-
- if(mpOutputDevice->DrawPolyLineDirect(
- maCurrentTransformation,
- aSingle,
- fLineWidth,
- fTransparency,
- rSource.getLineAttribute().getLineJoin(),
- rSource.getLineAttribute().getLineCap(),
- rSource.getLineAttribute().getMiterMinimumAngle()
- /* false bBypassAACheck, default*/))
- {
- bTryWorked = true;
- }
- }
- }
-
- if(!bTryWorked && !bHasPoints)
- {
- // no geometry despite try
- bTryWorked = true;
- }
-
- return bTryWorked;
+ // MM01 draw direct, hand over dash data if available
+ return mpOutputDevice->DrawPolyLineDirect(
+ maCurrentTransformation,
+ rLocalPolygon,
+ fLineWidth,
+ fTransparency,
+ bStrokeAttributeNotUsed ? nullptr : &rSource.getStrokeAttribute().getDotDashArray(),
+ rSource.getLineAttribute().getLineJoin(),
+ rSource.getLineAttribute().getLineCap(),
+ rSource.getLineAttribute().getMiterMinimumAngle()
+ /* false bBypassAACheck, default*/);
}
void VclPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)