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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 static const TileProc gTileProcs[] = { | 75 static const TileProc gTileProcs[] = { |
76 clamp_tileproc, | 76 clamp_tileproc, |
77 repeat_tileproc, | 77 repeat_tileproc, |
78 mirror_tileproc | 78 mirror_tileproc |
79 }; | 79 }; |
80 | 80 |
81 /////////////////////////////////////////////////////////////////////////////// | 81 /////////////////////////////////////////////////////////////////////////////// |
82 | 82 |
83 class SkGradientShaderBase : public SkShader { | 83 class SkGradientShaderBase : public SkShader { |
84 public: | 84 public: |
85 SkGradientShaderBase(const SkColor colors[], const SkScalar pos[], | 85 struct Descriptor { |
86 int colorCount, SkShader::TileMode mode, SkUnitMapper* mapper); | 86 Descriptor() { |
| 87 sk_bzero(this, sizeof(*this)); |
| 88 fTileMode = SkShader::kClamp_TileMode; |
| 89 } |
| 90 |
| 91 const SkColor* fColors; |
| 92 const SkScalar* fPos; |
| 93 int fCount; |
| 94 SkShader::TileMode fTileMode; |
| 95 SkUnitMapper* fMapper; |
| 96 }; |
| 97 |
| 98 public: |
| 99 SkGradientShaderBase(const Descriptor& desc); |
87 virtual ~SkGradientShaderBase(); | 100 virtual ~SkGradientShaderBase(); |
88 | 101 |
89 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK
_OVERRIDE; | 102 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK
_OVERRIDE; |
90 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; } | 103 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; } |
91 virtual bool isOpaque() const SK_OVERRIDE; | 104 virtual bool isOpaque() const SK_OVERRIDE; |
92 | 105 |
93 void getGradientTableBitmap(SkBitmap*) const; | 106 void getGradientTableBitmap(SkBitmap*) const; |
94 | 107 |
95 enum { | 108 enum { |
96 /// Seems like enough for visual accuracy. TODO: if pos[] deserves | 109 /// Seems like enough for visual accuracy. TODO: if pos[] deserves |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 SkScalar fCachedYCoord; | 338 SkScalar fCachedYCoord; |
326 GrGLUniformManager::UniformHandle fFSYUni; | 339 GrGLUniformManager::UniformHandle fFSYUni; |
327 GrGLEffectMatrix fEffectMatrix; | 340 GrGLEffectMatrix fEffectMatrix; |
328 | 341 |
329 typedef GrGLEffect INHERITED; | 342 typedef GrGLEffect INHERITED; |
330 }; | 343 }; |
331 | 344 |
332 #endif | 345 #endif |
333 | 346 |
334 #endif | 347 #endif |
OLD | NEW |