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 (localMatrix.isIdentity()) { | 63 if (localMatrix.isIdentity() || !proxy) { |
sugoi1
2014/10/29 15:26:12
proxy may be NULL (see SkRectShaderImageFilter)
reed1
2014/10/29 15:43:38
Would this be even clearer as:
if (NULL == proxy)
sugoi1
2014/10/29 18:21:00
Done.
| |
64 return SkRef(proxy); | 64 return SkSafeRef(proxy); |
65 } | 65 } |
66 | 66 |
67 const SkMatrix* lm = &localMatrix; | 67 const SkMatrix* lm = &localMatrix; |
68 | 68 |
69 SkMatrix otherLocalMatrix; | 69 SkMatrix otherLocalMatrix; |
70 SkAutoTUnref<SkShader> otherProxy(proxy->refAsALocalMatrixShader(&otherLocal Matrix)); | 70 SkAutoTUnref<SkShader> otherProxy(proxy->refAsALocalMatrixShader(&otherLocal Matrix)); |
71 if (otherProxy.get()) { | 71 if (otherProxy.get()) { |
72 otherLocalMatrix.preConcat(localMatrix); | 72 otherLocalMatrix.preConcat(localMatrix); |
73 lm = &otherLocalMatrix; | 73 lm = &otherLocalMatrix; |
74 proxy = otherProxy.get(); | 74 proxy = otherProxy.get(); |
75 } | 75 } |
76 | 76 |
77 return SkNEW_ARGS(SkLocalMatrixShader, (proxy, *lm)); | 77 return SkNEW_ARGS(SkLocalMatrixShader, (proxy, *lm)); |
78 } | 78 } |
OLD | NEW |