summaryrefslogtreecommitdiff
path: root/svgio/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-04-11 12:54:35 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2024-04-11 16:22:21 +0200
commit2cb757db3409cef9e0568ffa6409da7522fd702e (patch)
tree299fd76a4782d399a80db6cd7a5ecc062222f2bb /svgio/source
parent969ddf72824942be9755a8d14482d6549a2231ce (diff)
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.kaganski@collabora.com>
Diffstat (limited to 'svgio/source')
-rw-r--r--svgio/source/svgreader/svgsvgnode.cxx23
1 files changed, 11 insertions, 12 deletions
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);