mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed some SVG parsing bugs
This commit is contained in:
parent
1b001e7a76
commit
d498575976
1 changed files with 23 additions and 6 deletions
|
|
@ -365,18 +365,19 @@ public:
|
|||
if (parseCoordsOrSkip (d, p1, false))
|
||||
{
|
||||
String num;
|
||||
bool flagValue = false;
|
||||
|
||||
if (parseNextNumber (d, num, false))
|
||||
{
|
||||
const float angle = degreesToRadians (num.getFloatValue());
|
||||
auto angle = degreesToRadians (num.getFloatValue());
|
||||
|
||||
if (parseNextNumber (d, num, false))
|
||||
if (parseNextFlag (d, flagValue))
|
||||
{
|
||||
const bool largeArc = num.getIntValue() != 0;
|
||||
auto largeArc = flagValue;
|
||||
|
||||
if (parseNextNumber (d, num, false))
|
||||
if (parseNextFlag (d, flagValue))
|
||||
{
|
||||
const bool sweep = num.getIntValue() != 0;
|
||||
auto sweep = flagValue;
|
||||
|
||||
if (parseCoordsOrSkip (d, p2, false))
|
||||
{
|
||||
|
|
@ -1064,7 +1065,7 @@ private:
|
|||
if (xml->hasTagName ("use"))
|
||||
return useText (xml);
|
||||
|
||||
if (! xml->hasTagName ("text"))
|
||||
if (! xml->hasTagName ("text") && ! xml->hasTagNameIgnoringNamespace ("tspan"))
|
||||
return nullptr;
|
||||
|
||||
Array<float> xCoords, yCoords, dxCoords, dyCoords;
|
||||
|
|
@ -1501,6 +1502,22 @@ private:
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool parseNextFlag (String::CharPointerType& text, bool& value)
|
||||
{
|
||||
while (text.isWhitespace() || *text == ',')
|
||||
++text;
|
||||
|
||||
if (*text != '0' && *text != '1')
|
||||
return false;
|
||||
|
||||
value = *(text++) != '0';
|
||||
|
||||
while (text.isWhitespace() || *text == ',')
|
||||
++text;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Colour parseColour (const XmlPath& xml, StringRef attributeName, const Colour defaultColour) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue