summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorChr. Rossmanith <ChrRossmanith@gmx.de>2012-05-11 21:24:12 +0200
committerChr. Rossmanith <ChrRossmanith@gmx.de>2012-05-11 21:28:55 +0200
commit508fcf698ec7cd97af1eb8936ab30b257143bc1b (patch)
tree97882467de3a6b663a062b0c430d20ddac90c9ec /basegfx
parentb4d25b7be20a06297b5536c56b4214691e735444 (diff)
fdo#48070 fix parsing of arc paths
Change-Id: Iffd726eec08da453e5a72c512ef2df35f22b5573
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/polygon/b2dsvgpolypolygon.cxx35
1 files changed, 18 insertions, 17 deletions
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index e3e60cd22095..fc6e2ac62c25 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -143,35 +143,36 @@ namespace basegfx
return true;
}
- bool lcl_importNumberAndSpaces(sal_Int32& o_nRetval,
- sal_Int32& io_rPos,
- const ::rtl::OUString& rStr,
- const sal_Int32 nLen)
+ bool lcl_importFlagAndSpaces(sal_Int32& o_nRetval,
+ sal_Int32& io_rPos,
+ const ::rtl::OUString& rStr,
+ const sal_Int32 nLen)
{
sal_Unicode aChar( rStr[io_rPos] );
::rtl::OUStringBuffer sNumberString;
- if(sal_Unicode('+') == aChar || sal_Unicode('-') == aChar)
+ if(sal_Unicode('+') == aChar)
{
sNumberString.append(rStr[io_rPos]);
aChar = rStr[++io_rPos];
}
- while(sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
+ if(sal_Unicode('0') == aChar)
{
- sNumberString.append(rStr[io_rPos]);
- aChar = rStr[++io_rPos];
+ o_nRetval = 0;
+ ++io_rPos;
}
-
- if(sNumberString.getLength())
+ else if (sal_Unicode('1') == aChar)
{
- o_nRetval = sNumberString.makeStringAndClear().toInt32();
- lcl_skipSpacesAndCommas(io_rPos, rStr, nLen);
-
- return true;
+ o_nRetval = 1;
+ ++io_rPos;
}
+ else
+ return false;
- return false;
+ lcl_skipSpacesAndCommas(io_rPos, rStr, nLen);
+
+ return true;
}
void lcl_putNumberChar( ::rtl::OUStringBuffer& rStr,
@@ -621,8 +622,8 @@ namespace basegfx
if(!lcl_importDoubleAndSpaces(fRX, nPos, rSvgDStatement, nLen)) return false;
if(!lcl_importDoubleAndSpaces(fRY, nPos, rSvgDStatement, nLen)) return false;
if(!lcl_importDoubleAndSpaces(fPhi, nPos, rSvgDStatement, nLen)) return false;
- if(!lcl_importNumberAndSpaces(bLargeArcFlag, nPos, rSvgDStatement, nLen)) return false;
- if(!lcl_importNumberAndSpaces(bSweepFlag, nPos, rSvgDStatement, nLen)) return false;
+ if(!lcl_importFlagAndSpaces(bLargeArcFlag, nPos, rSvgDStatement, nLen)) return false;
+ if(!lcl_importFlagAndSpaces(bSweepFlag, nPos, rSvgDStatement, nLen)) return false;
if(!lcl_importDoubleAndSpaces(nX, nPos, rSvgDStatement, nLen)) return false;
if(!lcl_importDoubleAndSpaces(nY, nPos, rSvgDStatement, nLen)) return false;