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 #ifndef SkLocalMatrixShader_DEFINED | 8 #ifndef SkLocalMatrixShader_DEFINED |
9 #define SkLocalMatrixShader_DEFINED | 9 #define SkLocalMatrixShader_DEFINED |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, | 26 virtual BitmapType asABitmap(SkBitmap* bitmap, SkMatrix* matrix, |
27 TileMode* mode) const SK_OVERRIDE { | 27 TileMode* mode) const SK_OVERRIDE { |
28 return fProxyShader->asABitmap(bitmap, matrix, mode); | 28 return fProxyShader->asABitmap(bitmap, matrix, mode); |
29 } | 29 } |
30 | 30 |
31 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE { | 31 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE { |
32 return fProxyShader->asAGradient(info); | 32 return fProxyShader->asAGradient(info); |
33 } | 33 } |
34 | 34 |
35 virtual GrEffectRef* asNewEffect(GrContext* ctx, const SkPaint& paint, | 35 virtual bool asNewEffect(GrContext* context, const SkPaint& paint, GrColor*
grColor, |
36 const SkMatrix* localMatrix) const SK_OVERR
IDE { | 36 GrEffectRef** grEffect, const SkMatrix* localMatrix
) |
| 37 const SK_OVERRIDE { |
37 SkMatrix tmp = fProxyLocalMatrix; | 38 SkMatrix tmp = fProxyLocalMatrix; |
38 if (localMatrix) { | 39 if (localMatrix) { |
39 tmp.preConcat(*localMatrix); | 40 tmp.preConcat(*localMatrix); |
40 } | 41 } |
41 return fProxyShader->asNewEffect(ctx, paint, &tmp); | 42 fProxyShader->asNewEffect(context, paint, grColor, grEffect, &tmp); |
| 43 return true; |
42 } | 44 } |
43 | 45 |
44 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const SK_OV
ERRIDE { | 46 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const SK_OV
ERRIDE { |
45 if (localMatrix) { | 47 if (localMatrix) { |
46 *localMatrix = fProxyLocalMatrix; | 48 *localMatrix = fProxyLocalMatrix; |
47 } | 49 } |
48 return SkRef(fProxyShader.get()); | 50 return SkRef(fProxyShader.get()); |
49 } | 51 } |
50 | 52 |
51 SK_TO_STRING_OVERRIDE() | 53 SK_TO_STRING_OVERRIDE() |
52 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) | 54 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) |
53 | 55 |
54 protected: | 56 protected: |
55 SkLocalMatrixShader(SkReadBuffer&); | 57 SkLocalMatrixShader(SkReadBuffer&); |
56 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 58 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
57 virtual Context* onCreateContext(const ContextRec&, void*) const SK_OVERRIDE
; | 59 virtual Context* onCreateContext(const ContextRec&, void*) const SK_OVERRIDE
; |
58 | 60 |
59 private: | 61 private: |
60 SkAutoTUnref<SkShader> fProxyShader; | 62 SkAutoTUnref<SkShader> fProxyShader; |
61 SkMatrix fProxyLocalMatrix; | 63 SkMatrix fProxyLocalMatrix; |
62 | 64 |
63 typedef SkShader INHERITED; | 65 typedef SkShader INHERITED; |
64 }; | 66 }; |
65 | 67 |
66 #endif | 68 #endif |
OLD | NEW |