common: shape's composition fixed

In the case of a gradient stroke and a valid
fill, the composition wasn't applied correctly,
resulting in an unexpected overlap between
the fill and stroke.

@Issue: https://github.com/thorvg/thorvg/issues/445
This commit is contained in:
Mira Grudzinska 2023-08-20 09:18:47 +02:00 committed by Hermet Park
parent 70fff186b2
commit c2ca01a5c5

View file

@ -70,7 +70,7 @@ struct Shape::Impl
if (opacity == 0) return false;
//Shape composition is only necessary when stroking & fill are valid.
if (!rs.stroke || rs.stroke->width < FLT_EPSILON || rs.stroke->color[3] == 0) return false;
if (!rs.stroke || rs.stroke->width < FLT_EPSILON || (!rs.stroke->fill && rs.stroke->color[3] == 0)) return false;
if (!rs.fill && rs.color[3] == 0) return false;
//translucent fill & stroke