Index: src/gpu/SkGr.cpp |
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp |
index 540edb6a38e728c6a5e1f018a2dc3840fda965a8..0669b96fccc719669c026a8807016e901877615a 100644 |
--- a/src/gpu/SkGr.cpp |
+++ b/src/gpu/SkGr.cpp |
@@ -597,6 +597,35 @@ bool SkPaintToGrPaintWithXfermode(GrContext* context, |
} |
+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); |
+} |
+ |
+ |
//////////////////////////////////////////////////////////////////////////////////////////////// |
SkImageInfo GrMakeInfoFromTexture(GrTexture* tex, int w, int h, bool isOpaque) { |