| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 int fCount; | 95 int fCount; |
| 96 SkShader::TileMode fTileMode; | 96 SkShader::TileMode fTileMode; |
| 97 uint32_t fGradFlags; | 97 uint32_t fGradFlags; |
| 98 | 98 |
| 99 void flatten(SkWriteBuffer&) const; | 99 void flatten(SkWriteBuffer&) const; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 class DescriptorScope : public Descriptor { | 102 class DescriptorScope : public Descriptor { |
| 103 public: | 103 public: |
| 104 DescriptorScope() {} | 104 DescriptorScope() {} |
| 105 | 105 |
| 106 bool unflatten(SkReadBuffer&); | 106 bool unflatten(SkReadBuffer&); |
| 107 | 107 |
| 108 // fColors and fPos always point into local memory, so they can be safel
y mutated | 108 // fColors and fPos always point into local memory, so they can be safel
y mutated |
| 109 // | 109 // |
| 110 SkColor* mutableColors() { return const_cast<SkColor*>(fColors); } | 110 SkColor* mutableColors() { return const_cast<SkColor*>(fColors); } |
| 111 SkScalar* mutablePos() { return const_cast<SkScalar*>(fPos); } | 111 SkScalar* mutablePos() { return const_cast<SkScalar*>(fPos); } |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 enum { | 114 enum { |
| 115 kStorageCount = 16 | 115 kStorageCount = 16 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 * Takes in pointers to gradient color and Rec info as colorSrc and recSrc r
espectively. | 243 * Takes in pointers to gradient color and Rec info as colorSrc and recSrc r
espectively. |
| 244 * Count is the number of colors in the gradient | 244 * Count is the number of colors in the gradient |
| 245 * It will then flip all the color and rec information and return in their r
espective Dst | 245 * It will then flip all the color and rec information and return in their r
espective Dst |
| 246 * pointers. It is assumed that space has already been allocated for the Dst
pointers. | 246 * pointers. It is assumed that space has already been allocated for the Dst
pointers. |
| 247 * The rec src and dst are only assumed to be valid if count > 2 | 247 * The rec src and dst are only assumed to be valid if count > 2 |
| 248 */ | 248 */ |
| 249 static void FlipGradientColors(SkColor* colorDst, Rec* recDst, | 249 static void FlipGradientColors(SkColor* colorDst, Rec* recDst, |
| 250 SkColor* colorSrc, Rec* recSrc, | 250 SkColor* colorSrc, Rec* recSrc, |
| 251 int count); | 251 int count); |
| 252 | 252 |
| 253 // V23_COMPATIBILITY_CODE | |
| 254 // Used for 2-pt conical gradients since we sort start/end cirlces by radius | |
| 255 // Assumes space has already been allocated for fOrigColors | |
| 256 void flipGradientColors(); | |
| 257 | |
| 258 private: | 253 private: |
| 259 enum { | 254 enum { |
| 260 kColorStorageCount = 4, // more than this many colors, and we'll use sk_
malloc for the space | 255 kColorStorageCount = 4, // more than this many colors, and we'll use sk_
malloc for the space |
| 261 | 256 |
| 262 kStorageSize = kColorStorageCount * (sizeof(SkColor) + sizeof(SkScalar)
+ sizeof(Rec)) | 257 kStorageSize = kColorStorageCount * (sizeof(SkColor) + sizeof(SkScalar)
+ sizeof(Rec)) |
| 263 }; | 258 }; |
| 264 SkColor fStorage[(kStorageSize + 3) >> 2]; | 259 SkColor fStorage[(kStorageSize + 3) >> 2]; |
| 265 SkColor* fOrigColors; // original colors, before modulation by paint in c
ontext. | 260 SkColor* fOrigColors; // original colors, before modulation by paint in c
ontext. |
| 266 SkScalar* fOrigPos; // original positions | 261 SkScalar* fOrigPos; // original positions |
| 267 bool fColorsAreOpaque; | 262 bool fColorsAreOpaque; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 GrGLProgramDataManager::UniformHandle fColorStartUni; | 447 GrGLProgramDataManager::UniformHandle fColorStartUni; |
| 453 GrGLProgramDataManager::UniformHandle fColorMidUni; | 448 GrGLProgramDataManager::UniformHandle fColorMidUni; |
| 454 GrGLProgramDataManager::UniformHandle fColorEndUni; | 449 GrGLProgramDataManager::UniformHandle fColorEndUni; |
| 455 | 450 |
| 456 typedef GrGLFragmentProcessor INHERITED; | 451 typedef GrGLFragmentProcessor INHERITED; |
| 457 }; | 452 }; |
| 458 | 453 |
| 459 #endif | 454 #endif |
| 460 | 455 |
| 461 #endif | 456 #endif |
| OLD | NEW |