@@ -293,19 +293,19 @@ static inline bool skpaint_to_grpaint_impl(GrRecordingContext* context,
293293 shaderFP = GrXfermodeFragmentProcessor::MakeFromSrcProcessor (std::move (shaderFP),
294294 *primColorMode);
295295
296- // The above may return null if compose results in a pass through of the prim color.
297- if (shaderFP) {
298- grPaint->addColorFragmentProcessor (std::move (shaderFP));
299- }
300-
301296 // We can ignore origColor here - alpha is unchanged by gamma
302297 float paintAlpha = skPaint.getColor4f ().fA ;
303298 if (1 .0f != paintAlpha) {
304299 // No gamut conversion - paintAlpha is a (linear) alpha value, splatted to all
305300 // color channels. It's value should be treated as the same in ANY color space.
306- grPaint->addColorFragmentProcessor (GrConstColorProcessor::Make (
307- { paintAlpha, paintAlpha, paintAlpha, paintAlpha },
308- GrConstColorProcessor::InputMode::kModulateRGBA ));
301+ shaderFP = GrConstColorProcessor::Make (
302+ std::move (shaderFP), { paintAlpha, paintAlpha, paintAlpha, paintAlpha },
303+ GrConstColorProcessor::InputMode::kModulateRGBA );
304+ }
305+
306+ // The above may return null if compose results in a pass through of the prim color.
307+ if (shaderFP) {
308+ grPaint->addColorFragmentProcessor (std::move (shaderFP));
309309 }
310310 } else {
311311 // The shader's FP sees the paint *unpremul* color
@@ -318,24 +318,24 @@ static inline bool skpaint_to_grpaint_impl(GrRecordingContext* context,
318318 // There is a blend between the primitive color and the paint color. The blend considers
319319 // the opaque paint color. The paint's alpha is applied to the post-blended color.
320320 SkPMColor4f opaqueColor = origColor.makeOpaque ().premul ();
321- auto processor = GrConstColorProcessor::Make (opaqueColor,
321+ auto processor = GrConstColorProcessor::Make (/* inputFP= */ nullptr , opaqueColor,
322322 GrConstColorProcessor::InputMode::kIgnore );
323323 processor = GrXfermodeFragmentProcessor::MakeFromSrcProcessor (std::move (processor),
324324 *primColorMode);
325- if (processor) {
326- grPaint->addColorFragmentProcessor (std::move (processor));
327- }
328-
329325 grPaint->setColor4f (opaqueColor);
330326
331327 // We can ignore origColor here - alpha is unchanged by gamma
332328 float paintAlpha = skPaint.getColor4f ().fA ;
333329 if (1 .0f != paintAlpha) {
334330 // No gamut conversion - paintAlpha is a (linear) alpha value, splatted to all
335331 // color channels. It's value should be treated as the same in ANY color space.
336- grPaint->addColorFragmentProcessor (GrConstColorProcessor::Make (
337- { paintAlpha, paintAlpha, paintAlpha, paintAlpha },
338- GrConstColorProcessor::InputMode::kModulateRGBA ));
332+ processor = GrConstColorProcessor::Make (
333+ std::move (processor), { paintAlpha, paintAlpha, paintAlpha, paintAlpha },
334+ GrConstColorProcessor::InputMode::kModulateRGBA );
335+ }
336+
337+ if (processor) {
338+ grPaint->addColorFragmentProcessor (std::move (processor));
339339 }
340340 } else {
341341 // No shader, no primitive color.
0 commit comments