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 "glsl/GrGLSLFragmentProcessor.h" | 12 #include "glsl/GrGLSLFragmentProcessor.h" |
13 #include "glsl/GrGLSLProgramDataManager.h" | 13 #include "glsl/GrGLSLProgramDataManager.h" |
14 | 14 |
15 class GrGLProgramBuilder; | 15 class GrGLProgramBuilder; |
16 class GrGLSLShaderBuilder; | 16 class GrGLSLShaderBuilder; |
17 class GrInvariantOutput; | 17 class GrInvariantOutput; |
18 class GrGLSLTextureSampler; | 18 class GrGLSLTextureSampler; |
| 19 class GrGLSLUniformHandler; |
19 struct SkRect; | 20 struct SkRect; |
20 | 21 |
21 /** | 22 /** |
22 * Limits a texture's lookup coordinates to a domain. Samples outside the domain
are either clamped | 23 * Limits a texture's lookup coordinates to a domain. Samples outside the domain
are either clamped |
23 * the edge of the domain or result in a vec4 of zeros (decal mode). The domain
is clipped to | 24 * the edge of the domain or result in a vec4 of zeros (decal mode). The domain
is clipped to |
24 * normalized texture coords ([0,1]x[0,1] square). Bilinear filtering can cause
texels outside the | 25 * normalized texture coords ([0,1]x[0,1] square). Bilinear filtering can cause
texels outside the |
25 * domain to affect the read value unless the caller considers this when calcula
ting the domain. | 26 * domain to affect the read value unless the caller considers this when calcula
ting the domain. |
26 */ | 27 */ |
27 class GrTextureDomain { | 28 class GrTextureDomain { |
28 public: | 29 public: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 * Call this from GrGLSLFragmentProcessor::emitCode() to sample the text
ure W.R.T. the | 108 * Call this from GrGLSLFragmentProcessor::emitCode() to sample the text
ure W.R.T. the |
108 * domain and mode. | 109 * domain and mode. |
109 * | 110 * |
110 * @param outcolor name of vec4 variable to hold the sampled color. | 111 * @param outcolor name of vec4 variable to hold the sampled color. |
111 * @param inCoords name of vec2 variable containing the coords to be us
ed with the domain. | 112 * @param inCoords name of vec2 variable containing the coords to be us
ed with the domain. |
112 * It is assumed that this is a variable and not an exp
ression. | 113 * It is assumed that this is a variable and not an exp
ression. |
113 * @param inModulateColor if non-nullptr the sampled color will be mod
ulated with this | 114 * @param inModulateColor if non-nullptr the sampled color will be mod
ulated with this |
114 * expression before being written to outColor. | 115 * expression before being written to outColor. |
115 */ | 116 */ |
116 void sampleTexture(GrGLSLShaderBuilder* builder, | 117 void sampleTexture(GrGLSLShaderBuilder* builder, |
| 118 GrGLSLUniformHandler* uniformHandler, |
117 const GrGLSLCaps* glslCaps, | 119 const GrGLSLCaps* glslCaps, |
118 const GrTextureDomain& textureDomain, | 120 const GrTextureDomain& textureDomain, |
119 const char* outColor, | 121 const char* outColor, |
120 const SkString& inCoords, | 122 const SkString& inCoords, |
121 const GrGLSLTextureSampler& sampler, | 123 const GrGLSLTextureSampler& sampler, |
122 const char* inModulateColor = nullptr); | 124 const char* inModulateColor = nullptr); |
123 | 125 |
124 /** | 126 /** |
125 * Call this from GrGLSLFragmentProcessor::setData() to upload uniforms
necessary for the | 127 * Call this from GrGLSLFragmentProcessor::setData() to upload uniforms
necessary for the |
126 * texture domain. The rectangle is automatically adjusted to account fo
r the texture's | 128 * texture domain. The rectangle is automatically adjusted to account fo
r the texture's |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 bool onIsEqual(const GrFragmentProcessor&) const override; | 206 bool onIsEqual(const GrFragmentProcessor&) const override; |
205 | 207 |
206 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 208 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
207 | 209 |
208 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 210 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
209 | 211 |
210 typedef GrSingleTextureEffect INHERITED; | 212 typedef GrSingleTextureEffect INHERITED; |
211 }; | 213 }; |
212 | 214 |
213 #endif | 215 #endif |
OLD | NEW |