[Libreoffice-commits] core.git: vcl/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 11 10:43:38 UTC 2020


 vcl/source/outdev/line.cxx     |   20 ++++++++++----------
 vcl/source/outdev/polyline.cxx |   38 +++++++++++++++++++-------------------
 2 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit 1fde62018c8d3344a3408c7b6317120aefc778fb
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Nov 10 16:08:17 2020 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Nov 11 11:42:59 2020 +0100

    make sure mpAlphaVDev is drawn when drawing lines (tdf#137974)
    
    4deadc3c78949c18bb886eb1f66caa8f3cd7a2df made OutputDevice::DrawLine()
    use SalGraphics::DrawPolyLine() in more cases, which revealed that
    the the function was bailing out after the call and not drawing
    also to mpAlphaVDev.
    
    Change-Id: I1145d3684835b536737311294edfc566d5eb9025
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105553
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx
index f965f0fdd1fc..a715c25521ae 100644
--- a/vcl/source/outdev/line.cxx
+++ b/vcl/source/outdev/line.cxx
@@ -107,6 +107,8 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
     if ( mbInitLineColor )
         InitLineColor();
 
+    bool bDrawn = false;
+
     // #i101598# support AA and snap for lines, too
     if( mpGraphics->supportsOperation(OutDevSupportType::B2DDraw)
         && RasterOp::OverPaint == GetRasterOp()
@@ -123,7 +125,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
 
         const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline);
 
-        if( mpGraphics->DrawPolyLine(
+        bDrawn = mpGraphics->DrawPolyLine(
             basegfx::B2DHomMatrix(),
             aB2DPolyLine,
             0.0,
@@ -133,16 +135,14 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
             css::drawing::LineCap_BUTT,
             basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
             bPixelSnapHairline,
-            this))
-        {
-            return;
-        }
+            this);
+    }
+    if(!bDrawn)
+    {
+        const Point aStartPt(ImplLogicToDevicePixel(rStartPt));
+        const Point aEndPt(ImplLogicToDevicePixel(rEndPt));
+        mpGraphics->DrawLine( aStartPt.X(), aStartPt.Y(), aEndPt.X(), aEndPt.Y(), this );
     }
-
-    const Point aStartPt(ImplLogicToDevicePixel(rStartPt));
-    const Point aEndPt(ImplLogicToDevicePixel(rEndPt));
-
-    mpGraphics->DrawLine( aStartPt.X(), aStartPt.Y(), aEndPt.X(), aEndPt.Y(), this );
 
     if( mpAlphaVDev )
         mpAlphaVDev->DrawLine( rStartPt, rEndPt );
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index d0900c10da33..a1bd0df6f82e 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -67,7 +67,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly )
     const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation());
     const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline);
 
-    if(mpGraphics->DrawPolyLine(
+    bool bDrawn = mpGraphics->DrawPolyLine(
         aTransform,
         aB2DPolyLine,
         0.0,
@@ -77,28 +77,28 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly )
         css::drawing::LineCap_BUTT,
         basegfx::deg2rad(15.0) /*default fMiterMinimumAngle, not used*/,
         bPixelSnapHairline,
-        this))
-    {
-        return;
-    }
+        this);
 
-    tools::Polygon aPoly = ImplLogicToDevicePixel( rPoly );
-    SalPoint* pPtAry = reinterpret_cast<SalPoint*>(aPoly.GetPointAry());
-
-    // #100127# Forward beziers to sal, if any
-    if( aPoly.HasFlags() )
+    if(!bDrawn)
     {
-        const PolyFlags* pFlgAry = aPoly.GetConstFlagAry();
-        if( !mpGraphics->DrawPolyLineBezier( nPoints, pPtAry, pFlgAry, this ) )
+        tools::Polygon aPoly = ImplLogicToDevicePixel( rPoly );
+        SalPoint* pPtAry = reinterpret_cast<SalPoint*>(aPoly.GetPointAry());
+
+        // #100127# Forward beziers to sal, if any
+        if( aPoly.HasFlags() )
         {
-            aPoly = tools::Polygon::SubdivideBezier(aPoly);
-            pPtAry = reinterpret_cast<SalPoint*>(aPoly.GetPointAry());
-            mpGraphics->DrawPolyLine( aPoly.GetSize(), pPtAry, this );
+            const PolyFlags* pFlgAry = aPoly.GetConstFlagAry();
+            if( !mpGraphics->DrawPolyLineBezier( nPoints, pPtAry, pFlgAry, this ) )
+            {
+                aPoly = tools::Polygon::SubdivideBezier(aPoly);
+                pPtAry = reinterpret_cast<SalPoint*>(aPoly.GetPointAry());
+                mpGraphics->DrawPolyLine( aPoly.GetSize(), pPtAry, this );
+            }
+        }
+        else
+        {
+            mpGraphics->DrawPolyLine( nPoints, pPtAry, this );
         }
-    }
-    else
-    {
-        mpGraphics->DrawPolyLine( nPoints, pPtAry, this );
     }
 
     if( mpAlphaVDev )


More information about the Libreoffice-commits mailing list