Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit f69a9f2

Browse files
author
Ian Macphail
committed
[[ Bug 20469 ]] Don't apply color to SkPaint when using a gradient or pattern
The alpha value of the color is also used when drawing with a shader (i.e. gradient or pattern)
1 parent b4ad275 commit f69a9f2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libgraphics/src/context.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,8 +2064,11 @@ static bool MCGContextApplyPaintSettingsToSkPaint(MCGContextRef self, MCGColor p
20642064

20652065
if (t_success)
20662066
{
2067-
r_paint . setColor(MCGColorToSkColor(p_color));
2068-
r_paint . setShader(t_shader);
2067+
// Don't set the paint color if using a shader, as the color's alpha value will be applied to the paint (which we don't want to happen!).
2068+
if (t_shader != nil)
2069+
r_paint . setShader(t_shader);
2070+
else
2071+
r_paint . setColor(MCGColorToSkColor(p_color));
20692072
r_paint . setMaskFilter(t_stipple);
20702073

20712074
// MM-2014-01-09: [[ LibSkiaUpdate ]] Updated filters to use Skia's new filter levels.

0 commit comments

Comments
 (0)