OLD | NEW |
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 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | 10 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 fProxyShader->toString(str); | 54 fProxyShader->toString(str); |
55 | 55 |
56 this->INHERITED::toString(str); | 56 this->INHERITED::toString(str); |
57 | 57 |
58 str->append(")"); | 58 str->append(")"); |
59 } | 59 } |
60 #endif | 60 #endif |
61 | 61 |
62 SkShader* SkShader::CreateLocalMatrixShader(SkShader* proxy, const SkMatrix& loc
alMatrix) { | 62 SkShader* SkShader::CreateLocalMatrixShader(SkShader* proxy, const SkMatrix& loc
alMatrix) { |
| 63 if (NULL == proxy) { |
| 64 return NULL; |
| 65 } |
| 66 |
63 if (localMatrix.isIdentity()) { | 67 if (localMatrix.isIdentity()) { |
64 return SkRef(proxy); | 68 return SkRef(proxy); |
65 } | 69 } |
66 | 70 |
67 const SkMatrix* lm = &localMatrix; | 71 const SkMatrix* lm = &localMatrix; |
68 | 72 |
69 SkMatrix otherLocalMatrix; | 73 SkMatrix otherLocalMatrix; |
70 SkAutoTUnref<SkShader> otherProxy(proxy->refAsALocalMatrixShader(&otherLocal
Matrix)); | 74 SkAutoTUnref<SkShader> otherProxy(proxy->refAsALocalMatrixShader(&otherLocal
Matrix)); |
71 if (otherProxy.get()) { | 75 if (otherProxy.get()) { |
72 otherLocalMatrix.preConcat(localMatrix); | 76 otherLocalMatrix.preConcat(localMatrix); |
73 lm = &otherLocalMatrix; | 77 lm = &otherLocalMatrix; |
74 proxy = otherProxy.get(); | 78 proxy = otherProxy.get(); |
75 } | 79 } |
76 | 80 |
77 return SkNEW_ARGS(SkLocalMatrixShader, (proxy, *lm)); | 81 return SkNEW_ARGS(SkLocalMatrixShader, (proxy, *lm)); |
78 } | 82 } |
OLD | NEW |