refactor SkRasterPipelineBlitter
This refactors the factories so that the create-from-paint factory is a
front-patch to the create-from-shader-pipeline factory. Feature-wise,
we make the pre-baked shader pipeline responsible for modulating by
paint alpha; the factory only adds when creating from the paint.
We can fold the alpha into the colors in drawVertices, which makes it
run a bit faster, dropping the need for a scale_1_float runtime stage.
This causes a few invisible diffs on the "vertices" GM, but everything
else draws the same.
Change-Id: I3eeacc9aafbce2023ab18991bbb68c35645e9387
Reviewed-on: https://skia-review.googlesource.com/17395
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/src/core/SkCoreBlitters.h b/src/core/SkCoreBlitters.h
index 277c8e7..8dfeb74 100644
--- a/src/core/SkCoreBlitters.h
+++ b/src/core/SkCoreBlitters.h
@@ -202,12 +202,15 @@
SkArenaAlloc* allocator);
-// Returns nullptr if no SkRasterPipeline blitter can be constructed for this paint.
+// Neither of these ever returns nullptr, but this first factory may return a SkNullBlitter.
SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap&, const SkPaint&, const SkMatrix& ctm,
SkArenaAlloc*);
-SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap&, const SkPaint&, const SkMatrix& ctm,
+// Use this if you've pre-baked a shader pipeline, including modulating with paint alpha.
+// This factory never returns an SkNullBlitter.
+SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap&, const SkPaint&,
const SkRasterPipeline& shaderPipeline,
- bool shader_is_opaque, bool shader_wants_dither,
+ bool shader_is_opaque,
+ bool shader_wants_dither,
SkArenaAlloc*);
#endif