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

Unified Diff: src/core/SkPaint.cpp

Issue 492963002: extend SkShader to report a luminance-color to be used for gamma correction (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase, add SkShader::CreateColorShader(c) Created 6 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
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 89a8cd0872658b2b5ba03b34c9d2c179f792977e..954680b8dcb8a5eed5fb1eabac8139a8b1b1d6d8 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1497,10 +1497,12 @@ static SkPaint::Hinting computeHinting(const SkPaint& paint) {
// return true if the paint is just a single color (i.e. not a shader). If its
// a shader, then we can't compute a const luminance for it :(
static bool justAColor(const SkPaint& paint, SkColor* color) {
- if (paint.getShader()) {
+ SkColor c = paint.getColor();
+
+ SkShader* shader = paint.getShader();
+ if (shader && !shader->asLuminanceColor(&c)) {
return false;
}
- SkColor c = paint.getColor();
if (paint.getColorFilter()) {
c = paint.getColorFilter()->filterColor(c);
}

Powered by Google App Engine
This is Rietveld 408576698