OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrTextureDomainEffect_DEFINED | 8 #ifndef GrTextureDomainEffect_DEFINED |
9 #define GrTextureDomainEffect_DEFINED | 9 #define GrTextureDomainEffect_DEFINED |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 typedef GrSingleTextureEffect INHERITED; | 160 typedef GrSingleTextureEffect INHERITED; |
161 }; | 161 }; |
162 | 162 |
163 /** | 163 /** |
164 * A basic texture effect that uses GrTextureDomain. | 164 * A basic texture effect that uses GrTextureDomain. |
165 */ | 165 */ |
166 class GrTextureDomainEffect : public GrSingleTextureEffect { | 166 class GrTextureDomainEffect : public GrSingleTextureEffect { |
167 | 167 |
168 public: | 168 public: |
169 static sk_sp<GrFragmentProcessor> Make(GrTexture*, | 169 static sk_sp<GrFragmentProcessor> Make(GrTexture*, |
| 170 sk_sp<GrColorSpaceXform>, |
170 const SkMatrix&, | 171 const SkMatrix&, |
171 const SkRect& domain, | 172 const SkRect& domain, |
172 GrTextureDomain::Mode, | 173 GrTextureDomain::Mode, |
173 GrTextureParams::FilterMode filterMod
e, | 174 GrTextureParams::FilterMode filterMod
e, |
174 GrCoordSet = kLocal_GrCoordSet); | 175 GrCoordSet = kLocal_GrCoordSet); |
175 | 176 |
176 virtual ~GrTextureDomainEffect(); | 177 virtual ~GrTextureDomainEffect(); |
177 | 178 |
178 const char* name() const override { return "TextureDomain"; } | 179 const char* name() const override { return "TextureDomain"; } |
179 | 180 |
180 SkString dumpInfo() const override { | 181 SkString dumpInfo() const override { |
181 SkString str; | 182 SkString str; |
182 str.appendf("Domain: [L: %.2f, T: %.2f, R: %.2f, B: %.2f] ", | 183 str.appendf("Domain: [L: %.2f, T: %.2f, R: %.2f, B: %.2f] ", |
183 fTextureDomain.domain().fLeft, fTextureDomain.domain().fTop, | 184 fTextureDomain.domain().fLeft, fTextureDomain.domain().fTop, |
184 fTextureDomain.domain().fRight, fTextureDomain.domain().fBot
tom); | 185 fTextureDomain.domain().fRight, fTextureDomain.domain().fBot
tom); |
185 str.append(INHERITED::dumpInfo()); | 186 str.append(INHERITED::dumpInfo()); |
186 return str; | 187 return str; |
187 } | 188 } |
188 | 189 |
189 const GrTextureDomain& textureDomain() const { return fTextureDomain; } | 190 const GrTextureDomain& textureDomain() const { return fTextureDomain; } |
190 | 191 |
191 protected: | 192 protected: |
192 GrTextureDomain fTextureDomain; | 193 GrTextureDomain fTextureDomain; |
193 | 194 |
194 private: | 195 private: |
195 GrTextureDomainEffect(GrTexture*, | 196 GrTextureDomainEffect(GrTexture*, |
| 197 sk_sp<GrColorSpaceXform>, |
196 const SkMatrix&, | 198 const SkMatrix&, |
197 const SkRect& domain, | 199 const SkRect& domain, |
198 GrTextureDomain::Mode, | 200 GrTextureDomain::Mode, |
199 GrTextureParams::FilterMode, | 201 GrTextureParams::FilterMode, |
200 GrCoordSet); | 202 GrCoordSet); |
201 | 203 |
202 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; | 204 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
203 | 205 |
204 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const
override; | 206 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const
override; |
205 | 207 |
206 bool onIsEqual(const GrFragmentProcessor&) const override; | 208 bool onIsEqual(const GrFragmentProcessor&) const override; |
207 | 209 |
208 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 210 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
209 | 211 |
210 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 212 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
211 | 213 |
212 typedef GrSingleTextureEffect INHERITED; | 214 typedef GrSingleTextureEffect INHERITED; |
213 }; | 215 }; |
214 | 216 |
215 #endif | 217 #endif |
OLD | NEW |