Author: alg
Date: Tue Feb  7 11:49:36 2012
New Revision: 1241434

URL: http://svn.apache.org/viewvc?rev=1241434&view=rev
Log:
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for various 
optimization scenarios

Modified:
    incubator/ooo/trunk/main/drawinglayer/source/processor2d/vclprocessor2d.cxx

Modified: 
incubator/ooo/trunk/main/drawinglayer/source/processor2d/vclprocessor2d.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/source/processor2d/vclprocessor2d.cxx?rev=1241434&r1=1241433&r2=1241434&view=diff
==============================================================================
--- incubator/ooo/trunk/main/drawinglayer/source/processor2d/vclprocessor2d.cxx 
(original)
+++ incubator/ooo/trunk/main/drawinglayer/source/processor2d/vclprocessor2d.cxx 
Tue Feb  7 11:49:36 2012
@@ -1179,134 +1179,163 @@ namespace drawinglayer
                                if(nCount)
                                {
                     const bool 
bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing());
-                               
aHairlinePolyPolygon.transform(maCurrentTransformation);
+                    aHairlinePolyPolygon.transform(maCurrentTransformation);
 
-                    for(sal_uInt32 a(0); a < nCount; a++)
-                                   {
-                                           basegfx::B2DPolygon 
aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
-
-                        if(bAntiAliased)
+                    if(bAntiAliased)
+                    {
+                        if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 
1.0))
                         {
-                                                   
if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0))
+                            // line in range ]0.0 .. 1.0[
+                            // paint as simple hairline
+                            for(sal_uInt32 a(0); a < nCount; a++)
                             {
-                                // line in range ]0.0 .. 1.0[
-                                // paint as simple hairline
-                                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                                               bDone = true;
+                                
mpOutputDevice->DrawPolyLine(aHairlinePolyPolygon.getB2DPolygon(a), 0.0);
                             }
-                                                   else 
if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0))
-                            {
-                                // line in range [1.0 .. 2.0[
-                                // paint as 2x2 with dynamic line distance
-                                                           
basegfx::B2DHomMatrix aMat;
-                                const double fDistance(fDiscreteLineWidth - 
1.0);
-                                const double fHalfDistance(fDistance * 0.5);
 
-                                           aMat.set(0, 2, -fHalfDistance);
-                                           aMat.set(1, 2, -fHalfDistance);
-                                aCandidate.transform(aMat);
-                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            bDone = true;
+                        }
+                        else 
if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0))
+                        {
+                            // line in range [1.0 .. 2.0[
+                            // paint as 2x2 with dynamic line distance
+                            basegfx::B2DHomMatrix aMat;
+                            const double fDistance(fDiscreteLineWidth - 1.0);
+                            const double fHalfDistance(fDistance * 0.5);
 
-                                           aMat.set(0, 2, fDistance);
-                                           aMat.set(1, 2, 0.0);
+                            for(sal_uInt32 a(0); a < nCount; a++)
+                            {
+                                basegfx::B2DPolygon 
aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
+                            
+                                aMat.set(0, 2, -fHalfDistance);
+                                aMat.set(1, 2, -fHalfDistance);
                                 aCandidate.transform(aMat);
-                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
-                                           aMat.set(0, 2, 0.0);
-                                           aMat.set(1, 2, fDistance);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                
+                                aMat.set(0, 2, fDistance);
+                                aMat.set(1, 2, 0.0);
                                 aCandidate.transform(aMat);
-                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
-                                           aMat.set(0, 2, -fDistance);
-                                           aMat.set(1, 2, 0.0);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                
+                                aMat.set(0, 2, 0.0);
+                                aMat.set(1, 2, fDistance);
+                                aCandidate.transform(aMat);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                
+                                aMat.set(0, 2, -fDistance);
+                                aMat.set(1, 2, 0.0);
                                 aCandidate.transform(aMat);
-                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                                               bDone = true;
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
                             }
-                            else 
if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 3.0))
+
+                            bDone = true;
+                        }
+                        else 
if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 3.0))
+                        {
+                            // line in range [2.0 .. 3.0]
+                            // paint as cross in a 3x3  with dynamic line 
distance
+                            basegfx::B2DHomMatrix aMat;
+                            const double fDistance((fDiscreteLineWidth - 1.0) 
* 0.5);
+
+                            for(sal_uInt32 a(0); a < nCount; a++)
                             {
-                                // line in range [2.0 .. 3.0]
-                                // paint as cross in a 3x3  with dynamic line 
distance
-                                                           
basegfx::B2DHomMatrix aMat;
-                                const double fDistance((fDiscreteLineWidth - 
1.0) * 0.5);
+                                basegfx::B2DPolygon 
aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
 
                                 mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
 
                                 aMat.set(0, 2, -fDistance);
-                                           aMat.set(1, 2, 0.0);
+                                aMat.set(1, 2, 0.0);
                                 aCandidate.transform(aMat);
-                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            
                                 aMat.set(0, 2, fDistance);
-                                           aMat.set(1, 2, -fDistance);
+                                aMat.set(1, 2, -fDistance);
                                 aCandidate.transform(aMat);
-                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            
                                 aMat.set(0, 2, fDistance);
-                                           aMat.set(1, 2, fDistance);
+                                aMat.set(1, 2, fDistance);
                                 aCandidate.transform(aMat);
-                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            
                                 aMat.set(0, 2, -fDistance);
-                                           aMat.set(1, 2, fDistance);
+                                aMat.set(1, 2, fDistance);
                                 aCandidate.transform(aMat);
-                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                                               bDone = true;
-                            }
-                            else
-                            {
-                                // #i101491# line width above 3.0
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
                             }
+
+                            bDone = true;
                         }
                         else
                         {
-                                                   
if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.5))
+                            // #i101491# line width above 3.0
+                        }
+                    }
+                    else
+                    {
+                        if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 
1.5))
+                        {
+                            // line width below 1.5, draw the basic hairline 
polygon
+                            for(sal_uInt32 a(0); a < nCount; a++)
                             {
-                                                           // line width below 
1.5, draw the basic hairline polygon
-                                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                                               bDone = true;
+                                
mpOutputDevice->DrawPolyLine(aHairlinePolyPolygon.getB2DPolygon(a), 0.0);
                             }
-                            else 
if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.5))
-                            {
-                                                           // line width is in 
range ]1.5 .. 2.5], use four hairlines
-                                                           // drawn in a square
-                                                           
basegfx::B2DHomMatrix aMat;
-                                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
-                                                           aMat.set(0, 2, 1.0);
-                                                           aMat.set(1, 2, 0.0);
-                                                           
aCandidate.transform(aMat);
-
-                                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
 
