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

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

Issue 446013004: fix concat order for local matrices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | 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 SkLocalMatrixShader::SkLocalMatrixShader(SkReadBuffer& buffer) : INHERITED(buffe r) { 10 SkLocalMatrixShader::SkLocalMatrixShader(SkReadBuffer& buffer) : INHERITED(buffe r) {
11 if (buffer.isVersionLT(SkReadBuffer::kSimplifyLocalMatrix_Version)) { 11 if (buffer.isVersionLT(SkReadBuffer::kSimplifyLocalMatrix_Version)) {
12 buffer.readMatrix(&(INHERITED::fLocalMatrix)); 12 buffer.readMatrix(&(INHERITED::fLocalMatrix));
13 } 13 }
14 fProxyShader.reset(buffer.readShader()); 14 fProxyShader.reset(buffer.readShader());
15 if (NULL == fProxyShader.get()) { 15 if (NULL == fProxyShader.get()) {
16 sk_throw(); 16 sk_throw();
17 } 17 }
18 } 18 }
19 19
20 void SkLocalMatrixShader::flatten(SkWriteBuffer& buffer) const { 20 void SkLocalMatrixShader::flatten(SkWriteBuffer& buffer) const {
21 this->INHERITED::flatten(buffer); 21 this->INHERITED::flatten(buffer);
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);
28 SkMatrix tmp; 28 SkMatrix tmp;
29 if (rec.fLocalMatrix) { 29 if (rec.fLocalMatrix) {
30 tmp.setConcat(this->getLocalMatrix(), *rec.fLocalMatrix); 30 tmp.setConcat(*rec.fLocalMatrix, this->getLocalMatrix());
31 newRec.fLocalMatrix = &tmp; 31 newRec.fLocalMatrix = &tmp;
32 } else { 32 } else {
33 newRec.fLocalMatrix = &this->getLocalMatrix(); 33 newRec.fLocalMatrix = &this->getLocalMatrix();
34 } 34 }
35 return fProxyShader->createContext(newRec, storage); 35 return fProxyShader->createContext(newRec, storage);
36 } 36 }
37 37
38 #ifndef SK_IGNORE_TO_STRING 38 #ifndef SK_IGNORE_TO_STRING
39 void SkLocalMatrixShader::toString(SkString* str) const { 39 void SkLocalMatrixShader::toString(SkString* str) const {
40 str->append("SkLocalMatrixShader: ("); 40 str->append("SkLocalMatrixShader: (");
(...skipping 16 matching lines...) Expand all
57 SkMatrix otherLocalMatrix; 57 SkMatrix otherLocalMatrix;
58 SkAutoTUnref<SkShader> otherProxy(proxy->refAsALocalMatrixShader(&otherLocal Matrix)); 58 SkAutoTUnref<SkShader> otherProxy(proxy->refAsALocalMatrixShader(&otherLocal Matrix));
59 if (otherProxy.get()) { 59 if (otherProxy.get()) {
60 otherLocalMatrix.preConcat(localMatrix); 60 otherLocalMatrix.preConcat(localMatrix);
61 lm = &otherLocalMatrix; 61 lm = &otherLocalMatrix;
62 proxy = otherProxy.get(); 62 proxy = otherProxy.get();
63 } 63 }
64 64
65 return SkNEW_ARGS(SkLocalMatrixShader, (proxy, *lm)); 65 return SkNEW_ARGS(SkLocalMatrixShader, (proxy, *lm));
66 } 66 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698