vcl/workben/vcldemo.cxx |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 49737dff4b7b46c44f8c8e1c4de0291309eef78e
Author:     Leonid Ryzhov <leoryz...@gmail.com>
AuthorDate: Thu Nov 17 22:34:51 2022 +0300
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Tue Nov 22 15:28:59 2022 +0100

    tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
    
    Change-Id: Iec561daa71b17cedf0ea4cd2b473df9591a7bf3b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142900
    Tested-by: Jenkins
    Reviewed-by: Hossein <hoss...@libreoffice.org>

diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index e6ef740dd6aa..4588b4e73a8e 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -300,10 +300,10 @@ public:
                     rDev.SetLineColor(COL_BLACK);
                     basegfx::B2DPolygon aPoly;
                     tools::Rectangle aSub(aRegions[i]);
-                    for (size_t j = 0; j < SAL_N_ELEMENTS(aPoints); j++)
+                    for (const auto& rPoint : aPoints)
                     {
-                        aPoly.append(basegfx::B2DPoint(aSub.Left() + 
aSub.GetWidth() * aPoints[j].nX,
-                                                       aSub.Top()  + 
aSub.GetHeight() * aPoints[j].nY));
+                        aPoly.append(basegfx::B2DPoint(aSub.Left() + 
aSub.GetWidth() * rPoint.nX,
+                                                       aSub.Top()  + 
aSub.GetHeight() * rPoint.nY));
                     }
                     rDev.DrawPolyLine(aPoly, aLineWidths[i], eJoins[i], 
eLineCaps[i]);
                 }
@@ -369,7 +369,7 @@ public:
                 {
                     for (int x = 0; x < 4; x++)
                     {
-                        assert(i < SAL_N_ELEMENTS(aRenderData));
+                        assert(i < std::size(aRenderData));
                         drawText(rDev, aSubRegions[i], aRenderData[i].mbClip,
                                  aRenderData[i].mbArabicText, 
aRenderData[i].mbRotate);
                         i++;
@@ -550,7 +550,7 @@ public:
             Point aPos(r.Left(), r.Top()+20);
 
             tools::Long nMaxTextHeight = 0;
-            for (size_t i = 0; i < SAL_N_ELEMENTS(aRuns); ++i)
+            for (size_t i = 0; i < std::size(aRuns); ++i)
             {
                 // Legend
                 vcl::Font aIndexFont("sans", Size(0,20));
@@ -573,7 +573,7 @@ public:
                                     aRuns[i].mpFont),
                                 Size(0,42));
                 aFont.SetColor(COL_BLACK);
-                for (size_t j = 0; j < SAL_N_ELEMENTS(aWeights); ++j)
+                for (size_t j = 0; j < std::size(aWeights); ++j)
                 {
                     aFont.SetItalic(aItalics[j]);
                     aFont.SetWeight(aWeights[j]);
@@ -867,9 +867,9 @@ public:
             tools::Long aSizes[] = { 200, 100, 200, 100, 50, 5, 2 };
 
             // and yes - we really do this in the page border rendering code 
...
-            for (size_t i = 0; i < SAL_N_ELEMENTS(aSizes); i++)
+            for (const auto& rSize : aSizes)
             {
-                
aShadowStretch.Scale(Size(aShadowStretch.GetSizePixel().Width(), aSizes[i]),
+                
aShadowStretch.Scale(Size(aShadowStretch.GetSizePixel().Width(), rSize),
                                      BmpScaleFlag::Fast);
 
                 rDev.DrawBitmapEx(aRenderPt, aShadowStretch);
@@ -947,8 +947,8 @@ public:
                     tools::Rectangle aSubRect(r);
                     aSubRect.Move(x * r.GetWidth()/3, y * r.GetHeight()/3);
                     aSubRect.SetSize(Size(r.GetWidth()/2, r.GetHeight()/4));
-                    tools::Polygon aPoly(SAL_N_ELEMENTS(aPoints));
-                    for (size_t v = 0; v < SAL_N_ELEMENTS(aPoints); v++)
+                    tools::Polygon aPoly(std::size(aPoints));
+                    for (size_t v = 0; v < std::size(aPoints); v++)
                     {
                         aPoly.SetPoint(Point(aSubRect.Left() +
                                              aSubRect.GetWidth() * 
aPoints[v].nX,

Reply via email to