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 "gl/GrGLFragmentProcessor.h" | 12 #include "gl/GrGLFragmentProcessor.h" |
13 #include "glsl/GrGLSLProgramDataManager.h" | 13 #include "glsl/GrGLSLProgramDataManager.h" |
14 | 14 |
15 class GrGLProgramBuilder; | 15 class GrGLProgramBuilder; |
16 class GrGLShaderBuilder; | 16 class GrGLSLShaderBuilder; |
17 class GrInvariantOutput; | 17 class GrInvariantOutput; |
18 class GrGLSLTextureSampler; | 18 class GrGLSLTextureSampler; |
19 struct SkRect; | 19 struct SkRect; |
20 | 20 |
21 /** | 21 /** |
22 * Limits a texture's lookup coordinates to a domain. Samples outside the domain
are either clamped | 22 * 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 | 23 * 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 | 24 * 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. | 25 * domain to affect the read value unless the caller considers this when calcula
ting the domain. |
26 */ | 26 */ |
(...skipping 79 matching lines...) Loading... |
106 /** | 106 /** |
107 * Call this from GrGLFragmentProcessor::emitCode() to sample the textur
e W.R.T. the domain | 107 * Call this from GrGLFragmentProcessor::emitCode() to sample the textur
e W.R.T. the domain |
108 * and mode. | 108 * and mode. |
109 * | 109 * |
110 * @param outcolor name of vec4 variable to hold the sampled color. | 110 * @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. | 111 * @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. | 112 * 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 | 113 * @param inModulateColor if non-nullptr the sampled color will be mod
ulated with this |
114 * expression before being written to outColor. | 114 * expression before being written to outColor. |
115 */ | 115 */ |
116 void sampleTexture(GrGLShaderBuilder* builder, | 116 void sampleTexture(GrGLSLShaderBuilder* builder, |
117 const GrTextureDomain& textureDomain, | 117 const GrTextureDomain& textureDomain, |
118 const char* outColor, | 118 const char* outColor, |
119 const SkString& inCoords, | 119 const SkString& inCoords, |
120 const GrGLSLTextureSampler& sampler, | 120 const GrGLSLTextureSampler& sampler, |
121 const char* inModulateColor = nullptr); | 121 const char* inModulateColor = nullptr); |
122 | 122 |
123 /** | 123 /** |
124 * Call this from GrGLFragmentProcessor::setData() to upload uniforms ne
cessary for the | 124 * Call this from GrGLFragmentProcessor::setData() to upload uniforms ne
cessary for the |
125 * texture domain. The rectangle is automatically adjusted to account fo
r the texture's | 125 * texture domain. The rectangle is automatically adjusted to account fo
r the texture's |
126 * origin. | 126 * origin. |
(...skipping 67 matching lines...) Loading... |
194 bool onIsEqual(const GrFragmentProcessor&) const override; | 194 bool onIsEqual(const GrFragmentProcessor&) const override; |
195 | 195 |
196 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 196 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
197 | 197 |
198 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 198 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
199 | 199 |
200 typedef GrSingleTextureEffect INHERITED; | 200 typedef GrSingleTextureEffect INHERITED; |
201 }; | 201 }; |
202 | 202 |
203 #endif | 203 #endif |
OLD | NEW |