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); |