summaryrefslogtreecommitdiff
path: root/vcl/source/outdev
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-09-24 19:43:58 +0200
committerLuboš Luňák <l.lunak@collabora.com>2020-09-25 13:34:34 +0200
commit32020eb33ba9501510acb449bc84cfaa85bc0bd0 (patch)
tree1240f0adb461a130c434adb0e5216869839fd09e /vcl/source/outdev
parentfbcb6add21b889e20f67a7ef6e4e3c32ac1261d3 (diff)
don't write metafile action twice in DrawPolyLineDirect()
All other functions calling it already do so, so write it only when called from the outside. Change-Id: If17d973a5d6b3797db46e91a1ec36606a89c5d07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103353 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/source/outdev')
-rw-r--r--vcl/source/outdev/polyline.cxx54
1 files changed, 37 insertions, 17 deletions
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index 672854a9ed55..2a405e5eaf5a 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -56,7 +56,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly )
InitLineColor();
// use b2dpolygon drawing if possible
- if(DrawPolyLineDirect(
+ if(DrawPolyLineDirectInternal(
basegfx::B2DHomMatrix(),
rPoly.getB2DPolygon()))
{
@@ -171,7 +171,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
InitLineColor();
// use b2dpolygon drawing if possible
- if(DrawPolyLineDirect(
+ if(DrawPolyLineDirectInternal(
basegfx::B2DHomMatrix(),
rB2DPolygon,
fLineWidth,
@@ -228,7 +228,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
// to avoid optical gaps
for(auto const& rPolygon : aAreaPolyPolygon)
{
- (void)DrawPolyLineDirect(
+ (void)DrawPolyLineDirectInternal(
basegfx::B2DHomMatrix(),
rPolygon,
0.0,
@@ -311,6 +311,40 @@ bool OutputDevice::DrawPolyLineDirect(
double fMiterMinimumAngle,
bool bBypassAACheck)
{
+ if(DrawPolyLineDirectInternal(rObjectTransform, rB2DPolygon, fLineWidth, fTransparency,
+ pStroke, eLineJoin, eLineCap, fMiterMinimumAngle, bBypassAACheck))
+ {
+ // Worked, add metafile action (if recorded). This is done only here,
+ // because this function is public, other OutDev functions already add metafile
+ // actions, so they call the internal function directly.
+ if( mpMetaFile )
+ {
+ LineInfo aLineInfo;
+ if( fLineWidth != 0.0 )
+ aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) );
+ // Transport known information, might be needed
+ aLineInfo.SetLineJoin(eLineJoin);
+ aLineInfo.SetLineCap(eLineCap);
+ // MiterMinimumAngle does not exist yet in LineInfo
+ const tools::Polygon aToolsPolygon( rB2DPolygon );
+ mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) );
+ }
+ return true;
+ }
+ return false;
+}
+
+bool OutputDevice::DrawPolyLineDirectInternal(
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const basegfx::B2DPolygon& rB2DPolygon,
+ double fLineWidth,
+ double fTransparency,
+ const std::vector< double >* pStroke, // MM01
+ basegfx::B2DLineJoin eLineJoin,
+ css::drawing::LineCap eLineCap,
+ double fMiterMinimumAngle,
+ bool bBypassAACheck)
+{
assert(!is_double_buffered_window());
// AW: Do NOT paint empty PolyPolygons
@@ -358,20 +392,6 @@ bool OutputDevice::DrawPolyLineDirect(
if( bDrawSuccess )
{
- // worked, add metafile action (if recorded) and return true
- if( mpMetaFile )
- {
- LineInfo aLineInfo;
- if( fLineWidth != 0.0 )
- aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) );
- // Transport known information, might be needed
- aLineInfo.SetLineJoin(eLineJoin);
- aLineInfo.SetLineCap(eLineCap);
- // MiterMinimumAngle does not exist yet in LineInfo
- const tools::Polygon aToolsPolygon( rB2DPolygon );
- mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) );
- }
-
if (mpAlphaVDev)
mpAlphaVDev->DrawPolyLineDirect(rObjectTransform, rB2DPolygon, fLineWidth,
fTransparency, pStroke, eLineJoin, eLineCap,