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 "SkShader.h" | 8 #include "SkShader.h" |
9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, | 23 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, |
24 TileMode* mode) const SK_OVERRIDE { | 24 TileMode* mode) const SK_OVERRIDE { |
25 return fProxyShader->asABitmap(bitmap, matrix, mode); | 25 return fProxyShader->asABitmap(bitmap, matrix, mode); |
26 } | 26 } |
27 | 27 |
28 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE { | 28 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE { |
29 return fProxyShader->asAGradient(info); | 29 return fProxyShader->asAGradient(info); |
30 } | 30 } |
31 | 31 |
32 // TODO: need to augment this API to pass in a localmatrix (which we can aug
ment) | 32 // TODO: need to augment this API to pass in a localmatrix (which we can aug
ment) |
33 virtual GrEffectRef* asNewEffect(GrContext* ctx, const SkPaint& paint) const
SK_OVERRIDE { | 33 virtual GrEffectRef* asNewEffect(GrContext* ctx, const SkPaint& paint, |
34 return fProxyShader->asNewEffect(ctx, paint); | 34 const SkMatrix* localMatrix) const SK_OVERR
IDE { |
| 35 SkMatrix tmp = fProxyLocalMatrix; |
| 36 if (localMatrix) { |
| 37 tmp.preConcat(*localMatrix); |
| 38 } |
| 39 return fProxyShader->asNewEffect(ctx, paint, &tmp); |
35 } | 40 } |
36 | 41 |
37 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const SK_OV
ERRIDE { | 42 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const SK_OV
ERRIDE { |
38 if (localMatrix) { | 43 if (localMatrix) { |
39 *localMatrix = fProxyLocalMatrix; | 44 *localMatrix = fProxyLocalMatrix; |
40 } | 45 } |
41 return SkRef(fProxyShader.get()); | 46 return SkRef(fProxyShader.get()); |
42 } | 47 } |
43 | 48 |
44 SK_TO_STRING_OVERRIDE() | 49 SK_TO_STRING_OVERRIDE() |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 SkMatrix otherLocalMatrix; | 110 SkMatrix otherLocalMatrix; |
106 SkAutoTUnref<SkShader> otherProxy(proxy->refAsALocalMatrixShader(&otherLocal
Matrix)); | 111 SkAutoTUnref<SkShader> otherProxy(proxy->refAsALocalMatrixShader(&otherLocal
Matrix)); |
107 if (otherProxy.get()) { | 112 if (otherProxy.get()) { |
108 otherLocalMatrix.preConcat(localMatrix); | 113 otherLocalMatrix.preConcat(localMatrix); |
109 lm = &otherLocalMatrix; | 114 lm = &otherLocalMatrix; |
110 proxy = otherProxy.get(); | 115 proxy = otherProxy.get(); |
111 } | 116 } |
112 | 117 |
113 return SkNEW_ARGS(SkLocalMatrixShader, (proxy, *lm)); | 118 return SkNEW_ARGS(SkLocalMatrixShader, (proxy, *lm)); |
114 } | 119 } |
OLD | NEW |