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

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: fColor -> color 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
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | tests/ShaderOpacityTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkShader.cpp
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 40e52a05cbf59e217a644195fa7a957c5c543719..b49dae8b5d5769bf5bb745498c165861c22244cc 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -203,37 +203,29 @@ void SkShader::toString(SkString* str) const {
#include "SkColorShader.h"
#include "SkUtils.h"
-SkColorShader::SkColorShader()
- : fColor()
- , fInheritColor(true) {
-}
-
SkColorShader::SkColorShader(SkColor c)
- : fColor(c)
- , fInheritColor(false) {
+ : fColor(c) {
}
bool SkColorShader::isOpaque() const {
- if (fInheritColor) {
- return true; // using paint's alpha
- }
return SkColorGetA(fColor) == 255;
}
SkColorShader::SkColorShader(SkReadBuffer& b) : INHERITED(b) {
- fInheritColor = b.readBool();
- if (fInheritColor) {
- return;
+ // V25_COMPATIBILITY_CODE We had a boolean to make the color shader inherit the paint's
+ // color. We don't support that any more.
+ if (b.pictureVersion() < 26 && 0 != b.pictureVersion()) {
+ if (b.readBool()) {
+ SkDEBUGFAIL("We shouldn't have pictures that recorded the inherited case.");
+ 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);
}
@@ -260,16 +252,11 @@ SkColorShader::ColorShaderContext::ColorShaderContext(const SkColorShader& shade
const SkMatrix& matrix)
: INHERITED(shader, device, paint, matrix)
{
+ SkColor color;
unsigned a;
- SkColor color;
- if (shader.fInheritColor) {
- color = paint.getColor();
- a = SkColorGetA(color);
- } else {
- color = shader.fColor;
- a = SkAlphaMul(SkColorGetA(color), SkAlpha255To256(paint.getAlpha()));
- }
+ color = shader.fColor;
+ a = SkAlphaMul(SkColorGetA(color), SkAlpha255To256(paint.getAlpha()));
unsigned r = SkColorGetR(color);
unsigned g = SkColorGetG(color);
@@ -327,12 +314,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);
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | tests/ShaderOpacityTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698