Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: src/gpu/SkGr.cpp

Issue 1454933002: Initial implementation of GPU no filter NinePatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/SkGpuDevice_drawTexture.cpp ('k') | src/gpu/SkGrPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
+
////////////////////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/SkGpuDevice_drawTexture.cpp ('k') | src/gpu/SkGrPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698