sw_engine: fix aa

For shapes with a stroke that has opacity, anti-aliasing
should be applied to a fill.
The use of a transparent gradient stroke will also be handled
correctly.
This commit is contained in:
Mira Grudzinska 2024-07-02 16:30:45 +02:00 committed by Hermet Park
parent e4c4a95495
commit 57cdff0d9e
2 changed files with 2 additions and 1 deletions

View file

@ -86,7 +86,7 @@ struct SwShapeTask : SwTask
Additionally, the stroke style should not be dashed. */ Additionally, the stroke style should not be dashed. */
bool antialiasing(float strokeWidth) bool antialiasing(float strokeWidth)
{ {
return strokeWidth < 2.0f || rshape->stroke->dashCnt > 0 || rshape->stroke->strokeFirst || rshape->strokeTrim(); return strokeWidth < 2.0f || rshape->stroke->dashCnt > 0 || rshape->stroke->strokeFirst || rshape->strokeTrim() || rshape->stroke->color[3] < 255;;
} }
float validStrokeWidth() float validStrokeWidth()

View file

@ -296,6 +296,7 @@ struct Shape::Impl
if (!rs.stroke) rs.stroke = new RenderStroke(); if (!rs.stroke) rs.stroke = new RenderStroke();
if (rs.stroke->fill && rs.stroke->fill != p) delete(rs.stroke->fill); if (rs.stroke->fill && rs.stroke->fill != p) delete(rs.stroke->fill);
rs.stroke->fill = p; rs.stroke->fill = p;
rs.stroke->color[3] = 0;
flag |= RenderUpdateFlag::Stroke; flag |= RenderUpdateFlag::Stroke;
flag |= RenderUpdateFlag::GradientStroke; flag |= RenderUpdateFlag::GradientStroke;