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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 196473010: bitmapshader with A8 bitmap should be colorized by the paint's color (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 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
« include/core/SkShader.h ('K') | « src/core/SkBitmapProcShader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index ed80c505818d222feb5052a6cd0189865270255f..684e9b45579f06e97ec9c79c8a1582e9020b25d8 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -575,6 +575,13 @@ inline bool skPaint2GrPaintShader(SkGpuDevice* dev,
if (NULL != effect.get()) {
grPaint->addColorEffect(effect);
// Now setup the rest of the paint.
+ // If the shader's bitmap is kA8_Config, the paint's RGB is used, and
+ // modulated by the shader's alpha. Otherwise, the shader's RGB is used,
+ // modulated by the paint's alpha.
+ SkBitmap* bitmap = shader->getBitmap();
+ if (NULL != bitmap && SkBitmap::kA8_Config == bitmap->config()) {
+ return skPaint2GrPaintNoShader(dev, skPaint, false, true, grPaint);
+ }
return skPaint2GrPaintNoShader(dev, skPaint, true, false, grPaint);
} else {
// We still don't have SkColorShader::asNewEffect() implemented.
« include/core/SkShader.h ('K') | « src/core/SkBitmapProcShader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698