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

Unified Diff: src/core/SkShader.cpp

Issue 248033003: Remove support for inheriting the paint color from SkColorShader (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove now unused member var Created 6 years, 8 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/SkShader.cpp
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index e337b7d9063eda8003e8bc00317dd9041fa92bb0..0ab0029df4dbad99ddacd3b5bc6ede623095a502 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -199,42 +199,33 @@ void SkShader::toString(SkString* str) const {
#include "SkColorShader.h"
#include "SkUtils.h"
-SkColorShader::SkColorShader() {
- fFlags = 0;
- fInheritColor = true;
-}
-
SkColorShader::SkColorShader(SkColor c) {
fFlags = 0;
fColor = c;
- fInheritColor = false;
}
SkColorShader::~SkColorShader() {}
bool SkColorShader::isOpaque() const {
- if (fInheritColor) {
- return true; // using paint's alpha
- }
return SkColorGetA(fColor) == 255;
}
SkColorShader::SkColorShader(SkReadBuffer& b) : INHERITED(b) {
fFlags = 0; // computed in setContext
- fInheritColor = b.readBool();
- if (fInheritColor) {
- return;
+ // An older version had a boolean to make the color shader inherit the paint's color. We don't
mtklein 2014/04/22 21:49:07 Can you add // V25_COMPATIBILITY_CODE here to make
+ // support that any more.
+ if (b.pictureVersion() < 26 && 0 != b.pictureVersion()) {
+ if (b.readBool()) {
mtklein 2014/04/22 21:49:07 Replace with SkAssertResult(!b.readBool())?
bsalomon 2014/04/23 15:22:29 I added an SkDebugFail just after sending out the
+ fColor = SK_ColorWHITE;
+ return;
+ }
}
fColor = b.readColor();
}
void SkColorShader::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
- buffer.writeBool(fInheritColor);
- if (fInheritColor) {
- return;
- }
buffer.writeColor(fColor);
}
@@ -254,12 +245,7 @@ bool SkColorShader::setContext(const SkBitmap& device, const SkPaint& paint,
unsigned a;
- if (fInheritColor) {
- fColor = paint.getColor();
- a = SkColorGetA(fColor);
- } else {
- a = SkAlphaMul(SkColorGetA(fColor), SkAlpha255To256(paint.getAlpha()));
- }
+ a = SkAlphaMul(SkColorGetA(fColor), SkAlpha255To256(paint.getAlpha()));
unsigned r = SkColorGetR(fColor);
unsigned g = SkColorGetG(fColor);
@@ -319,12 +305,8 @@ SkShader::GradientType SkColorShader::asAGradient(GradientInfo* info) const {
void SkColorShader::toString(SkString* str) const {
str->append("SkColorShader: (");
- if (fInheritColor) {
- str->append("Color: inherited from paint");
- } else {
- str->append("Color: ");
- str->appendHex(fColor);
- }
+ str->append("Color: ");
+ str->appendHex(fColor);
this->INHERITED::toString(str);

Powered by Google App Engine
This is Rietveld 408576698