| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 return toggle ^ SkGradientShaderBase::kDitherStride16; | 290 return toggle ^ SkGradientShaderBase::kDitherStride16; |
| 291 } | 291 } |
| 292 | 292 |
| 293 /////////////////////////////////////////////////////////////////////////////// | 293 /////////////////////////////////////////////////////////////////////////////// |
| 294 | 294 |
| 295 #if SK_SUPPORT_GPU | 295 #if SK_SUPPORT_GPU |
| 296 | 296 |
| 297 #include "GrCoordTransform.h" | 297 #include "GrCoordTransform.h" |
| 298 #include "GrFragmentProcessor.h" | 298 #include "GrFragmentProcessor.h" |
| 299 #include "gl/GrGLFragmentProcessor.h" | 299 #include "gl/GrGLFragmentProcessor.h" |
| 300 #include "glsl/GrGLSLProgramDataManager.h" |
| 300 | 301 |
| 301 class GrInvariantOutput; | 302 class GrInvariantOutput; |
| 302 | 303 |
| 303 /* | 304 /* |
| 304 * The interpretation of the texture matrix depends on the sample mode. The | 305 * The interpretation of the texture matrix depends on the sample mode. The |
| 305 * texture matrix is applied both when the texture coordinates are explicit | 306 * texture matrix is applied both when the texture coordinates are explicit |
| 306 * and when vertex positions are used as texture coordinates. In the latter | 307 * and when vertex positions are used as texture coordinates. In the latter |
| 307 * case the texture matrix is applied to the pre-view-matrix position | 308 * case the texture matrix is applied to the pre-view-matrix position |
| 308 * values. | 309 * values. |
| 309 * | 310 * |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 395 |
| 395 /////////////////////////////////////////////////////////////////////////////// | 396 /////////////////////////////////////////////////////////////////////////////// |
| 396 | 397 |
| 397 // Base class for GL gradient effects | 398 // Base class for GL gradient effects |
| 398 class GrGLGradientEffect : public GrGLFragmentProcessor { | 399 class GrGLGradientEffect : public GrGLFragmentProcessor { |
| 399 public: | 400 public: |
| 400 GrGLGradientEffect(); | 401 GrGLGradientEffect(); |
| 401 virtual ~GrGLGradientEffect(); | 402 virtual ~GrGLGradientEffect(); |
| 402 | 403 |
| 403 protected: | 404 protected: |
| 404 void onSetData(const GrGLProgramDataManager&, const GrProcessor&) override; | 405 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
| 405 | 406 |
| 406 protected: | 407 protected: |
| 407 /** | 408 /** |
| 408 * Subclasses must call this. It will return a key for the part of the shade
r code controlled | 409 * 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 | 410 * 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. | 411 * emit* functions from their emitCode function. |
| 411 */ | 412 */ |
| 412 static uint32_t GenBaseGradientKey(const GrProcessor&); | 413 static uint32_t GenBaseGradientKey(const GrProcessor&); |
| 413 | 414 |
| 414 // Emits the uniform used as the y-coord to texture samples in derived class
es. Subclasses | 415 // Emits the uniform used as the y-coord to texture samples in derived class
es. Subclasses |
| (...skipping 22 matching lines...) Expand all Loading... |
| 437 kColorKeyMask = kTwoColorKey | kThreeColorKey, | 438 kColorKeyMask = kTwoColorKey | kThreeColorKey, |
| 438 kColorKeyBitCnt = 2, | 439 kColorKeyBitCnt = 2, |
| 439 | 440 |
| 440 // Subclasses must shift any key bits they produce up by this amount | 441 // Subclasses must shift any key bits they produce up by this amount |
| 441 // and combine with the result of GenBaseGradientKey. | 442 // and combine with the result of GenBaseGradientKey. |
| 442 kBaseKeyBitCnt = (kPremulTypeKeyBitCnt + kColorKeyBitCnt) | 443 kBaseKeyBitCnt = (kPremulTypeKeyBitCnt + kColorKeyBitCnt) |
| 443 }; | 444 }; |
| 444 GR_STATIC_ASSERT(kBaseKeyBitCnt <= 32); | 445 GR_STATIC_ASSERT(kBaseKeyBitCnt <= 32); |
| 445 | 446 |
| 446 SkScalar fCachedYCoord; | 447 SkScalar fCachedYCoord; |
| 447 GrGLProgramDataManager::UniformHandle fFSYUni; | 448 GrGLSLProgramDataManager::UniformHandle fFSYUni; |
| 448 GrGLProgramDataManager::UniformHandle fColorStartUni; | 449 GrGLSLProgramDataManager::UniformHandle fColorStartUni; |
| 449 GrGLProgramDataManager::UniformHandle fColorMidUni; | 450 GrGLSLProgramDataManager::UniformHandle fColorMidUni; |
| 450 GrGLProgramDataManager::UniformHandle fColorEndUni; | 451 GrGLSLProgramDataManager::UniformHandle fColorEndUni; |
| 451 | 452 |
| 452 typedef GrGLFragmentProcessor INHERITED; | 453 typedef GrGLFragmentProcessor INHERITED; |
| 453 }; | 454 }; |
| 454 | 455 |
| 455 #endif | 456 #endif |
| 456 | 457 |
| 457 #endif | 458 #endif |
| OLD | NEW |