| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 * SweepGradient | 316 * SweepGradient |
| 317 * The angle from the origin of texture coordinates in post-matrix space | 317 * The angle from the origin of texture coordinates in post-matrix space |
| 318 * determines the gradient value. | 318 * determines the gradient value. |
| 319 */ | 319 */ |
| 320 | 320 |
| 321 class GrTextureStripAtlas; | 321 class GrTextureStripAtlas; |
| 322 | 322 |
| 323 // Base class for Gr gradient effects | 323 // Base class for Gr gradient effects |
| 324 class GrGradientEffect : public GrFragmentProcessor { | 324 class GrGradientEffect : public GrFragmentProcessor { |
| 325 public: | 325 public: |
| 326 struct CreateArgs { | |
| 327 CreateArgs(GrContext* context, | |
| 328 const SkGradientShaderBase* shader, | |
| 329 const SkMatrix* matrix, | |
| 330 SkShader::TileMode tileMode) | |
| 331 : fContext(context) | |
| 332 , fShader(shader) | |
| 333 , fMatrix(matrix) | |
| 334 , fTileMode(tileMode) {} | |
| 335 | |
| 336 GrContext* fContext; | |
| 337 const SkGradientShaderBase* fShader; | |
| 338 const SkMatrix* fMatrix; | |
| 339 SkShader::TileMode fTileMode; | |
| 340 }; | |
| 341 | |
| 342 class GLSLProcessor; | 326 class GLSLProcessor; |
| 343 | 327 |
| 344 GrGradientEffect(const CreateArgs&); | 328 GrGradientEffect(GrContext* ctx, |
| 329 const SkGradientShaderBase& shader, |
| 330 const SkMatrix& matrix, |
| 331 SkShader::TileMode tileMode); |
| 345 | 332 |
| 346 virtual ~GrGradientEffect(); | 333 virtual ~GrGradientEffect(); |
| 347 | 334 |
| 348 bool useAtlas() const { return SkToBool(-1 != fRow); } | 335 bool useAtlas() const { return SkToBool(-1 != fRow); } |
| 349 SkScalar getYCoord() const { return fYCoord; } | 336 SkScalar getYCoord() const { return fYCoord; } |
| 350 | 337 |
| 351 enum ColorType { | 338 enum ColorType { |
| 352 kTwo_ColorType, | 339 kTwo_ColorType, |
| 353 kThree_ColorType, // Symmetric three color | 340 kThree_ColorType, // Symmetric three color |
| 354 kTexture_ColorType, | 341 kTexture_ColorType, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 SkScalar fCachedYCoord; | 475 SkScalar fCachedYCoord; |
| 489 GrGLSLProgramDataManager::UniformHandle fColorsUni; | 476 GrGLSLProgramDataManager::UniformHandle fColorsUni; |
| 490 GrGLSLProgramDataManager::UniformHandle fFSYUni; | 477 GrGLSLProgramDataManager::UniformHandle fFSYUni; |
| 491 | 478 |
| 492 typedef GrGLSLFragmentProcessor INHERITED; | 479 typedef GrGLSLFragmentProcessor INHERITED; |
| 493 }; | 480 }; |
| 494 | 481 |
| 495 #endif | 482 #endif |
| 496 | 483 |
| 497 #endif | 484 #endif |
| OLD | NEW |