svgio/source/svgreader/svgsvgnode.cxx |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

New commits:
commit 2cb757db3409cef9e0568ffa6409da7522fd702e
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Apr 11 12:54:35 2024 +0100
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Apr 11 16:22:21 2024 +0200

    Move variables into their usage scope
    
    Change-Id: I9b04a3b62fed65139a4b48629e9b442ba163a3d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165931
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/svgio/source/svgreader/svgsvgnode.cxx 
b/svgio/source/svgreader/svgsvgnode.cxx
index e3c52053a839..4dfa60271844 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -489,8 +489,6 @@ namespace svgio::svgreader
                     if(!bWidthInvalid && !bHeightInvalid)
                     {
                         basegfx::B2DRange aSvgCanvasRange; // viewport
-                        double fW = 0.0; // dummy values
-                        double fH = 0.0;
                         if (const basegfx::B2DRange* pBox = getViewBox())
                         {
                             // SVG 1.1 defines in section 7.7 that a negative 
value for width or height
@@ -508,20 +506,20 @@ namespace svgio::svgreader
                                 const double 
fViewBoxRatio(fViewBoxWidth/fViewBoxHeight);
                                 if(bWidthIsAbsolute && bHeightIsAbsolute)
                                 {
-                                    fW = getWidth().solveNonPercentage(*this);
-                                    fH = getHeight().solveNonPercentage(*this);
+                                    double fW = 
getWidth().solveNonPercentage(*this);
+                                    double fH = 
getHeight().solveNonPercentage(*this);
                                     aSvgCanvasRange = basegfx::B2DRange(0.0, 
0.0, fW, fH);
                                 }
                                 else if (bWidthIsAbsolute)
                                 {
-                                    fW = getWidth().solveNonPercentage(*this);
-                                    fH = fW / fViewBoxRatio ;
+                                    double fW = 
getWidth().solveNonPercentage(*this);
+                                    double fH = fW / fViewBoxRatio;
                                     aSvgCanvasRange = basegfx::B2DRange(0.0, 
0.0, fW, fH);
                                 }
                                 else if (bHeightIsAbsolute)
                                 {
-                                    fH = getHeight().solveNonPercentage(*this);
-                                    fW = fH * fViewBoxRatio ;
+                                    double fH = 
getHeight().solveNonPercentage(*this);
+                                    double fW = fH * fViewBoxRatio;
                                     aSvgCanvasRange = basegfx::B2DRange(0.0, 
0.0, fW, fH);
                                 }
                                 else
@@ -536,6 +534,7 @@ namespace svgio::svgreader
                                     const double 
fChildHeight(pBox->getHeight());
                                     const double fLeft(pBox->getMinX());
                                     const double fTop(pBox->getMinY());
+                                    double fW, fH;
                                     if ( fChildWidth / fViewBoxWidth > 
fChildHeight / fViewBoxHeight )
                                     {  // expand y
                                         fW = fChildWidth;
@@ -577,8 +576,8 @@ namespace svgio::svgreader
                             const bool bHeightIsAbsolute(getHeight().isSet() 
&& SvgUnit::percent != getHeight().getUnit());
                             if (bWidthIsAbsolute && bHeightIsAbsolute)
                             {
-                                fW =getWidth().solveNonPercentage(*this);
-                                fH =getHeight().solveNonPercentage(*this);
+                                double fW = 
getWidth().solveNonPercentage(*this);
+                                double fH = 
getHeight().solveNonPercentage(*this);
                                 aSvgCanvasRange = basegfx::B2DRange(0.0, 0.0, 
fW, fH);
                             }
                             else
@@ -592,8 +591,8 @@ namespace svgio::svgreader
                                 const double 
fChildHeight(aChildRange.getHeight());
                                 const double fChildLeft(aChildRange.getMinX());
                                 const double fChildTop(aChildRange.getMinY());
-                                fW = bWidthIsAbsolute ? 
getWidth().solveNonPercentage(*this) : fChildWidth;
-                                fH = bHeightIsAbsolute ? 
getHeight().solveNonPercentage(*this) : fChildHeight;
+                                double fW = bWidthIsAbsolute ? 
getWidth().solveNonPercentage(*this) : fChildWidth;
+                                double fH = bHeightIsAbsolute ? 
getHeight().solveNonPercentage(*this) : fChildHeight;
                                 const double fLeft(bWidthIsAbsolute ? 0.0 : 
fChildLeft);
                                 const double fTop(bHeightIsAbsolute ? 0.0 : 
fChildTop);
                                 aSvgCanvasRange = basegfx::B2DRange(fLeft, 
fTop, fLeft+fW, fTop+fH);

Reply via email to