| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkBitmapProcShader.h" | 8 #include "SkBitmapProcShader.h" |
| 9 #include "SkColorShader.h" | 9 #include "SkColorShader.h" |
| 10 #include "SkEmptyShader.h" | 10 #include "SkEmptyShader.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 SkColorShader::SkColorShader(SkColor c) | 266 SkColorShader::SkColorShader(SkColor c) |
| 267 : fColor(c) { | 267 : fColor(c) { |
| 268 } | 268 } |
| 269 | 269 |
| 270 bool SkColorShader::isOpaque() const { | 270 bool SkColorShader::isOpaque() const { |
| 271 return SkColorGetA(fColor) == 255; | 271 return SkColorGetA(fColor) == 255; |
| 272 } | 272 } |
| 273 | 273 |
| 274 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | 274 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 275 SkColorShader::SkColorShader(SkReadBuffer& b) : INHERITED(b) { | 275 SkColorShader::SkColorShader(SkReadBuffer& b) : INHERITED(b) { |
| 276 // V25_COMPATIBILITY_CODE We had a boolean to make the color shader inherit
the paint's | |
| 277 // color. We don't support that any more. | |
| 278 if (b.isVersionLT(SkReadBuffer::kColorShaderNoBool_Version)) { | |
| 279 if (b.readBool()) { | |
| 280 SkDEBUGFAIL("We shouldn't have pictures that recorded the inherited
case."); | |
| 281 fColor = SK_ColorWHITE; | |
| 282 return; | |
| 283 } | |
| 284 } | |
| 285 fColor = b.readColor(); | 276 fColor = b.readColor(); |
| 286 } | 277 } |
| 287 #endif | 278 #endif |
| 288 | 279 |
| 289 SkFlattenable* SkColorShader::CreateProc(SkReadBuffer& buffer) { | 280 SkFlattenable* SkColorShader::CreateProc(SkReadBuffer& buffer) { |
| 290 return SkNEW_ARGS(SkColorShader, (buffer.readColor())); | 281 return SkNEW_ARGS(SkColorShader, (buffer.readColor())); |
| 291 } | 282 } |
| 292 | 283 |
| 293 void SkColorShader::flatten(SkWriteBuffer& buffer) const { | 284 void SkColorShader::flatten(SkWriteBuffer& buffer) const { |
| 294 buffer.writeColor(fColor); | 285 buffer.writeColor(fColor); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 #include "SkEmptyShader.h" | 402 #include "SkEmptyShader.h" |
| 412 | 403 |
| 413 void SkEmptyShader::toString(SkString* str) const { | 404 void SkEmptyShader::toString(SkString* str) const { |
| 414 str->append("SkEmptyShader: ("); | 405 str->append("SkEmptyShader: ("); |
| 415 | 406 |
| 416 this->INHERITED::toString(str); | 407 this->INHERITED::toString(str); |
| 417 | 408 |
| 418 str->append(")"); | 409 str->append(")"); |
| 419 } | 410 } |
| 420 #endif | 411 #endif |
| OLD | NEW |