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 |
326 class GLSLProcessor; | 342 class GLSLProcessor; |
327 | 343 |
328 GrGradientEffect(GrContext* ctx, | 344 GrGradientEffect(const CreateArgs&); |
329 const SkGradientShaderBase& shader, | |
330 const SkMatrix& matrix, | |
331 SkShader::TileMode tileMode); | |
332 | 345 |
333 virtual ~GrGradientEffect(); | 346 virtual ~GrGradientEffect(); |
334 | 347 |
335 bool useAtlas() const { return SkToBool(-1 != fRow); } | 348 bool useAtlas() const { return SkToBool(-1 != fRow); } |
336 SkScalar getYCoord() const { return fYCoord; } | 349 SkScalar getYCoord() const { return fYCoord; } |
337 | 350 |
338 enum ColorType { | 351 enum ColorType { |
339 kTwo_ColorType, | 352 kTwo_ColorType, |
340 kThree_ColorType, // Symmetric three color | 353 kThree_ColorType, // Symmetric three color |
341 kTexture_ColorType, | 354 kTexture_ColorType, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 SkScalar fCachedYCoord; | 488 SkScalar fCachedYCoord; |
476 GrGLSLProgramDataManager::UniformHandle fColorsUni; | 489 GrGLSLProgramDataManager::UniformHandle fColorsUni; |
477 GrGLSLProgramDataManager::UniformHandle fFSYUni; | 490 GrGLSLProgramDataManager::UniformHandle fFSYUni; |
478 | 491 |
479 typedef GrGLSLFragmentProcessor INHERITED; | 492 typedef GrGLSLFragmentProcessor INHERITED; |
480 }; | 493 }; |
481 | 494 |
482 #endif | 495 #endif |
483 | 496 |
484 #endif | 497 #endif |
OLD | NEW |