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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 enum { | 114 enum { |
115 kStorageCount = 16 | 115 kStorageCount = 16 |
116 }; | 116 }; |
117 SkColor fColorStorage[kStorageCount]; | 117 SkColor fColorStorage[kStorageCount]; |
118 SkScalar fPosStorage[kStorageCount]; | 118 SkScalar fPosStorage[kStorageCount]; |
119 SkMatrix fLocalMatrixStorage; | 119 SkMatrix fLocalMatrixStorage; |
120 SkAutoMalloc fDynamicStorage; | 120 SkAutoMalloc fDynamicStorage; |
121 }; | 121 }; |
122 | 122 |
123 public: | 123 public: |
124 SkGradientShaderBase(const Descriptor& desc); | 124 SkGradientShaderBase(const Descriptor& desc, const SkMatrix& ptsToUnit); |
125 virtual ~SkGradientShaderBase(); | 125 virtual ~SkGradientShaderBase(); |
126 | 126 |
127 // The cache is initialized on-demand when getCache16/32 is called. | 127 // The cache is initialized on-demand when getCache16/32 is called. |
128 class GradientShaderCache : public SkRefCnt { | 128 class GradientShaderCache : public SkRefCnt { |
129 public: | 129 public: |
130 GradientShaderCache(U8CPU alpha, const SkGradientShaderBase& shader); | 130 GradientShaderCache(U8CPU alpha, const SkGradientShaderBase& shader); |
131 ~GradientShaderCache(); | 131 ~GradientShaderCache(); |
132 | 132 |
133 const uint16_t* getCache16(); | 133 const uint16_t* getCache16(); |
134 const SkPMColor* getCache32(); | 134 const SkPMColor* getCache32(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // also be filled with the gradient colors | 216 // also be filled with the gradient colors |
217 GpuColorType getGpuColorType(SkColor colors[3]) const; | 217 GpuColorType getGpuColorType(SkColor colors[3]) const; |
218 | 218 |
219 uint32_t getGradFlags() const { return fGradFlags; } | 219 uint32_t getGradFlags() const { return fGradFlags; } |
220 | 220 |
221 protected: | 221 protected: |
222 SkGradientShaderBase(SkReadBuffer& ); | 222 SkGradientShaderBase(SkReadBuffer& ); |
223 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 223 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
224 SK_TO_STRING_OVERRIDE() | 224 SK_TO_STRING_OVERRIDE() |
225 | 225 |
226 SkMatrix fPtsToUnit; // set by subclass | 226 const SkMatrix fPtsToUnit; |
227 TileMode fTileMode; | 227 TileMode fTileMode; |
228 TileProc fTileProc; | 228 TileProc fTileProc; |
229 int fColorCount; | 229 int fColorCount; |
230 uint8_t fGradFlags; | 230 uint8_t fGradFlags; |
231 | 231 |
232 struct Rec { | 232 struct Rec { |
233 SkFixed fPos; // 0...1 | 233 SkFixed fPos; // 0...1 |
234 uint32_t fScale; // (1 << 24) / range | 234 uint32_t fScale; // (1 << 24) / range |
235 }; | 235 }; |
236 Rec* fRecs; | 236 Rec* fRecs; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 GrGLProgramDataManager::UniformHandle fColorStartUni; | 446 GrGLProgramDataManager::UniformHandle fColorStartUni; |
447 GrGLProgramDataManager::UniformHandle fColorMidUni; | 447 GrGLProgramDataManager::UniformHandle fColorMidUni; |
448 GrGLProgramDataManager::UniformHandle fColorEndUni; | 448 GrGLProgramDataManager::UniformHandle fColorEndUni; |
449 | 449 |
450 typedef GrGLFragmentProcessor INHERITED; | 450 typedef GrGLFragmentProcessor INHERITED; |
451 }; | 451 }; |
452 | 452 |
453 #endif | 453 #endif |
454 | 454 |
455 #endif | 455 #endif |
OLD | NEW |