Commit 00f50c95 authored by Craig Watson's avatar Craig Watson

Fix saving and loading of polygons' fill rule

This fixes a bug introduced in commit 8365f2f7 and improves the previous,
suboptimal behaviour. Now, polygon fill rules should be saved and loaded
correctly; and the changes should be reverse compatible (so that files
created with an older version will be loaded correctly as well).
parent b2f7c0c4
...@@ -1752,25 +1752,15 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol ...@@ -1752,25 +1752,15 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
polygonItem->setColorOnLightBackground(color); polygonItem->setColorOnLightBackground(color);
} }
/* // Before OpenBoard v1.4, fill rule was only saved if it was "Even-odd". Therefore if no fill rule
// is specified, we assume that it should be Winding fill.
Unfortunately the fill rule was never saved correctly until OpenBoard v1.4,
before then, it was always saved as even-odd. So we can't load it safely here.
Saving is now fixed, but any old documents would be loaded incorrectly if the code
below is used. It should be activated at some point in the future though.
QStringRef fillRule = mXmlReader.attributes().value("fill-rule"); QStringRef fillRule = mXmlReader.attributes().value("fill-rule");
if (!fillRule.isNull()) { if (!fillRule.isNull() && fillRule.toString() == "evenodd")
QString value = fillRule.toString();
if (value == "evenodd")
polygonItem->setFillRule(Qt::OddEvenFill); polygonItem->setFillRule(Qt::OddEvenFill);
else else
polygonItem->setFillRule(Qt::WindingFill); polygonItem->setFillRule(Qt::WindingFill);
}
*/
polygonItem->setFillRule(Qt::WindingFill);
return polygonItem; return polygonItem;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment