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

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

Issue 1911963008: DNC - JSON of flattenables, with field names. Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add names to call sites Created 4 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 unified diff | Download patch
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 "SkAtomics.h" 8 #include "SkAtomics.h"
9 #include "SkBitmapProcShader.h" 9 #include "SkBitmapProcShader.h"
10 #include "SkColorShader.h" 10 #include "SkColorShader.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 (void)fLocalMatrix.getType(); 48 (void)fLocalMatrix.getType();
49 } 49 }
50 50
51 SkShader::~SkShader() { 51 SkShader::~SkShader() {
52 dec_shader_counter(); 52 dec_shader_counter();
53 } 53 }
54 54
55 void SkShader::flatten(SkWriteBuffer& buffer) const { 55 void SkShader::flatten(SkWriteBuffer& buffer) const {
56 this->INHERITED::flatten(buffer); 56 this->INHERITED::flatten(buffer);
57 bool hasLocalM = !fLocalMatrix.isIdentity(); 57 bool hasLocalM = !fLocalMatrix.isIdentity();
58 buffer.writeBool(hasLocalM); 58 buffer.writeBool("hasLocalM", hasLocalM);
59 if (hasLocalM) { 59 if (hasLocalM) {
60 buffer.writeMatrix(fLocalMatrix); 60 buffer.writeMatrix("fLocalMatrix", fLocalMatrix);
61 } 61 }
62 } 62 }
63 63
64 bool SkShader::computeTotalInverse(const ContextRec& rec, SkMatrix* totalInverse ) const { 64 bool SkShader::computeTotalInverse(const ContextRec& rec, SkMatrix* totalInverse ) const {
65 SkMatrix total; 65 SkMatrix total;
66 total.setConcat(*rec.fMatrix, fLocalMatrix); 66 total.setConcat(*rec.fMatrix, fLocalMatrix);
67 67
68 const SkMatrix* m = &total; 68 const SkMatrix* m = &total;
69 if (rec.fLocalMatrix) { 69 if (rec.fLocalMatrix) {
70 total.setConcat(*m, *rec.fLocalMatrix); 70 total.setConcat(*m, *rec.fLocalMatrix);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 bool SkColorShader::isOpaque() const { 263 bool SkColorShader::isOpaque() const {
264 return SkColorGetA(fColor) == 255; 264 return SkColorGetA(fColor) == 255;
265 } 265 }
266 266
267 sk_sp<SkFlattenable> SkColorShader::CreateProc(SkReadBuffer& buffer) { 267 sk_sp<SkFlattenable> SkColorShader::CreateProc(SkReadBuffer& buffer) {
268 return sk_make_sp<SkColorShader>(buffer.readColor()); 268 return sk_make_sp<SkColorShader>(buffer.readColor());
269 } 269 }
270 270
271 void SkColorShader::flatten(SkWriteBuffer& buffer) const { 271 void SkColorShader::flatten(SkWriteBuffer& buffer) const {
272 buffer.writeColor(fColor); 272 buffer.writeColor("fColor", fColor);
273 } 273 }
274 274
275 uint32_t SkColorShader::ColorShaderContext::getFlags() const { 275 uint32_t SkColorShader::ColorShaderContext::getFlags() const {
276 return fFlags; 276 return fFlags;
277 } 277 }
278 278
279 SkShader::Context* SkColorShader::onCreateContext(const ContextRec& rec, void* s torage) const { 279 SkShader::Context* SkColorShader::onCreateContext(const ContextRec& rec, void* s torage) const {
280 return new (storage) ColorShaderContext(*this, rec); 280 return new (storage) ColorShaderContext(*this, rec);
281 } 281 }
282 282
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 453 }
454 #endif 454 #endif
455 455
456 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR 456 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR
457 #include "SkXfermode.h" 457 #include "SkXfermode.h"
458 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src, 458 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src,
459 SkXfermode* xfer) { 459 SkXfermode* xfer) {
460 return MakeComposeShader(std::move(dst), std::move(src), sk_ref_sp(xfer)); 460 return MakeComposeShader(std::move(dst), std::move(src), sk_ref_sp(xfer));
461 } 461 }
462 #endif 462 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698