tvg_saver: fixing unwanted merging

Similar shapes are merged to improve
performance. This should not be the case
with a semi-transparent fill, different
shapes' fill-rule or fill-rule set to evenodd.

@Issue: https://github.com/thorvg/thorvg/issues/1440
This commit is contained in:
Mira Grudzinska 2023-05-10 17:47:00 +02:00 committed by Hermet Park
parent 6d16713ce9
commit 77114a8ac8

View file

@ -75,7 +75,10 @@ static bool _merge(Shape* from, Shape* to)
from->fillColor(&r, &g, &b, &a);
to->fillColor(&r2, &g2, &b2, &a2);
if (r != r2 || g != g2 || b != b2 || a != a2) return false;
if (r != r2 || g != g2 || b != b2 || a != a2 || a < 255) return false;
auto fromRule = from->fillRule();
if (fromRule == FillRule::EvenOdd || fromRule != to->fillRule()) return false;
//composition
if (from->composite(nullptr) != CompositeMethod::None) return false;