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

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

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « src/core/SkLocalMatrixImageFilter.cpp ('k') | src/core/SkMatrixImageFilter.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 2014 Google Inc. 2 * Copyright 2014 Google Inc.
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 "SkLocalMatrixShader.h" 8 #include "SkLocalMatrixShader.h"
9 9
10 SkFlattenable* SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) { 10 sk_sp<SkFlattenable> SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) {
11 SkMatrix lm; 11 SkMatrix lm;
12 buffer.readMatrix(&lm); 12 buffer.readMatrix(&lm);
13 auto baseShader(buffer.readShader()); 13 auto baseShader(buffer.readShader());
14 if (!baseShader) { 14 if (!baseShader) {
15 return nullptr; 15 return nullptr;
16 } 16 }
17 return baseShader->makeWithLocalMatrix(lm).release(); 17 return baseShader->makeWithLocalMatrix(lm);
18 } 18 }
19 19
20 void SkLocalMatrixShader::flatten(SkWriteBuffer& buffer) const { 20 void SkLocalMatrixShader::flatten(SkWriteBuffer& buffer) const {
21 buffer.writeMatrix(this->getLocalMatrix()); 21 buffer.writeMatrix(this->getLocalMatrix());
22 buffer.writeFlattenable(fProxyShader.get()); 22 buffer.writeFlattenable(fProxyShader.get());
23 } 23 }
24 24
25 SkShader::Context* SkLocalMatrixShader::onCreateContext(const ContextRec& rec, 25 SkShader::Context* SkLocalMatrixShader::onCreateContext(const ContextRec& rec,
26 void* storage) const { 26 void* storage) const {
27 ContextRec newRec(rec); 27 ContextRec newRec(rec);
(...skipping 30 matching lines...) Expand all
58 SkMatrix otherLocalMatrix; 58 SkMatrix otherLocalMatrix;
59 SkAutoTUnref<SkShader> proxy(this->refAsALocalMatrixShader(&otherLocalMatrix )); 59 SkAutoTUnref<SkShader> proxy(this->refAsALocalMatrixShader(&otherLocalMatrix ));
60 if (proxy) { 60 if (proxy) {
61 otherLocalMatrix.preConcat(localMatrix); 61 otherLocalMatrix.preConcat(localMatrix);
62 lm = &otherLocalMatrix; 62 lm = &otherLocalMatrix;
63 baseShader = proxy.get(); 63 baseShader = proxy.get();
64 } 64 }
65 65
66 return sk_make_sp<SkLocalMatrixShader>(baseShader, *lm); 66 return sk_make_sp<SkLocalMatrixShader>(baseShader, *lm);
67 } 67 }
OLDNEW
« no previous file with comments | « src/core/SkLocalMatrixImageFilter.cpp ('k') | src/core/SkMatrixImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698