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

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

Issue 1772463002: use Make instead of Create to return a shared shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: partial update of skia call-sites Created 4 years, 9 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 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 SkFlattenable* SkLocalMatrixShader::CreateProc(SkReadBuffer& buffer) {
11 SkMatrix lm; 11 SkMatrix lm;
12 buffer.readMatrix(&lm); 12 buffer.readMatrix(&lm);
13 SkAutoTUnref<SkShader> 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->newWithLocalMatrix(lm); 17 return baseShader->newWithLocalMatrix(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 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 new SkLocalMatrixShader(baseShader, *lm); 66 return new SkLocalMatrixShader(baseShader, *lm);
67 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698