drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |    7 -
 include/vcl/outdev.hxx                                  |    4 -
 vcl/source/outdev/polyline.cxx                          |   61 ++++++----------
 3 files changed, 29 insertions(+), 43 deletions(-)

New commits:
commit 498a40f33908791c3b2409a1ccb4b3c81ea1e032
Author: Chris Sherlock <[email protected]>
Date:   Sun Nov 2 13:10:13 2014 +1100

    vcl: Refactor OutputDevice::TryDrawPolyLineDirect()
    
    I've renamed TryDrawPolyLineDirect() to DrawPolyLineDirect() and also
    renamed TryDrawPolyLineDirectNoAACheck() to drawPolyLineDirectNoAACheck().
    However, at the same time I feel that there is no need to call on
    drawPolyLineDirectNoAACheck in most instances, because DrawPolyLineDirect
    does an AA check before it can continue anyway. There is one instance where
    constantly checking the AA check is inefficient because it's in a loop, in
    that case then we call directly on drawPolyLineDirectNoAACheck, but this is
    the only case it is necessary.
    
    Change-Id: Ie0320bfc45b5c0e1ac6ce35912da3e2897af9429
    Reviewed-on: https://gerrit.libreoffice.org/12190
    Reviewed-by: Chris Sherlock <[email protected]>
    Tested-by: Chris Sherlock <[email protected]>

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index ddd6d33..d287739 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -173,10 +173,7 @@ namespace drawinglayer
             aLocalPolygon.transform(maCurrentTransformation);
 
             // try drawing; if it did not work, use standard fallback
-            if(mpOutputDevice->TryDrawPolyLineDirect(
-                aLocalPolygon,
-                0.0,
-                fTransparency))
+            if(mpOutputDevice->DrawPolyLineDirect( aLocalPolygon, 0.0, 
fTransparency))
             {
                 return true;
             }
