[Libreoffice-commits] core.git: vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 13 13:02:38 UTC 2018


 vcl/qt5/Qt5Graphics_GDI.cxx         |    6 ++----
 vcl/quartz/salgdicommon.cxx         |   12 ++++--------
 vcl/source/filter/wmf/emfwr.cxx     |   10 ++++------
 vcl/source/filter/wmf/wmfwr.cxx     |   10 ++++------
 vcl/source/gdi/gdimetafiletools.cxx |    8 ++++----
 vcl/source/gdi/gdimtf.cxx           |   18 ++++++++----------
 vcl/source/gdi/lineinfo.cxx         |    8 ++++----
 vcl/source/gdi/pdfwriter_impl.cxx   |    5 ++---
 vcl/source/outdev/line.cxx          |   19 +++++++++----------
 vcl/source/outdev/polygon.cxx       |   12 ++++++++----
 vcl/source/outdev/polyline.cxx      |    8 ++++----
 vcl/source/outdev/text.cxx          |    4 ++--
 vcl/source/outdev/transparent.cxx   |   18 ++++++------------
 vcl/unx/generic/gdi/salgdi.cxx      |   13 +++++--------
 vcl/win/gdi/gdiimpl.cxx             |    8 ++++----
 15 files changed, 70 insertions(+), 89 deletions(-)

