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 |
11 #include "GrSingleTextureEffect.h" | 11 #include "GrSingleTextureEffect.h" |
12 #include "GrRect.h" | |
13 | 12 |
14 class GrGLTextureDomainEffect; | 13 class GrGLTextureDomainEffect; |
| 14 struct SkRect; |
15 | 15 |
16 /** | 16 /** |
17 * Limits a texture's lookup coordinates to a domain. Samples outside the domain
are either clamped | 17 * Limits a texture's lookup coordinates to a domain. Samples outside the domain
are either clamped |
18 * the edge of the domain or result in a vec4 of zeros. The domain is clipped to
normalized texture | 18 * the edge of the domain or result in a vec4 of zeros. The domain is clipped to
normalized texture |
19 * coords ([0,1]x[0,1] square). Bilinear filtering can cause texels outside the
domain to affect the | 19 * coords ([0,1]x[0,1] square). Bilinear filtering can cause texels outside the
domain to affect the |
20 * read value unless the caller considers this when calculating the domain. TODO
: This should be a | 20 * read value unless the caller considers this when calculating the domain. TODO
: This should be a |
21 * helper that can assist an effect rather than effect unto itself. | 21 * helper that can assist an effect rather than effect unto itself. |
22 */ | 22 */ |
23 class GrTextureDomainEffect : public GrSingleTextureEffect { | 23 class GrTextureDomainEffect : public GrSingleTextureEffect { |
24 | 24 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return result; | 67 return result; |
68 } | 68 } |
69 | 69 |
70 protected: | 70 protected: |
71 WrapMode fWrapMode; | 71 WrapMode fWrapMode; |
72 SkRect fTextureDomain; | 72 SkRect fTextureDomain; |
73 | 73 |
74 private: | 74 private: |
75 GrTextureDomainEffect(GrTexture*, | 75 GrTextureDomainEffect(GrTexture*, |
76 const SkMatrix&, | 76 const SkMatrix&, |
77 const GrRect& domain, | 77 const SkRect& domain, |
78 WrapMode, | 78 WrapMode, |
79 bool bilerp, | 79 bool bilerp, |
80 CoordsType type); | 80 CoordsType type); |
81 | 81 |
82 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; | 82 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; |
83 | 83 |
84 GR_DECLARE_EFFECT_TEST; | 84 GR_DECLARE_EFFECT_TEST; |
85 | 85 |
86 typedef GrSingleTextureEffect INHERITED; | 86 typedef GrSingleTextureEffect INHERITED; |
87 }; | 87 }; |
88 | 88 |
89 #endif | 89 #endif |
OLD | NEW |