@@ -258,7 +255,7 @@ namespace drawinglayer
                 {
                     bHasPoints = true;
 
-                    if(mpOutputDevice->TryDrawPolyLineDirect(
+                    if(mpOutputDevice->DrawPolyLineDirect(
                         aSingle,
                         fLineWidth,
                         fTransparency,
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 161342f..f505f04 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -726,7 +726,7 @@ public:
     void                        DrawPolyLine( const Polygon& rPoly,
                                               const LineInfo& rLineInfo );
 
-    bool                        TryDrawPolyLineDirect(
+    bool                        DrawPolyLineDirect(
                                     const basegfx::B2DPolygon& rB2DPolygon,
                                     double fLineWidth = 0.0,
                                     double fTransparency = 0.0,
@@ -742,7 +742,7 @@ private:
 
     // #i101491#
     // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's 
bool. Contains no AA check.
-    SAL_DLLPRIVATE bool         TryDrawPolyLineDirectNoAACheck(
+    SAL_DLLPRIVATE bool         drawPolyLineDirectNoAACheck(
                                     const basegfx::B2DPolygon& rB2DPolygon,
                                     double fLineWidth = 0.0,
                                     double fTransparency = 0.0,
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index 89e27c7..d896bd1 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -52,33 +52,25 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly )
     if ( mbInitLineColor )
         InitLineColor();
 
-    const bool bTryAA( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) &&
-                       mpGraphics->supportsOperation(OutDevSupport_B2DDraw) &&
-                       ROP_OVERPAINT == GetRasterOp() &&
-                       IsLineColor());
-
     // use b2dpolygon drawing if possible
-    if(bTryAA)
+    if ( DrawPolyLineDirect( rPoly.getB2DPolygon() ) )
     {
-        if ( TryDrawPolyLineDirectNoAACheck( rPoly.getB2DPolygon() ) )
-        {
-            basegfx::B2DPolygon aB2DPolyLine(rPoly.getB2DPolygon());
-            const ::basegfx::B2DHomMatrix aTransform = 
ImplGetDeviceTransformation();
-            const ::basegfx::B2DVector aB2DLineWidth( 1.0, 1.0 );
+        basegfx::B2DPolygon aB2DPolyLine(rPoly.getB2DPolygon());
+        const ::basegfx::B2DHomMatrix aTransform = 
ImplGetDeviceTransformation();
+        const ::basegfx::B2DVector aB2DLineWidth( 1.0, 1.0 );
 
-            // transform the polygon
-            aB2DPolyLine.transform( aTransform );
+        // transform the polygon
+        aB2DPolyLine.transform( aTransform );
 
-            if(mnAntialiasing & ANTIALIASING_PIXELSNAPHAIRLINE)
-            {
-                aB2DPolyLine = 
basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine);
-            }
+        if(mnAntialiasing & ANTIALIASING_PIXELSNAPHAIRLINE)
+        {
+            aB2DPolyLine = 
basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine);
+        }
 
-            if(mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth,
-                                         basegfx::B2DLINEJOIN_NONE, 
css::drawing::LineCap_BUTT, this))
-            {
-                return;
-            }
+        if(mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth,
+                                     basegfx::B2DLINEJOIN_NONE, 
css::drawing::LineCap_BUTT, this))
+        {
+            return;
         }
     }
 
@@ -162,17 +154,9 @@ void OutputDevice::DrawPolyLine( const 
basegfx::B2DPolygon& rB2DPolygon,
     if( mbInitLineColor )
         InitLineColor();
 
-    const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) &&
-                      mpGraphics->supportsOperation(OutDevSupport_B2DDraw) &&
-                      ROP_OVERPAINT == GetRasterOp() &&
-                      IsLineColor());
-
     // use b2dpolygon drawing if possible
-    if(bTryAA)
-    {
-        if ( TryDrawPolyLineDirectNoAACheck(rB2DPolygon, fLineWidth, 0.0, 
eLineJoin, eLineCap) )
-            return;
-    }
+    if ( DrawPolyLineDirect(rB2DPolygon, fLineWidth, 0.0, eLineJoin, eLineCap) 
)
+        return;
 
     // #i101491#
     // no output yet; fallback to geometry decomposition and use filled 
polygon paint
@@ -208,13 +192,18 @@ void OutputDevice::DrawPolyLine( const 
basegfx::B2DPolygon& rB2DPolygon,
         SetFillColor(aOldFillColor);
         InitFillColor();
 
+        const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) &&
+                          mpGraphics->supportsOperation(OutDevSupport_B2DDraw) 
&&
+                          ROP_OVERPAINT == GetRasterOp() &&
+                          IsLineColor());
+
         if(bTryAA)
         {
             // when AA it is necessary to also paint the filled polygon's 
outline
             // to avoid optical gaps
             for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++)
             {
-                
TryDrawPolyLineDirectNoAACheck(aAreaPolyPolygon.getB2DPolygon(a));
+                drawPolyLineDirectNoAACheck(aAreaPolyPolygon.getB2DPolygon(a));
             }
         }
     }
@@ -278,7 +267,7 @@ void OutputDevice::drawPolyLine(const Polygon& rPoly, const 
LineInfo& rLineInfo)
         mpAlphaVDev->DrawPolyLine( rPoly, rLineInfo );
 }
 
-bool OutputDevice::TryDrawPolyLineDirectNoAACheck( const basegfx::B2DPolygon& 
rB2DPolygon,
+bool OutputDevice::drawPolyLineDirectNoAACheck( const basegfx::B2DPolygon& 
rB2DPolygon,
                                               double fLineWidth,
                                               double fTransparency,
                                               basegfx::B2DLineJoin eLineJoin,
@@ -316,7 +305,7 @@ bool OutputDevice::TryDrawPolyLineDirectNoAACheck( const 
basegfx::B2DPolygon& rB
                                      this);
 }
 
-bool OutputDevice::TryDrawPolyLineDirect( const basegfx::B2DPolygon& 
rB2DPolygon,
+bool OutputDevice::DrawPolyLineDirect( const basegfx::B2DPolygon& rB2DPolygon,
                                           double fLineWidth,
                                           double fTransparency,
                                           basegfx::B2DLineJoin eLineJoin,
@@ -346,7 +335,7 @@ bool OutputDevice::TryDrawPolyLineDirect( const 
basegfx::B2DPolygon& rB2DPolygon
 
     if(bTryAA)
     {
-        if(TryDrawPolyLineDirectNoAACheck(rB2DPolygon, fLineWidth, 
fTransparency, eLineJoin, eLineCap))
+        if(drawPolyLineDirectNoAACheck(rB2DPolygon, fLineWidth, fTransparency, 
eLineJoin, eLineCap))
         {
             // worked, add metafile action (if recorded) and return true
             if( mpMetaFile )
_______________________________________________
Libreoffice-commits mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to