OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrDistanceFieldTextureEffect_DEFINED | 8 #ifndef GrDistanceFieldTextureEffect_DEFINED |
9 #define GrDistanceFieldTextureEffect_DEFINED | 9 #define GrDistanceFieldTextureEffect_DEFINED |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, GrTexture* tex, | 59 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, GrTexture* tex, |
60 const GrTextureParams& params, | 60 const GrTextureParams& params, |
61 uint32_t flags, bool opaqueVertexColors)
{ | 61 uint32_t flags, bool opaqueVertexColors)
{ |
62 return SkNEW_ARGS(GrDistanceFieldTextureEffect, (color, viewMatrix, tex
, params, flags, | 62 return SkNEW_ARGS(GrDistanceFieldTextureEffect, (color, viewMatrix, tex
, params, flags, |
63 opaqueVertexColors)); | 63 opaqueVertexColors)); |
64 } | 64 } |
65 #endif | 65 #endif |
66 | 66 |
67 virtual ~GrDistanceFieldTextureEffect() {} | 67 virtual ~GrDistanceFieldTextureEffect() {} |
68 | 68 |
69 virtual const char* name() const SK_OVERRIDE { return "DistanceFieldTexture"
; } | 69 const char* name() const SK_OVERRIDE { return "DistanceFieldTexture"; } |
70 | 70 |
71 const GrAttribute* inPosition() const { return fInPosition; } | 71 const GrAttribute* inPosition() const { return fInPosition; } |
72 const GrAttribute* inColor() const { return fInColor; } | 72 const GrAttribute* inColor() const { return fInColor; } |
73 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } | 73 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } |
74 #ifdef SK_GAMMA_APPLY_TO_A8 | 74 #ifdef SK_GAMMA_APPLY_TO_A8 |
75 float getLuminance() const { return fLuminance; } | 75 float getLuminance() const { return fLuminance; } |
76 #endif | 76 #endif |
77 uint32_t getFlags() const { return fFlags; } | 77 uint32_t getFlags() const { return fFlags; } |
78 | 78 |
79 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 79 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
80 const GrGLCaps& caps, | 80 const GrGLCaps& caps, |
81 GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 81 GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
82 | 82 |
83 virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) co
nst SK_OVERRIDE; | 83 GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_O
VERRIDE; |
84 | 84 |
85 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; | 85 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; |
86 | 86 |
87 bool onCanMakeEqual(const GrBatchTracker&, | 87 bool onCanMakeEqual(const GrBatchTracker&, |
88 const GrGeometryProcessor&, | 88 const GrGeometryProcessor&, |
89 const GrBatchTracker&) const SK_OVERRIDE; | 89 const GrBatchTracker&) const SK_OVERRIDE; |
90 | 90 |
91 private: | 91 private: |
92 GrDistanceFieldTextureEffect(GrColor, const SkMatrix& viewMatrix, GrTexture*
texture, | 92 GrDistanceFieldTextureEffect(GrColor, const SkMatrix& viewMatrix, GrTexture*
texture, |
93 const GrTextureParams& params, | 93 const GrTextureParams& params, |
94 #ifdef SK_GAMMA_APPLY_TO_A8 | 94 #ifdef SK_GAMMA_APPLY_TO_A8 |
95 GrTexture* gamma, const GrTextureParams& gammaP
arams, float lum, | 95 GrTexture* gamma, const GrTextureParams& gammaP
arams, float lum, |
96 #endif | 96 #endif |
97 uint32_t flags, bool opaqueVertexColors); | 97 uint32_t flags, bool opaqueVertexColors); |
98 | 98 |
99 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 99 bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; |
100 | 100 |
101 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_O
VERRIDE; | 101 void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_OVERRIDE; |
102 | 102 |
103 GrTextureAccess fTextureAccess; | 103 GrTextureAccess fTextureAccess; |
104 #ifdef SK_GAMMA_APPLY_TO_A8 | 104 #ifdef SK_GAMMA_APPLY_TO_A8 |
105 GrTextureAccess fGammaTextureAccess; | 105 GrTextureAccess fGammaTextureAccess; |
106 float fLuminance; | 106 float fLuminance; |
107 #endif | 107 #endif |
108 uint32_t fFlags; | 108 uint32_t fFlags; |
109 const GrAttribute* fInPosition; | 109 const GrAttribute* fInPosition; |
110 const GrAttribute* fInColor; | 110 const GrAttribute* fInColor; |
111 const GrAttribute* fInTextureCoords; | 111 const GrAttribute* fInTextureCoords; |
(...skipping 14 matching lines...) Expand all Loading... |
126 public: | 126 public: |
127 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, GrTexture* tex, | 127 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, GrTexture* tex, |
128 const GrTextureParams& params, | 128 const GrTextureParams& params, |
129 uint32_t flags, bool opaqueVertexColors)
{ | 129 uint32_t flags, bool opaqueVertexColors)
{ |
130 return SkNEW_ARGS(GrDistanceFieldNoGammaTextureEffect, (color, viewMatri
x, tex, params, | 130 return SkNEW_ARGS(GrDistanceFieldNoGammaTextureEffect, (color, viewMatri
x, tex, params, |
131 flags, opaqueVer
texColors)); | 131 flags, opaqueVer
texColors)); |
132 } | 132 } |
133 | 133 |
134 virtual ~GrDistanceFieldNoGammaTextureEffect() {} | 134 virtual ~GrDistanceFieldNoGammaTextureEffect() {} |
135 | 135 |
136 virtual const char* name() const SK_OVERRIDE { return "DistanceFieldTexture"
; } | 136 const char* name() const SK_OVERRIDE { return "DistanceFieldTexture"; } |
137 | 137 |
138 const GrAttribute* inPosition() const { return fInPosition; } | 138 const GrAttribute* inPosition() const { return fInPosition; } |
139 const GrAttribute* inColor() const { return fInColor; } | 139 const GrAttribute* inColor() const { return fInColor; } |
140 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } | 140 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } |
141 uint32_t getFlags() const { return fFlags; } | 141 uint32_t getFlags() const { return fFlags; } |
142 | 142 |
143 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 143 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
144 const GrGLCaps& caps, | 144 const GrGLCaps& caps, |
145 GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 145 GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
146 | 146 |
147 virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) co
nst SK_OVERRIDE; | 147 GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_O
VERRIDE; |
148 | 148 |
149 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; | 149 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; |
150 | 150 |
151 bool onCanMakeEqual(const GrBatchTracker&, | 151 bool onCanMakeEqual(const GrBatchTracker&, |
152 const GrGeometryProcessor&, | 152 const GrGeometryProcessor&, |
153 const GrBatchTracker&) const SK_OVERRIDE; | 153 const GrBatchTracker&) const SK_OVERRIDE; |
154 | 154 |
155 private: | 155 private: |
156 GrDistanceFieldNoGammaTextureEffect(GrColor, const SkMatrix& viewMatrix, GrT
exture* texture, | 156 GrDistanceFieldNoGammaTextureEffect(GrColor, const SkMatrix& viewMatrix, GrT
exture* texture, |
157 const GrTextureParams& params, uint32_t
flags, | 157 const GrTextureParams& params, uint32_t
flags, |
158 bool opaqueVertexColors); | 158 bool opaqueVertexColors); |
159 | 159 |
160 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 160 bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; |
161 | 161 |
162 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_O
VERRIDE; | 162 void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_OVERRIDE; |
163 | 163 |
164 GrTextureAccess fTextureAccess; | 164 GrTextureAccess fTextureAccess; |
165 uint32_t fFlags; | 165 uint32_t fFlags; |
166 const GrAttribute* fInPosition; | 166 const GrAttribute* fInPosition; |
167 const GrAttribute* fInColor; | 167 const GrAttribute* fInColor; |
168 const GrAttribute* fInTextureCoords; | 168 const GrAttribute* fInTextureCoords; |
169 | 169 |
170 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 170 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
171 | 171 |
172 typedef GrGeometryProcessor INHERITED; | 172 typedef GrGeometryProcessor INHERITED; |
(...skipping 10 matching lines...) Expand all Loading... |
183 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, GrTexture* tex, | 183 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, GrTexture* tex, |
184 const GrTextureParams& params, GrTexture*
gamma, | 184 const GrTextureParams& params, GrTexture*
gamma, |
185 const GrTextureParams& gammaParams, | 185 const GrTextureParams& gammaParams, |
186 SkColor textColor, uint32_t flags) { | 186 SkColor textColor, uint32_t flags) { |
187 return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect, | 187 return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect, |
188 (color, viewMatrix, tex, params, gamma, gammaParams, t
extColor, flags)); | 188 (color, viewMatrix, tex, params, gamma, gammaParams, t
extColor, flags)); |
189 } | 189 } |
190 | 190 |
191 virtual ~GrDistanceFieldLCDTextureEffect() {} | 191 virtual ~GrDistanceFieldLCDTextureEffect() {} |
192 | 192 |
193 virtual const char* name() const SK_OVERRIDE { return "DistanceFieldLCDTextu
re"; } | 193 const char* name() const SK_OVERRIDE { return "DistanceFieldLCDTexture"; } |
194 | 194 |
195 const GrAttribute* inPosition() const { return fInPosition; } | 195 const GrAttribute* inPosition() const { return fInPosition; } |
196 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } | 196 const GrAttribute* inTextureCoords() const { return fInTextureCoords; } |
197 GrColor getTextColor() const { return fTextColor; } | 197 GrColor getTextColor() const { return fTextColor; } |
198 uint32_t getFlags() const { return fFlags; } | 198 uint32_t getFlags() const { return fFlags; } |
199 | 199 |
200 virtual void getGLProcessorKey(const GrBatchTracker& bt, | 200 virtual void getGLProcessorKey(const GrBatchTracker& bt, |
201 const GrGLCaps& caps, | 201 const GrGLCaps& caps, |
202 GrProcessorKeyBuilder* b) const SK_OVERRIDE; | 202 GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
203 | 203 |
204 virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) co
nst SK_OVERRIDE; | 204 GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_O
VERRIDE; |
205 | 205 |
206 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; | 206 void initBatchTracker(GrBatchTracker* bt, const InitBT& init) const SK_OVERR
IDE; |
207 | 207 |
208 bool onCanMakeEqual(const GrBatchTracker&, | 208 bool onCanMakeEqual(const GrBatchTracker&, |
209 const GrGeometryProcessor&, | 209 const GrGeometryProcessor&, |
210 const GrBatchTracker&) const SK_OVERRIDE; | 210 const GrBatchTracker&) const SK_OVERRIDE; |
211 | 211 |
212 private: | 212 private: |
213 GrDistanceFieldLCDTextureEffect(GrColor, const SkMatrix& viewMatrix, GrTextu
re* texture, | 213 GrDistanceFieldLCDTextureEffect(GrColor, const SkMatrix& viewMatrix, GrTextu
re* texture, |
214 const GrTextureParams& params, | 214 const GrTextureParams& params, |
215 GrTexture* gamma, const GrTextureParams& gam
maParams, | 215 GrTexture* gamma, const GrTextureParams& gam
maParams, |
216 SkColor textColor, uint32_t flags); | 216 SkColor textColor, uint32_t flags); |
217 | 217 |
218 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 218 bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; |
219 | 219 |
220 virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_O
VERRIDE; | 220 void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_OVERRIDE; |
221 | 221 |
222 GrTextureAccess fTextureAccess; | 222 GrTextureAccess fTextureAccess; |
223 GrTextureAccess fGammaTextureAccess; | 223 GrTextureAccess fGammaTextureAccess; |
224 GrColor fTextColor; | 224 GrColor fTextColor; |
225 uint32_t fFlags; | 225 uint32_t fFlags; |
226 const GrAttribute* fInPosition; | 226 const GrAttribute* fInPosition; |
227 const GrAttribute* fInTextureCoords; | 227 const GrAttribute* fInTextureCoords; |
228 | 228 |
229 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 229 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
230 | 230 |
231 typedef GrGeometryProcessor INHERITED; | 231 typedef GrGeometryProcessor INHERITED; |
232 }; | 232 }; |
233 | 233 |
234 #endif | 234 #endif |
OLD | NEW |