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 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 GradientType asAGradient(GradientInfo* info) const override { | 31 GradientType asAGradient(GradientInfo* info) const override { |
32 return fProxyShader->asAGradient(info); | 32 return fProxyShader->asAGradient(info); |
33 } | 33 } |
34 | 34 |
35 #if SK_SUPPORT_GPU | 35 #if SK_SUPPORT_GPU |
36 | 36 |
37 virtual bool asFragmentProcessor(GrContext* context, const SkPaint& paint, | 37 virtual bool asFragmentProcessor(GrContext* context, const SkPaint& paint, |
38 const SkMatrix& viewM, const SkMatrix* loca
lMatrix, | 38 const SkMatrix& viewM, const SkMatrix* loca
lMatrix, |
39 GrColor* grColor, GrFragmentProcessor** fp)
const override { | 39 GrColor* grColor, GrShaderDataManager* shad
erDataManager, |
| 40 GrFragmentProcessor** fp) const override { |
40 SkMatrix tmp = this->getLocalMatrix(); | 41 SkMatrix tmp = this->getLocalMatrix(); |
41 if (localMatrix) { | 42 if (localMatrix) { |
42 tmp.preConcat(*localMatrix); | 43 tmp.preConcat(*localMatrix); |
43 } | 44 } |
44 return fProxyShader->asFragmentProcessor(context, paint, viewM, &tmp, gr
Color, fp); | 45 return fProxyShader->asFragmentProcessor(context, paint, viewM, &tmp, gr
Color, |
| 46 shaderDataManager, fp); |
45 } | 47 } |
46 | 48 |
47 #else | 49 #else |
48 | 50 |
49 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&
, | 51 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&
, |
50 const SkMatrix*, GrColor*, | 52 const SkMatrix*, GrColor*, GrShaderDataMana
ger*, |
51 GrFragmentProcessor**) const override { | 53 GrFragmentProcessor**) const override { |
52 SkDEBUGFAIL("Should not call in GPU-less build"); | 54 SkDEBUGFAIL("Should not call in GPU-less build"); |
53 return false; | 55 return false; |
54 } | 56 } |
55 | 57 |
56 #endif | 58 #endif |
57 | 59 |
58 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { | 60 SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const override { |
59 if (localMatrix) { | 61 if (localMatrix) { |
60 *localMatrix = this->getLocalMatrix(); | 62 *localMatrix = this->getLocalMatrix(); |
61 } | 63 } |
62 return SkRef(fProxyShader.get()); | 64 return SkRef(fProxyShader.get()); |
63 } | 65 } |
64 | 66 |
65 SK_TO_STRING_OVERRIDE() | 67 SK_TO_STRING_OVERRIDE() |
66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) | 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLocalMatrixShader) |
67 | 69 |
68 protected: | 70 protected: |
69 void flatten(SkWriteBuffer&) const override; | 71 void flatten(SkWriteBuffer&) const override; |
70 Context* onCreateContext(const ContextRec&, void*) const override; | 72 Context* onCreateContext(const ContextRec&, void*) const override; |
71 | 73 |
72 private: | 74 private: |
73 SkAutoTUnref<SkShader> fProxyShader; | 75 SkAutoTUnref<SkShader> fProxyShader; |
74 | 76 |
75 typedef SkShader INHERITED; | 77 typedef SkShader INHERITED; |
76 }; | 78 }; |
77 | 79 |
78 #endif | 80 #endif |
OLD | NEW |