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
committerTor Lillqvist <tml@collabora.com>2020-02-11 07:19:01 +0100
commitc069861bf9a32c826cbc86a086a774eba49c4e6f (patch)
treeaa4e543b4f8fe795daaee315694e18b10b848e99 /drawinglayer
parentc728c670154a5f0854815bf7a2c94edf03728214 (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 Cherry-picked 5f61c9fe99ac93087b898adddbb4d4733f1fcd07: Adaptions made and checked that Caio fat line draw works as expected. Surprisingly some new files were created which I removed here again. Also needs to be cherry-picked is: 9c9f76dd5b6fb115e521ac6568673c7a10879192 which will enable direct dash paint for Cairo. Not done here due to not sure if I can do two cherry-picks in one run and it's lust a view lines, so -compared to this one- should be not difficult. 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> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88284 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.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 ea2e9c9aede6..9861f6f09722 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -293,6 +293,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);
@@ -306,6 +307,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 e5deac2936e5..692b2ed272de 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -107,7 +107,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;
@@ -127,7 +127,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;
@@ -149,41 +149,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());
@@ -212,42 +199,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)