Index: src/gpu/SkGr.cpp |
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp |
index affd6cd9593b53dbc2dbc9742a5f89032974df37..411b5b2b60322249213f83d322005d460f1202fa 100644 |
--- a/src/gpu/SkGr.cpp |
+++ b/src/gpu/SkGr.cpp |
@@ -545,6 +545,34 @@ bool SkPaintToGrPaintWithXfermode(GrContext* context, |
grPaint); |
} |
+bool SkPaintToGrPaintWithTexture(GrContext* context, |
+ const SkPaint& paint, |
+ const SkMatrix& viewM, |
+ const GrFragmentProcessor* fp, |
+ bool textureIsAlphaOnly, |
+ GrPaint* grPaint) { |
+ SkAutoTUnref<const GrFragmentProcessor> shaderFP; |
+ if (textureIsAlphaOnly) { |
+ if (const SkShader* shader = paint.getShader()) { |
+ shaderFP.reset(shader->asFragmentProcessor(context, |
+ viewM, |
+ nullptr, |
+ paint.getFilterQuality())); |
+ if (!shaderFP) { |
+ return false; |
+ } |
+ const GrFragmentProcessor* fpSeries[] = { shaderFP.get(), fp }; |
+ shaderFP.reset(GrFragmentProcessor::RunInSeries(fpSeries, 2)); |
+ } else { |
+ shaderFP.reset(GrFragmentProcessor::MulOutputByInputUnpremulColor(fp)); |
+ } |
+ } else { |
+ shaderFP.reset(GrFragmentProcessor::MulOutputByInputAlpha(fp)); |
+ } |
+ |
+ return SkPaintToGrPaintReplaceShader(context, paint, shaderFP.get(), grPaint); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////////////////////// |