Chromium Code Reviews| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 } | 91 } |
| 92 | 92 |
| 93 const SkColor* fColors; | 93 const SkColor* fColors; |
| 94 const SkScalar* fPos; | 94 const SkScalar* fPos; |
| 95 int fCount; | 95 int fCount; |
| 96 SkShader::TileMode fTileMode; | 96 SkShader::TileMode fTileMode; |
| 97 SkUnitMapper* fMapper; | 97 SkUnitMapper* fMapper; |
| 98 uint32_t fFlags; | 98 uint32_t fFlags; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 // Specialized Descriptor used for setting up gpu gradient effect | |
| 102 struct DescriptorGpu { | |
|
bsalomon
2014/04/17 19:23:34
How about we move the logic about whether it is a
| |
| 103 DescriptorGpu() { | |
| 104 sk_bzero(this, sizeof(*this)); | |
| 105 } | |
| 106 | |
| 107 SkColor* fColors; | |
| 108 SkScalar fMidPos; | |
| 109 int fCount; | |
| 110 SkShader::TileMode fTileMode; | |
| 111 uint32_t fFlags; | |
| 112 }; | |
| 113 | |
| 101 public: | 114 public: |
| 102 SkGradientShaderBase(const Descriptor& desc); | 115 SkGradientShaderBase(const Descriptor& desc); |
| 103 virtual ~SkGradientShaderBase(); | 116 virtual ~SkGradientShaderBase(); |
| 104 | 117 |
| 105 // The cache is initialized on-demand when getCache16/32 is called. | 118 // The cache is initialized on-demand when getCache16/32 is called. |
| 106 class GradientShaderCache : public SkRefCnt { | 119 class GradientShaderCache : public SkRefCnt { |
| 107 public: | 120 public: |
| 108 GradientShaderCache(U8CPU alpha, const SkGradientShaderBase& shader); | 121 GradientShaderCache(U8CPU alpha, const SkGradientShaderBase& shader); |
| 109 ~GradientShaderCache(); | 122 ~GradientShaderCache(); |
| 110 | 123 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 kCache32Count = (1 << kCache32Bits), | 191 kCache32Count = (1 << kCache32Bits), |
| 179 kCache32Shift = 16 - kCache32Bits, | 192 kCache32Shift = 16 - kCache32Bits, |
| 180 kSqrt32Shift = 8 - kCache32Bits, | 193 kSqrt32Shift = 8 - kCache32Bits, |
| 181 | 194 |
| 182 /// This value is used to *read* the dither cache; it may be 0 | 195 /// This value is used to *read* the dither cache; it may be 0 |
| 183 /// if dithering is disabled. | 196 /// if dithering is disabled. |
| 184 kDitherStride32 = kCache32Count, | 197 kDitherStride32 = kCache32Count, |
| 185 kDitherStride16 = kCache16Count, | 198 kDitherStride16 = kCache16Count, |
| 186 }; | 199 }; |
| 187 | 200 |
| 201 void getGradientDescriptorGpu(DescriptorGpu* desc) const; | |
| 202 | |
| 188 protected: | 203 protected: |
| 189 SkGradientShaderBase(SkReadBuffer& ); | 204 SkGradientShaderBase(SkReadBuffer& ); |
| 190 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 205 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 191 SK_TO_STRING_OVERRIDE() | 206 SK_TO_STRING_OVERRIDE() |
| 192 | 207 |
| 193 SkUnitMapper* fMapper; | 208 SkUnitMapper* fMapper; |
| 194 SkMatrix fPtsToUnit; // set by subclass | 209 SkMatrix fPtsToUnit; // set by subclass |
| 195 TileMode fTileMode; | 210 TileMode fTileMode; |
| 196 TileProc fTileProc; | 211 TileProc fTileProc; |
| 197 int fColorCount; | 212 int fColorCount; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 GrGLUniformManager::UniformHandle fColorStartUni; | 438 GrGLUniformManager::UniformHandle fColorStartUni; |
| 424 GrGLUniformManager::UniformHandle fColorMidUni; | 439 GrGLUniformManager::UniformHandle fColorMidUni; |
| 425 GrGLUniformManager::UniformHandle fColorEndUni; | 440 GrGLUniformManager::UniformHandle fColorEndUni; |
| 426 | 441 |
| 427 typedef GrGLEffect INHERITED; | 442 typedef GrGLEffect INHERITED; |
| 428 }; | 443 }; |
| 429 | 444 |
| 430 #endif | 445 #endif |
| 431 | 446 |
| 432 #endif | 447 #endif |
| OLD | NEW |