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

Side by Side Diff: src/core/SkShader.cpp

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 39
40 SkShader::SkShader(const SkMatrix* localMatrix) { 40 SkShader::SkShader(const SkMatrix* localMatrix) {
41 inc_shader_counter(); 41 inc_shader_counter();
42 if (localMatrix) { 42 if (localMatrix) {
43 fLocalMatrix = *localMatrix; 43 fLocalMatrix = *localMatrix;
44 } else { 44 } else {
45 fLocalMatrix.reset(); 45 fLocalMatrix.reset();
46 } 46 }
47 } 47 }
48 48
49 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
50 SkShader::SkShader(SkReadBuffer& buffer) : INHERITED(buffer) {
51 inc_shader_counter();
52 if (buffer.readBool()) {
53 buffer.readMatrix(&fLocalMatrix);
54 } else {
55 fLocalMatrix.reset();
56 }
57 }
58 #endif
59
49 SkShader::~SkShader() { 60 SkShader::~SkShader() {
50 dec_shader_counter(); 61 dec_shader_counter();
51 } 62 }
52 63
53 void SkShader::flatten(SkWriteBuffer& buffer) const { 64 void SkShader::flatten(SkWriteBuffer& buffer) const {
54 this->INHERITED::flatten(buffer); 65 this->INHERITED::flatten(buffer);
55 bool hasLocalM = !fLocalMatrix.isIdentity(); 66 bool hasLocalM = !fLocalMatrix.isIdentity();
56 buffer.writeBool(hasLocalM); 67 buffer.writeBool(hasLocalM);
57 if (hasLocalM) { 68 if (hasLocalM) {
58 buffer.writeMatrix(fLocalMatrix); 69 buffer.writeMatrix(fLocalMatrix);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 #include "SkUtils.h" 264 #include "SkUtils.h"
254 265
255 SkColorShader::SkColorShader(SkColor c) 266 SkColorShader::SkColorShader(SkColor c)
256 : fColor(c) { 267 : fColor(c) {
257 } 268 }
258 269
259 bool SkColorShader::isOpaque() const { 270 bool SkColorShader::isOpaque() const {
260 return SkColorGetA(fColor) == 255; 271 return SkColorGetA(fColor) == 255;
261 } 272 }
262 273
274 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
275 SkColorShader::SkColorShader(SkReadBuffer& b) : INHERITED(b) {
276 fColor = b.readColor();
277 }
278 #endif
279
263 SkFlattenable* SkColorShader::CreateProc(SkReadBuffer& buffer) { 280 SkFlattenable* SkColorShader::CreateProc(SkReadBuffer& buffer) {
264 return SkNEW_ARGS(SkColorShader, (buffer.readColor())); 281 return SkNEW_ARGS(SkColorShader, (buffer.readColor()));
265 } 282 }
266 283
267 void SkColorShader::flatten(SkWriteBuffer& buffer) const { 284 void SkColorShader::flatten(SkWriteBuffer& buffer) const {
268 buffer.writeColor(fColor); 285 buffer.writeColor(fColor);
269 } 286 }
270 287
271 uint32_t SkColorShader::ColorShaderContext::getFlags() const { 288 uint32_t SkColorShader::ColorShaderContext::getFlags() const {
272 return fFlags; 289 return fFlags;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 #include "SkEmptyShader.h" 402 #include "SkEmptyShader.h"
386 403
387 void SkEmptyShader::toString(SkString* str) const { 404 void SkEmptyShader::toString(SkString* str) const {
388 str->append("SkEmptyShader: ("); 405 str->append("SkEmptyShader: (");
389 406
390 this->INHERITED::toString(str); 407 this->INHERITED::toString(str);
391 408
392 str->append(")"); 409 str->append(")");
393 } 410 }
394 #endif 411 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698