| 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.
|
|
|