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

Unified Diff: src/gpu/SkGr.cpp

Issue 1313573005: Revert of Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (Closed) Base URL: https://skia.googlesource.com/skia.git@things
Patch Set: Created 5 years, 4 months 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/GrProcessor.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('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 4293194de3a49fae504616f8b98f40fd5d08765e..ca78ff14e144d1ba4bc0f86f61f7bc76b43dbb8d 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -851,13 +851,22 @@
GrColor paintColor = SkColor2GrColor(skPaint.getColor());
- const GrFragmentProcessor* fp = shader->asFragmentProcessor(context, viewM, NULL,
- skPaint.getFilterQuality(), grPaint->getProcessorDataManager());
- if (!fp) {
- return false;
- }
- grPaint->addColorFragmentProcessor(fp)->unref();
- constantColor = false;
+ // Start a new block here in order to preserve our context state after calling
+ // asFragmentProcessor(). Since these calls get passed back to the client, we don't really
+ // want them messing around with the context.
+ {
+ // Allow the shader to modify paintColor and also create an effect to be installed as
+ // the first color effect on the GrPaint.
+ GrFragmentProcessor* fp = nullptr;
+ if (!shader->asFragmentProcessor(context, skPaint, viewM, nullptr, &paintColor,
+ grPaint->getProcessorDataManager(), &fp)) {
+ return false;
+ }
+ if (fp) {
+ grPaint->addColorFragmentProcessor(fp)->unref();
+ constantColor = false;
+ }
+ }
// The grcolor is automatically set when calling asFragmentProcessor.
// If the shader can be seen as an effect it returns true and adds its effect to the grpaint.
« no previous file with comments | « src/gpu/GrProcessor.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698