| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 ~GradientShaderCache(); | 130 ~GradientShaderCache(); |
| 131 | 131 |
| 132 const uint16_t* getCache16(); | 132 const uint16_t* getCache16(); |
| 133 const SkPMColor* getCache32(); | 133 const SkPMColor* getCache32(); |
| 134 | 134 |
| 135 SkMallocPixelRef* getCache32PixelRef() const { return fCache32PixelRef;
} | 135 SkMallocPixelRef* getCache32PixelRef() const { return fCache32PixelRef;
} |
| 136 | 136 |
| 137 unsigned getAlpha() const { return fCacheAlpha; } | 137 unsigned getAlpha() const { return fCacheAlpha; } |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 // Working pointers. If either is NULL, we need to recompute the corresp
onding cache values. | 140 // Working pointers. If either is nullptr, we need to recompute the corr
esponding cache values. |
| 141 uint16_t* fCache16; | 141 uint16_t* fCache16; |
| 142 SkPMColor* fCache32; | 142 SkPMColor* fCache32; |
| 143 | 143 |
| 144 uint16_t* fCache16Storage; // Storage for fCache16, allocated
on demand. | 144 uint16_t* fCache16Storage; // Storage for fCache16, allocated
on demand. |
| 145 SkMallocPixelRef* fCache32PixelRef; | 145 SkMallocPixelRef* fCache32PixelRef; |
| 146 const unsigned fCacheAlpha; // The alpha value we used when we
computed the cache. | 146 const unsigned fCacheAlpha; // The alpha value we used when we
computed the cache. |
| 147 // Larger than 8bits so we can sto
re uninitialized | 147 // Larger than 8bits so we can sto
re uninitialized |
| 148 // value. | 148 // value. |
| 149 | 149 |
| 150 const SkGradientShaderBase& fShader; | 150 const SkGradientShaderBase& fShader; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 SkASSERT((pos-1) <= fColorType); | 351 SkASSERT((pos-1) <= fColorType); |
| 352 return &fColors[pos]; | 352 return &fColors[pos]; |
| 353 } | 353 } |
| 354 | 354 |
| 355 protected: | 355 protected: |
| 356 | 356 |
| 357 /** Populates a pair of arrays with colors and stop info to construct a rand
om gradient. | 357 /** Populates a pair of arrays with colors and stop info to construct a rand
om gradient. |
| 358 The function decides whether stop values should be used or not. The retu
rn value indicates | 358 The function decides whether stop values should be used or not. The retu
rn value indicates |
| 359 the number of colors, which will be capped by kMaxRandomGradientColors.
colors should be | 359 the number of colors, which will be capped by kMaxRandomGradientColors.
colors should be |
| 360 sized to be at least kMaxRandomGradientColors. stops is a pointer to an
array of at least | 360 sized to be at least kMaxRandomGradientColors. stops is a pointer to an
array of at least |
| 361 size kMaxRandomGradientColors. It may be updated to NULL, indicating tha
t NULL should be | 361 size kMaxRandomGradientColors. It may be updated to nullptr, indicating
that nullptr should be |
| 362 passed to the gradient factory rather than the array. | 362 passed to the gradient factory rather than the array. |
| 363 */ | 363 */ |
| 364 static const int kMaxRandomGradientColors = 4; | 364 static const int kMaxRandomGradientColors = 4; |
| 365 static int RandomGradientParams(SkRandom* r, | 365 static int RandomGradientParams(SkRandom* r, |
| 366 SkColor colors[kMaxRandomGradientColors], | 366 SkColor colors[kMaxRandomGradientColors], |
| 367 SkScalar** stops, | 367 SkScalar** stops, |
| 368 SkShader::TileMode* tm); | 368 SkShader::TileMode* tm); |
| 369 | 369 |
| 370 bool onIsEqual(const GrFragmentProcessor&) const override; | 370 bool onIsEqual(const GrFragmentProcessor&) const override; |
| 371 | 371 |
| (...skipping 74 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 |