New commits:
commit 00e10ae3189a4407ffb1a48f836cd52dc9a1b6df
Author:     Jochen Nitschke <j.nitschke+logerrit at ok.de>
AuthorDate: Fri Oct 12 20:06:18 2018 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Sat Oct 13 15:02:17 2018 +0200

    use range based loops over B2DPolyPolygon in vcl
    
    Change-Id: I98f17311822ba50b0c8eaa50fbdef088c76168d4
    Reviewed-on: https://gerrit.libreoffice.org/61730
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index f8ab00ea1494..91c4c889bc18 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -37,8 +37,7 @@ static void AddPolygonToPath(QPainterPath& rPath, const basegfx::B2DPolygon& rPo
                              bool bClosePath, bool bPixelSnap, bool bLineDraw)
 {
     // short circuit if there is nothing to do
-    const int nPointCount = rPolygon.count();
-    if (nPointCount <= 0)
+    if (rPolygon.count() == 0)
         return;
 
     const bool bHasCurves = rPolygon.areControlPointsUsed();
@@ -105,9 +104,8 @@ static bool AddPolyPolygonToPath(QPainterPath& rPath, const basegfx::B2DPolyPoly
     const int nPolyCount = rPolyPoly.count();
     if (nPolyCount <= 0)
         return false;
-    for (int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx)
+    for (auto const& rPolygon : rPolyPoly)
     {
-        const basegfx::B2DPolygon rPolygon = rPolyPoly.getB2DPolygon(nPolyIdx);
         AddPolygonToPath(rPath, rPolygon, true, bPixelSnap, bLineDraw);
     }
     return true;
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 40ae59121653..65d158f98201 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -135,14 +135,12 @@ static void AddPolyPolygonToPath( CGMutablePathRef xPath,
                                   bool bPixelSnap, bool bLineDraw )
 {
     // short circuit if there is nothing to do
-    const int nPolyCount = rPolyPoly.count();
-    if( nPolyCount <= 0 )
+    if( rPolyPoly.count() == 0 )
     {
         return;
     }
-    for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
+    for(auto const& rPolygon : rPolyPoly)
     {
-        const basegfx::B2DPolygon rPolygon = rPolyPoly.getB2DPolygon( nPolyIdx );
         AddPolygonToPath( xPath, rPolygon, true, bPixelSnap, bLineDraw );
     }
 }
@@ -969,8 +967,7 @@ bool AquaSalGraphics::drawPolyPolygon(
     double fTransparency)
 {
     // short circuit if there is nothing to do
-    const int nPolyCount = rPolyPolygon.count();
-    if( nPolyCount <= 0 )
+    if( rPolyPolygon.count() == 0 )
         return true;
 
     // ignore invisible polygons
@@ -984,9 +981,8 @@ bool AquaSalGraphics::drawPolyPolygon(
     // setup poly-polygon path
     CGMutablePathRef xPath = CGPathCreateMutable();
     SAL_INFO( "vcl.cg", "CGPathCreateMutable() = " << xPath );
-    for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
+    for(auto const& rPolygon : rPolyPolygon)
     {
-        const basegfx::B2DPolygon rPolygon = rPolyPolygon.getB2DPolygon( nPolyIdx );
         AddPolygonToPath( xPath, rPolygon, true, !getAntiAliasB2DDraw(), IsPenVisible() );
     }
 
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 17d119f4ee60..914b8a8c1cd6 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -917,10 +917,9 @@ void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const bas
 
         if(aLinePolyPolygon.count())
         {
-            for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
+            for(auto const& rB2DPolygon : aLinePolyPolygon)
             {
-                const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
-                ImplWritePolygonRecord( tools::Polygon(aCandidate), false );
+                ImplWritePolygonRecord( tools::Polygon(rB2DPolygon), false );
             }
         }
 
@@ -932,10 +931,9 @@ void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const bas
             maVDev->SetLineColor();
             maVDev->SetFillColor(aOldLineColor);
 
-            for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
+            for(auto const& rB2DPolygon : aFillPolyPolygon)
             {
-                const tools::Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
-                ImplWritePolyPolygonRecord(tools::PolyPolygon( tools::Polygon(aPolygon) ));
+                ImplWritePolyPolygonRecord(tools::PolyPolygon( tools::Polygon(rB2DPolygon) ));
             }
 
             maVDev->SetLineColor(aOldLineColor);
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 3c8c1240384e..a7eb3e212952 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -984,10 +984,9 @@ void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx:
             aSrcLineInfo = rInfo;
             SetLineAndFillAttr();
 
-            for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
+            for(auto const& rB2DPolygon : aLinePolyPolygon)
             {
-                const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
-                WMFRecord_PolyLine( tools::Polygon(aCandidate) );
+                WMFRecord_PolyLine( tools::Polygon(rB2DPolygon) );
             }
         }
 
@@ -1000,10 +999,9 @@ void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx:
             aSrcFillColor = aOldLineColor;
             SetLineAndFillAttr();
 
-            for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
+            for(auto const& rB2DPolygon : aFillPolyPolygon)
             {
-                const tools::Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
-                WMFRecord_Polygon( aPolygon );
+                WMFRecord_Polygon( tools::Polygon(rB2DPolygon) );
             }
 
             aSrcLineColor = aOldLineColor;
diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx
index 84cd0e373739..7420e65bcdce 100644
--- a/vcl/source/gdi/gdimetafiletools.cxx
+++ b/vcl/source/gdi/gdimetafiletools.cxx
@@ -58,11 +58,11 @@ namespace
                     // add clipped geometry
                     if(bStroke)
                     {
-                        for(sal_uInt32 a(0); a < aResult.count(); a++)
+                        for(auto const& rB2DPolygon : aResult)
                         {
                             rTarget.AddAction(
                                 new MetaPolyLineAction(
-                                        tools::Polygon(aResult.getB2DPolygon(a))));
+                                        tools::Polygon(rB2DPolygon)));
                         }
                     }
                     else
@@ -937,9 +937,9 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource)
                                 if(aResult.count() > 1 || aResult.getB2DPolygon(0) != aSource)
                                 {
                                     // add clipped geometry
-                                    for(sal_uInt32 a(0); a < aResult.count(); a++)
+                                    for(auto const& rB2DPolygon : aResult)
                                     {
-                                        aStroke.setPath(tools::Polygon(aResult.getB2DPolygon(a)));
+                                        aStroke.setPath(tools::Polygon(rB2DPolygon));
                                         addSvtGraphicStroke(aStroke, aTarget);
                                     }
 
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 9aea2f5df27a..0f93bc0908e8 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2477,18 +2477,16 @@ BitmapChecksum GDIMetaFile::GetChecksum() const
                     // In worst case a very expensive RegionHandle representation gets created.
                     // In this case it's cheaper to use the PolyPolygon
                     const basegfx::B2DPolyPolygon aPolyPolygon(rRegion.GetAsB2DPolyPolygon());
-                    const sal_uInt32 nPolyCount(aPolyPolygon.count());
                     SVBT64 aSVBT64;
 
-                    for(sal_uInt32 a(0); a < nPolyCount; a++)
+                    for(auto const& rPolygon : aPolyPolygon)
                     {
-                        const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(a));
-                        const sal_uInt32 nPointCount(aPolygon.count());
-                        const bool bControl(aPolygon.areControlPointsUsed());
+                        const sal_uInt32 nPointCount(rPolygon.count());
+                        const bool bControl(rPolygon.areControlPointsUsed());
 
                         for(sal_uInt32 b(0); b < nPointCount; b++)
                         {
-                            const basegfx::B2DPoint aPoint(aPolygon.getB2DPoint(b));
+                            const basegfx::B2DPoint aPoint(rPolygon.getB2DPoint(b));
 
                             DoubleToSVBT64(aPoint.getX(), aSVBT64);
                             nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
@@ -2497,9 +2495,9 @@ BitmapChecksum GDIMetaFile::GetChecksum() const
 
                             if(bControl)
                             {
-                                if(aPolygon.isPrevControlPointUsed(b))
+                                if(rPolygon.isPrevControlPointUsed(b))
                                 {
-                                    const basegfx::B2DPoint aCtrl(aPolygon.getPrevControlPoint(b));
+                                    const basegfx::B2DPoint aCtrl(rPolygon.getPrevControlPoint(b));
 
                                     DoubleToSVBT64(aCtrl.getX(), aSVBT64);
                                     nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
@@ -2507,9 +2505,9 @@ BitmapChecksum GDIMetaFile::GetChecksum() const
                                     nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
                                 }
 
-                                if(aPolygon.isNextControlPointUsed(b))
+                                if(rPolygon.isNextControlPointUsed(b))
                                 {
-                                    const basegfx::B2DPoint aCtrl(aPolygon.getNextControlPoint(b));
+                                    const basegfx::B2DPoint aCtrl(rPolygon.getNextControlPoint(b));
 
                                     DoubleToSVBT64(aCtrl.getX(), aSVBT64);
                                     nCrc = vcl_get_checksum(nCrc, aSVBT64, 8);
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
index f8bc5591a3e9..d7104171646a 100644
--- a/vcl/source/gdi/lineinfo.cxx
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -226,11 +226,11 @@ void LineInfo::applyToB2DPolyPolygon(
             {
                 basegfx::B2DPolyPolygon aResult;
 
-                for(sal_uInt32 c(0); c < io_rLinePolyPolygon.count(); c++)
+                for(auto const& rPolygon : io_rLinePolyPolygon)
                 {
                     basegfx::B2DPolyPolygon aLineTraget;
                     basegfx::utils::applyLineDashing(
-                        io_rLinePolyPolygon.getB2DPolygon(c),
+                        rPolygon,
                         fDotDashArray,
                         &aLineTraget);
                     aResult.append(aLineTraget);
@@ -244,10 +244,10 @@ void LineInfo::applyToB2DPolyPolygon(
         {
             const double fHalfLineWidth((GetWidth() * 0.5) + 0.5);
 
-            for(sal_uInt32 a(0); a < io_rLinePolyPolygon.count(); a++)
+            for(auto const& rPolygon : io_rLinePolyPolygon)
             {
                 o_rFillPolyPolygon.append(basegfx::utils::createAreaGeometry(
-                    io_rLinePolyPolygon.getB2DPolygon(a),
+                    rPolygon,
                     fHalfLineWidth,
                     GetLineJoin(),
                     GetLineCap()));
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index a70c73c3a2ed..af54291d6c1f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1539,9 +1539,8 @@ void PDFWriterImpl::PDFPage::appendPolyPolygon( const tools::PolyPolygon& rPolyP
 
 void PDFWriterImpl::PDFPage::appendPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPoly, OStringBuffer& rBuffer ) const
 {
-    sal_uInt32 nPolygons = rPolyPoly.count();
-    for( sal_uInt32 n = 0; n < nPolygons; n++ )
-        appendPolygon( rPolyPoly.getB2DPolygon( n ), rBuffer );
+    for(auto const& rPolygon : rPolyPoly)
+        appendPolygon( rPolygon, rBuffer );
 }
 
 void PDFWriterImpl::PDFPage::appendMappedLength( sal_Int32 nLength, OStringBuffer& rBuffer, bool bVertical, sal_Int32* pOutLength ) const
diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx
index fecacba8f641..54203424257b 100644
--- a/vcl/source/outdev/line.cxx
+++ b/vcl/source/outdev/line.cxx
@@ -193,11 +193,11 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin
         {
             basegfx::B2DPolyPolygon aResult;
 
-            for(sal_uInt32 c(0); c < aLinePolyPolygon.count(); c++)
+            for(auto const& rPolygon : aLinePolyPolygon)
             {
                 basegfx::B2DPolyPolygon aLineTarget;
                 basegfx::utils::applyLineDashing(
-                    aLinePolyPolygon.getB2DPolygon(c),
+                    rPolygon,
                     fDotDashArray,
                     &aLineTarget);
                 aResult.append(aLineTarget);
@@ -221,10 +221,10 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin
             aLinePolyPolygon = basegfx::utils::adaptiveSubdivideByDistance(aLinePolyPolygon, 1.0);
         }
 
-        for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
+        for(auto const& rPolygon : aLinePolyPolygon)
         {
             aFillPolyPolygon.append(basegfx::utils::createAreaGeometry(
-                aLinePolyPolygon.getB2DPolygon(a),
+                rPolygon,
                 fHalfLineWidth,
                 rInfo.GetLineJoin(),
                 rInfo.GetLineCap()));
@@ -238,9 +238,8 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin
 
     if(aLinePolyPolygon.count())
     {
-        for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
+        for(auto const& rB2DPolygon : aLinePolyPolygon)
         {
-            const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
             const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline);
             bool bDone(false);
 
@@ -248,7 +247,7 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin
             {
                 bDone = mpGraphics->DrawPolyLine(
                     basegfx::B2DHomMatrix(),
-                    aCandidate,
+                    rB2DPolygon,
                     0.0,
                     basegfx::B2DVector(1.0,1.0),
                     basegfx::B2DLineJoin::NONE,
@@ -260,7 +259,7 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin
 
             if(!bDone)
             {
-                tools::Polygon aPolygon(aCandidate);
+                tools::Polygon aPolygon(rB2DPolygon);
                 mpGraphics->DrawPolyLine(
                     aPolygon.GetSize(),
                     reinterpret_cast<SalPoint*>(aPolygon.GetPointAry()),
@@ -292,9 +291,9 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin
 
         if(!bDone)
         {
-            for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
+            for(auto const& rB2DPolygon : aFillPolyPolygon)
             {
-                tools::Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
+                tools::Polygon aPolygon(rB2DPolygon);
 
                 // need to subdivide, mpGraphics->DrawPolygon ignores curves
                 aPolygon.AdaptiveSubdivide(aPolygon);
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index 7f865108756a..567c4d58e93b 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -94,11 +94,11 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly )
             const basegfx::B2DVector aB2DLineWidth( 1.0, 1.0 );
             const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline);
 
-            for(sal_uInt32 a(0); bSuccess && a < aB2DPolyPolygon.count(); a++)
+            for(auto const& rPolygon : aB2DPolyPolygon)
             {
                 bSuccess = mpGraphics->DrawPolyLine(
                     aTransform,
-                    aB2DPolyPolygon.getB2DPolygon(a),
+                    rPolygon,
                     0.0,
                     aB2DLineWidth,
                     basegfx::B2DLineJoin::NONE,
@@ -106,6 +106,8 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly )
                     basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
                     bPixelSnapHairline,
                     this);
+                if (!bSuccess)
+                    break;
             }
         }
 
@@ -320,11 +322,11 @@ void OutputDevice::ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyP
             const basegfx::B2DVector aB2DLineWidth( 1.0, 1.0 );
             const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline);
 
-            for(sal_uInt32 a(0);bSuccess && a < aB2DPolyPolygon.count(); a++)
+            for(auto const& rPolygon : aB2DPolyPolygon)
             {
                 bSuccess = mpGraphics->DrawPolyLine(
                     aTransform,
-                    aB2DPolyPolygon.getB2DPolygon(a),
+                    rPolygon,
                     0.0,
                     aB2DLineWidth,
                     basegfx::B2DLineJoin::NONE,
@@ -332,6 +334,8 @@ void OutputDevice::ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyP
                     basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
                     bPixelSnapHairline,
                     this);
+                if (!bSuccess)
+                    break;
             }
         }
 
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index da8be42cd304..a1b63fe494dd 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -210,10 +210,10 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
         InitFillColor();
 
         // draw using a loop; else the topology will paint a PolyPolygon
-        for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++)
+        for(auto const& rPolygon : aAreaPolyPolygon)
         {
             ImplDrawPolyPolygonWithB2DPolyPolygon(
-                basegfx::B2DPolyPolygon(aAreaPolyPolygon.getB2DPolygon(a)));
+                basegfx::B2DPolyPolygon(rPolygon));
         }
 
         SetLineColor(aOldLineColor);
@@ -228,11 +228,11 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
 
         // 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++)
+        for(auto const& rPolygon : aAreaPolyPolygon)
         {
             (void)DrawPolyLineDirect(
                 basegfx::B2DHomMatrix(),
-                aAreaPolyPolygon.getB2DPolygon(a),
+                rPolygon,
                 0.0,
                 0.0,
                 basegfx::B2DLineJoin::NONE,
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index b0243b3395a6..cd9ba5e628e3 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2533,8 +2533,8 @@ bool OutputDevice::GetTextOutline( tools::PolyPolygon& rPolyPoly, const OUString
 
     // convert and merge into a tool polypolygon
     for (auto const& elem : aB2DPolyPolyVector)
-        for( unsigned int i = 0; i < elem.count(); ++i )
-            rPolyPoly.Insert(tools::Polygon(elem.getB2DPolygon( i ))); // #i76339#
+        for(auto const& rB2DPolygon : elem)
+            rPolyPoly.Insert(tools::Polygon(rB2DPolygon)); // #i76339#
 
     return true;
 }
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 98409984da90..fdb3115b2812 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -69,8 +69,8 @@ namespace
     tools::PolyPolygon toPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPoly )
     {
         tools::PolyPolygon aTarget;
-        for (sal_uInt32 i = 0; i < rPolyPoly.count(); ++i)
-            aTarget.Insert(toPolygon(rPolyPoly.getB2DPolygon(i)));
+        for (auto const& rB2DPolygon : rPolyPoly)
+            aTarget.Insert(toPolygon(rB2DPolygon));
 
         return aTarget;
     }
@@ -269,16 +269,13 @@ void OutputDevice::DrawTransparent(
         if( bDrawnOk && IsLineColor() )
         {
             const basegfx::B2DVector aHairlineWidth(1,1);
-            const sal_uInt32 nPolyCount(aB2DPolyPolygon.count());
             const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline);
 
-            for( sal_uInt32 nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
+            for(auto const& rPolygon : aB2DPolyPolygon)
             {
-                const basegfx::B2DPolygon aOnePoly(aB2DPolyPolygon.getB2DPolygon(nPolyIdx));
-
                 mpGraphics->DrawPolyLine(
                     aFullTransform,
-                    aOnePoly,
+                    rPolygon,
                     fTransparency,
                     aHairlineWidth,
                     basegfx::B2DLineJoin::NONE,
@@ -394,16 +391,13 @@ bool OutputDevice::DrawTransparentNatively ( const tools::PolyPolygon& rPolyPoly
 
             // draw the border line
             const basegfx::B2DVector aLineWidths( 1, 1 );
-            const sal_uInt32 nPolyCount(aB2DPolyPolygon.count());
             const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline);
 
-            for( sal_uInt32 nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
+            for(auto const& rPolygon : aB2DPolyPolygon)
             {
-                const basegfx::B2DPolygon aPolygon(aB2DPolyPolygon.getB2DPolygon(nPolyIdx));
-
                 bDrawn = mpGraphics->DrawPolyLine(
                     aTransform,
-                    aPolygon,
+                    rPolygon,
                     fTransparency,
                     aLineWidths,
                     basegfx::B2DLineJoin::NONE,
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 271ecc937850..0de4d5b0e129 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -587,9 +587,7 @@ bool X11SalGraphics::drawPolyPolygon(
         return true;
     }
 
-    const sal_uInt32 nPolyCount(rPolyPolygon.count());
-
-    if(nPolyCount <= 0)
+    if(rPolyPolygon.count() == 0)
     {
         return true;
     }
@@ -620,14 +618,13 @@ bool X11SalGraphics::drawPolyPolygon(
         cairo_t* cr = getCairoContext();
         clipRegion(cr);
 
-        for(sal_uInt32 a(0); a < nPolyCount; ++a)
+        for(auto const& rPolygon : aPolyPolygon)
         {
-            const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(a));
-            const sal_uInt32 nPointCount(aPolygon.count());
+            const sal_uInt32 nPointCount(rPolygon.count());
 
             if(nPointCount)
             {
-                const sal_uInt32 nEdgeCount(aPolygon.isClosed() ? nPointCount : nPointCount - 1);
+                const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nPointCount : nPointCount - 1);
 
                 if(nEdgeCount)
                 {
@@ -635,7 +632,7 @@ bool X11SalGraphics::drawPolyPolygon(
 
                     for(sal_uInt32 b = 0; b < nEdgeCount; ++b)
                     {
-                        aPolygon.getBezierSegment(b, aEdge);
+                        rPolygon.getBezierSegment(b, aEdge);
 
                         if(!b)
                         {
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index d11fb692dcd2..3962c4d4a52d 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1085,9 +1085,9 @@ static bool containsOnlyHorizontalAndVerticalEdges(const basegfx::B2DPolyPolygon
         return false;
     }
 
-    for(sal_uInt32 a(0); a < rCandidate.count(); a++)
+    for(auto const& rPolygon : rCandidate)
     {
-        if(!containsOnlyHorizontalAndVerticalEdges(rCandidate.getB2DPolygon(a)))
+        if(!containsOnlyHorizontalAndVerticalEdges(rPolygon))
         {
             return false;
         }
@@ -1157,11 +1157,11 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
                 aExpand = basegfx::B2DHomMatrix(basegfx::utils::createSourceRangeTargetRangeTransform(aRangeS, aRangeT));
             }
 
-            for(sal_uInt32 a(0); a < nCount; a++)
+            for(auto const& rPolygon : aPolyPolygon)
             {
                 const basegfx::B2DPolygon aPoly(
                     basegfx::utils::adaptiveSubdivideByDistance(
-                        aPolyPolygon.getB2DPolygon(a),
+                        rPolygon,
                         1));
                 const sal_uInt32 nPoints(aPoly.count());
 


More information about the Libreoffice-commits mailing list