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 #include "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
9 #include "GrTextureDomain.h" | 9 #include "GrTextureDomain.h" |
10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 | 166 |
167 ////////////////////////////////////////////////////////////////////////////// | 167 ////////////////////////////////////////////////////////////////////////////// |
168 | 168 |
169 class GrGLTextureDomainEffect : public GrGLFragmentProcessor { | 169 class GrGLTextureDomainEffect : public GrGLFragmentProcessor { |
170 public: | 170 public: |
171 GrGLTextureDomainEffect(const GrBackendProcessorFactory&, const GrProcessor&
); | 171 GrGLTextureDomainEffect(const GrBackendProcessorFactory&, const GrProcessor&
); |
172 | 172 |
173 virtual void emitCode(GrGLFPBuilder*, | 173 virtual void emitCode(GrGLFPBuilder*, |
174 const GrFragmentProcessor&, | 174 const GrFragmentProcessor&, |
175 const GrProcessorKey&, | |
176 const char* outputColor, | 175 const char* outputColor, |
177 const char* inputColor, | 176 const char* inputColor, |
178 const TransformedCoordsArray&, | 177 const TransformedCoordsArray&, |
179 const TextureSamplerArray&) SK_OVERRIDE; | 178 const TextureSamplerArray&) SK_OVERRIDE; |
180 | 179 |
181 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; | 180 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; |
182 | 181 |
183 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); | 182 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); |
184 | 183 |
185 private: | 184 private: |
186 GrTextureDomain::GLDomain fGLDomain; | 185 GrTextureDomain::GLDomain fGLDomain; |
187 typedef GrGLFragmentProcessor INHERITED; | 186 typedef GrGLFragmentProcessor INHERITED; |
188 }; | 187 }; |
189 | 188 |
190 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrBackendProcessorFactory
& factory, | 189 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrBackendProcessorFactory
& factory, |
191 const GrProcessor&) | 190 const GrProcessor&) |
192 : INHERITED(factory) { | 191 : INHERITED(factory) { |
193 } | 192 } |
194 | 193 |
195 void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder, | 194 void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder, |
196 const GrFragmentProcessor& fp, | 195 const GrFragmentProcessor& fp, |
197 const GrProcessorKey& key, | |
198 const char* outputColor, | 196 const char* outputColor, |
199 const char* inputColor, | 197 const char* inputColor, |
200 const TransformedCoordsArray& coords, | 198 const TransformedCoordsArray& coords, |
201 const TextureSamplerArray& samplers) { | 199 const TextureSamplerArray& samplers) { |
202 const GrTextureDomainEffect& textureDomainEffect = fp.cast<GrTextureDomainEf
fect>(); | 200 const GrTextureDomainEffect& textureDomainEffect = fp.cast<GrTextureDomainEf
fect>(); |
203 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); | 201 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); |
204 | 202 |
205 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 203 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
206 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); | 204 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); |
207 fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0
], inputColor); | 205 fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0
], inputColor); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); | 295 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); |
298 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f
alse; | 296 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f
alse; |
299 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; | 297 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; |
300 return GrTextureDomainEffect::Create(textures[texIdx], | 298 return GrTextureDomainEffect::Create(textures[texIdx], |
301 matrix, | 299 matrix, |
302 domain, | 300 domain, |
303 mode, | 301 mode, |
304 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 302 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
305 coords); | 303 coords); |
306 } | 304 } |
OLD | NEW |