| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 protected: | 406 protected: |
| 407 /** | 407 /** |
| 408 * Subclasses must call this. It will return a key for the part of the shade
r code controlled | 408 * Subclasses must call this. It will return a key for the part of the shade
r code controlled |
| 409 * by the base class. The subclasses must stick it in their key and then pas
s it to the below | 409 * by the base class. The subclasses must stick it in their key and then pas
s it to the below |
| 410 * emit* functions from their emitCode function. | 410 * emit* functions from their emitCode function. |
| 411 */ | 411 */ |
| 412 static uint32_t GenBaseGradientKey(const GrDrawEffect&); | 412 static uint32_t GenBaseGradientKey(const GrDrawEffect&); |
| 413 | 413 |
| 414 // Emits the uniform used as the y-coord to texture samples in derived class
es. Subclasses | 414 // Emits the uniform used as the y-coord to texture samples in derived class
es. Subclasses |
| 415 // should call this method from their emitCode(). | 415 // should call this method from their emitCode(). |
| 416 void emitUniforms(GrGLShaderBuilder* builder, uint32_t baseKey); | 416 void emitUniforms(GrGLProgramBuilder* builder, uint32_t baseKey); |
| 417 | 417 |
| 418 | 418 |
| 419 // emit code that gets a fragment's color from an expression for t; Has bran
ches for 3 separate | 419 // emit code that gets a fragment's color from an expression for t; Has bran
ches for 3 separate |
| 420 // control flows inside -- 2 color gradients, 3 color symmetric gradients (b
oth using | 420 // control flows inside -- 2 color gradients, 3 color symmetric gradients (b
oth using |
| 421 // native GLSL mix), and 4+ color gradients that use the traditional texture
lookup. | 421 // native GLSL mix), and 4+ color gradients that use the traditional texture
lookup. |
| 422 void emitColor(GrGLShaderBuilder* builder, | 422 void emitColor(GrGLProgramBuilder* builder, |
| 423 const char* gradientTValue, | 423 const char* gradientTValue, |
| 424 uint32_t baseKey, | 424 uint32_t baseKey, |
| 425 const char* outputColor, | 425 const char* outputColor, |
| 426 const char* inputColor, | 426 const char* inputColor, |
| 427 const TextureSamplerArray& samplers); | 427 const TextureSamplerArray& samplers); |
| 428 | 428 |
| 429 private: | 429 private: |
| 430 enum { | 430 enum { |
| 431 kPremulTypeKeyBitCnt = 1, | 431 kPremulTypeKeyBitCnt = 1, |
| 432 kPremulTypeMask = 1, | 432 kPremulTypeMask = 1, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 GrGLProgramDataManager::UniformHandle fColorStartUni; | 464 GrGLProgramDataManager::UniformHandle fColorStartUni; |
| 465 GrGLProgramDataManager::UniformHandle fColorMidUni; | 465 GrGLProgramDataManager::UniformHandle fColorMidUni; |
| 466 GrGLProgramDataManager::UniformHandle fColorEndUni; | 466 GrGLProgramDataManager::UniformHandle fColorEndUni; |
| 467 | 467 |
| 468 typedef GrGLEffect INHERITED; | 468 typedef GrGLEffect INHERITED; |
| 469 }; | 469 }; |
| 470 | 470 |
| 471 #endif | 471 #endif |
| 472 | 472 |
| 473 #endif | 473 #endif |
| OLD | NEW |