-                                                           aMat.set(0, 2, 0.0);
-                                                           aMat.set(1, 2, 1.0);
-                                                           
aCandidate.transform(aMat);
+                            bDone = true;
+                        }
+                        else 
if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.5))
+                        {
+                            // line width is in range ]1.5 .. 2.5], use four 
hairlines
+                            // drawn in a square
+                            for(sal_uInt32 a(0); a < nCount; a++)
+                            {
+                                basegfx::B2DPolygon 
aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
+                                basegfx::B2DHomMatrix aMat;
 
-                                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            
+                                aMat.set(0, 2, 1.0);
+                                aMat.set(1, 2, 0.0);
+                                aCandidate.transform(aMat);
+                            
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            
+                                aMat.set(0, 2, 0.0);
+                                aMat.set(1, 2, 1.0);
+                                aCandidate.transform(aMat);
+                            
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            
+                                aMat.set(0, 2, -1.0);
+                                aMat.set(1, 2, 0.0);
+                                aCandidate.transform(aMat);
+                            
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            }
 
-                                                           aMat.set(0, 2, 
-1.0);
-                                                           aMat.set(1, 2, 0.0);
-                                                           
aCandidate.transform(aMat);
+                            bDone = true;
+                        }
+                        else
+                        {
+                            // #i101491# line width is above 2.5
+                        }
+                    }
 
-                                                           
mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                                               bDone = true;
-                            }
-                            else
-                            {
-                                // #i101491# line width is above 2.5
-                            }
+                    if(!bDone && 
rPolygonStrokeCandidate.getB2DPolygon().count() > 1000)
+                    {
+                        // #i101491# If the polygon complexity uses more than 
a given amount, do
+                        // use OuputDevice::DrawPolyLine directly; this will 
avoid buffering all
+                        // decompositions in primtives (memory) and fallback 
to old line painting
+                        // for very complex polygons, too
+                        for(sal_uInt32 a(0); a < nCount; a++)
+                        {
+                            mpOutputDevice->DrawPolyLine(
+                                aHairlinePolyPolygon.getB2DPolygon(a), 
+                                fDiscreteLineWidth, 
+                                rLineAttribute.getLineJoin(),
+                                rLineAttribute.getLineCap());
                         }
 
-                                               if(!bDone && 
rPolygonStrokeCandidate.getB2DPolygon().count() > 1000)
-                                               {
-                            // #i101491# If the polygon complexity uses more 
than a given amount, do
-                                                       // use 
OuputDevice::DrawPolyLine directly; this will avoid buffering all
-                                                       // decompositions in 
primtives (memory) and fallback to old line painting
-                                                       // for very complex 
polygons, too
-                                   mpOutputDevice->DrawPolyLine(aCandidate, 
fDiscreteLineWidth, rLineAttribute.getLineJoin());
-                                                       bDone = true;
-                                               }
+                        bDone = true;
                     }
                 }
             }


Reply via email to