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 13 matching lines...) Expand all Loading... |
24 public: | 24 public: |
25 enum Mode { | 25 enum Mode { |
26 kIgnore_Mode, // Ignore the texture domain rectangle. | 26 kIgnore_Mode, // Ignore the texture domain rectangle. |
27 kClamp_Mode, // Clamp texture coords to the domain rectangle. | 27 kClamp_Mode, // Clamp texture coords to the domain rectangle. |
28 kDecal_Mode, // Treat the area outside the domain rectangle as fully t
ransparent. | 28 kDecal_Mode, // Treat the area outside the domain rectangle as fully t
ransparent. |
29 | 29 |
30 kLastMode = kDecal_Mode | 30 kLastMode = kDecal_Mode |
31 }; | 31 }; |
32 static const int kModeCount = kLastMode + 1; | 32 static const int kModeCount = kLastMode + 1; |
33 | 33 |
| 34 static const GrTextureDomain& IgnoredDomain() { |
| 35 static const SkRect gDummyRect = {0, 0, 0, 0}; |
| 36 static const GrTextureDomain gDomain(gDummyRect, kIgnore_Mode); |
| 37 return gDomain; |
| 38 } |
| 39 |
34 /** | 40 /** |
35 * @param index Pass a value >= 0 if using multiple texture domains in t
he same effect. | 41 * @param index Pass a value >= 0 if using multiple texture domains in t
he same effect. |
36 * It is used to keep inserted variables from causing name
collisions. | 42 * It is used to keep inserted variables from causing name
collisions. |
37 */ | 43 */ |
38 GrTextureDomain(const SkRect& domain, Mode, int index = -1); | 44 GrTextureDomain(const SkRect& domain, Mode, int index = -1); |
39 | 45 |
40 const SkRect& domain() const { return fDomain; } | 46 const SkRect& domain() const { return fDomain; } |
41 Mode mode() const { return fMode; } | 47 Mode mode() const { return fMode; } |
42 | 48 |
43 /* Computes a domain that bounds all the texels in texelRect. Note that with
bilerp enabled | 49 /* Computes a domain that bounds all the texels in texelRect. Note that with
bilerp enabled |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 GrCoordSet); | 166 GrCoordSet); |
161 | 167 |
162 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; | 168 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; |
163 | 169 |
164 GR_DECLARE_EFFECT_TEST; | 170 GR_DECLARE_EFFECT_TEST; |
165 | 171 |
166 typedef GrSingleTextureEffect INHERITED; | 172 typedef GrSingleTextureEffect INHERITED; |
167 }; | 173 }; |
168 | 174 |
169 #endif | 175 #endif |
OLD | NEW |