| 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 SkGradientShaderPriv_DEFINED | 8 #ifndef SkGradientShaderPriv_DEFINED |
| 9 #define SkGradientShaderPriv_DEFINED | 9 #define SkGradientShaderPriv_DEFINED |
| 10 | 10 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 /////////////////////////////////////////////////////////////////////////////// | 284 /////////////////////////////////////////////////////////////////////////////// |
| 285 | 285 |
| 286 // Base class for GL gradient effects | 286 // Base class for GL gradient effects |
| 287 class GrGLGradientEffect : public GrGLEffect { | 287 class GrGLGradientEffect : public GrGLEffect { |
| 288 public: | 288 public: |
| 289 GrGLGradientEffect(const GrBackendEffectFactory& factory); | 289 GrGLGradientEffect(const GrBackendEffectFactory& factory); |
| 290 virtual ~GrGLGradientEffect(); | 290 virtual ~GrGLGradientEffect(); |
| 291 | 291 |
| 292 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER
RIDE; | 292 virtual void setData(const GrGLContext&, const GrDrawEffect&) SK_OVERRIDE; |
| 293 | 293 |
| 294 protected: | 294 protected: |
| 295 /** | 295 /** |
| 296 * Subclasses must reserve the lower kMatrixKeyBitCnt of their key for use b
y | 296 * Subclasses must reserve the lower kMatrixKeyBitCnt of their key for use b
y |
| 297 * GrGLGradientEffect. | 297 * GrGLGradientEffect. |
| 298 */ | 298 */ |
| 299 enum { | 299 enum { |
| 300 kMatrixKeyBitCnt = GrGLEffectMatrix::kKeyBits, | 300 kMatrixKeyBitCnt = GrGLEffectMatrix::kKeyBits, |
| 301 kMatrixKeyMask = (1 << kMatrixKeyBitCnt) - 1, | 301 kMatrixKeyMask = (1 << kMatrixKeyBitCnt) - 1, |
| 302 }; | 302 }; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 316 * calling. | 316 * calling. |
| 317 */ | 317 */ |
| 318 void setupMatrix(GrGLShaderBuilder* builder, | 318 void setupMatrix(GrGLShaderBuilder* builder, |
| 319 EffectKey key, | 319 EffectKey key, |
| 320 const char** fsCoordName, | 320 const char** fsCoordName, |
| 321 const char** vsVaryingName = NULL, | 321 const char** vsVaryingName = NULL, |
| 322 GrSLType* vsVaryingType = NULL); | 322 GrSLType* vsVaryingType = NULL); |
| 323 | 323 |
| 324 // Emits the uniform used as the y-coord to texture samples in derived class
es. Subclasses | 324 // Emits the uniform used as the y-coord to texture samples in derived class
es. Subclasses |
| 325 // should call this method from their emitCode(). | 325 // should call this method from their emitCode(). |
| 326 void emitYCoordUniform(GrGLShaderBuilder* builder); | 326 GrGLShaderBuilder::Uniform* emitYCoordUniform(GrGLShaderBuilder* builder); |
| 327 | 327 |
| 328 // emit code that gets a fragment's color from an expression for t; for now
this always uses the | 328 // emit code that gets a fragment's color from an expression for t; for now
this always uses the |
| 329 // texture, but for simpler cases we'll be able to lerp. Subclasses should c
all this method from | 329 // texture, but for simpler cases we'll be able to lerp. Subclasses should c
all this method from |
| 330 // their emitCode(). | 330 // their emitCode(). |
| 331 void emitColorLookup(GrGLShaderBuilder* builder, | 331 void emitColorLookup(GrGLShaderBuilder* builder, |
| 332 GrGLShaderBuilder::Uniform* fsYUni, |
| 332 const char* gradientTValue, | 333 const char* gradientTValue, |
| 333 const char* outputColor, | 334 const char* outputColor, |
| 334 const char* inputColor, | 335 const char* inputColor, |
| 335 const GrGLShaderBuilder::TextureSampler&); | 336 const GrGLShaderBuilder::TextureSampler&); |
| 336 | 337 |
| 337 private: | 338 private: |
| 338 static const GrEffect::CoordsType kCoordsType = GrEffect::kLocal_CoordsType; | 339 static const GrEffect::CoordsType kCoordsType = GrEffect::kLocal_CoordsType; |
| 339 | 340 |
| 340 SkScalar fCachedYCoord; | 341 SkScalar fCachedYCoord; |
| 341 GrGLUniformManager::UniformHandle fFSYUni; | 342 GrGLUniform* fFSYUni; |
| 342 GrGLEffectMatrix fEffectMatrix; | 343 GrGLEffectMatrix fEffectMatrix; |
| 343 | 344 |
| 344 typedef GrGLEffect INHERITED; | 345 typedef GrGLEffect INHERITED; |
| 345 }; | 346 }; |
| 346 | 347 |
| 347 #endif | 348 #endif |
| 348 | 349 |
| 349 #endif | 350 #endif |
| OLD | NEW |