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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Aug 28 04:09:21 PDT 2015


 vcl/opengl/gdiimpl.cxx |   32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

New commits:
commit c9d39c37b2c186e2b9d9841b18ecc6aed4684f62
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Aug 28 19:32:35 2015 +0900

    tdf#93736 need to create trapezoid from input polygon
    
    Currently we draw the polyline from the input polygon, but we
    should first create a trapezoid and draw its polygons when drawing
    the hairline.
    
    Change-Id: Idd850d18d05410c75a8a2c922338caf46158bfd4

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 286fa7f..97f2547 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1415,27 +1415,31 @@ bool OpenGLSalGraphicsImpl::drawPolyLine(
     basegfx::B2DPolygon aPolygon = rPolygon;
     const double fHalfWidth = 0.5 * rLineWidth.getX();
 
-    // #i122456# This is probably thought to happen to align hairlines to pixel positions, so
-    // it should be a 0.5 translation, not more. It will definitely go wrong with fat lines
-    aPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix(0.5, 0.5) );
-
     // shortcut for hairline drawing to improve performance
-    //bool bDrawnOk = true;
     if( bIsHairline )
     {
-        PreDraw();
-        if( UseSolidAA( mnLineColor ) )
+        basegfx::B2DTrapezoidVector aTrapezVector;
+        basegfx::tools::createLineTrapezoidFromB2DPolygon(aTrapezVector, aPolygon, rLineWidth.getX());
+        if (aTrapezVector.size())
         {
-            sal_uInt32 nPoints = rPolygon.count();
-            for (sal_uInt32 i = 0; i < nPoints - 1; ++i)
+            PreDraw();
+            if (UseSolidAA(mnLineColor, fTransparency))
             {
-                const basegfx::B2DPoint& rPt1 = rPolygon.getB2DPoint(i);
-                const basegfx::B2DPoint& rPt2 = rPolygon.getB2DPoint(i+1);
-                DrawLineAA(rPt1.getX(), rPt1.getY(),
-                           rPt2.getX(), rPt2.getY());
+                for (size_t i = 0; i < aTrapezVector.size(); ++i)
+                {
+                    const basegfx::B2DPolygon& rTrapezPolygon = aTrapezVector[i].getB2DPolygon();
+                    sal_uInt32 nPoints = rTrapezPolygon.count();
+                    for (sal_uInt32 j = 0; j < nPoints - 1; ++j)
+                    {
+                        const basegfx::B2DPoint& rPoint1 = rTrapezPolygon.getB2DPoint(j);
+                        const basegfx::B2DPoint& rPoint2 = rTrapezPolygon.getB2DPoint(j + 1);
+                        DrawLineAA(rPoint1.getX(), rPoint1.getY(),
+                                   rPoint2.getX(), rPoint2.getY());
+                    }
+                }
             }
+            PostDraw();
         }
-        PostDraw();
         return true;
     }
 


More information about the Libreoffice-commits mailing list