| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 struct Rec { | 160 struct Rec { |
| 161 SkFixed fPos; // 0...1 | 161 SkFixed fPos; // 0...1 |
| 162 uint32_t fScale; // (1 << 24) / range | 162 uint32_t fScale; // (1 << 24) / range |
| 163 }; | 163 }; |
| 164 Rec* fRecs; | 164 Rec* fRecs; |
| 165 | 165 |
| 166 const uint16_t* getCache16() const; | 166 const uint16_t* getCache16() const; |
| 167 const SkPMColor* getCache32() const; | 167 const SkPMColor* getCache32() const; |
| 168 | 168 |
| 169 void commonAsAGradient(GradientInfo*) const; | 169 void commonAsAGradient(GradientInfo*, bool flipGrad = false) const; |
| 170 |
| 171 /* |
| 172 * Takes in pointers to gradient color and Rec info as colorSrc and recSrc r
espectively. |
| 173 * Count is the number of colors in the gradient |
| 174 * It will then flip all the color and rec information and return in their r
espective Dst |
| 175 * pointers. It is assumed that space has already been allocated for the Dst
pointers. |
| 176 * The rec src and dst are only assumed to be valid if count > 2 |
| 177 */ |
| 178 static void FlipGradientColors(SkColor* colorDst, Rec* recDst, |
| 179 SkColor* colorSrc, Rec* recSrc, |
| 180 int count); |
| 181 |
| 182 // V23_COMPATIBILITY_CODE |
| 183 // Used for 2-pt conical gradients since we sort start/end cirlces by radius |
| 184 // Assumes space has already been allocated for fOrigColors |
| 185 void flipGradientColors(); |
| 170 | 186 |
| 171 private: | 187 private: |
| 172 enum { | 188 enum { |
| 173 kColorStorageCount = 4, // more than this many colors, and we'll use sk_
malloc for the space | 189 kColorStorageCount = 4, // more than this many colors, and we'll use sk_
malloc for the space |
| 174 | 190 |
| 175 kStorageSize = kColorStorageCount * (sizeof(SkColor) + sizeof(Rec)) | 191 kStorageSize = kColorStorageCount * (sizeof(SkColor) + sizeof(Rec)) |
| 176 }; | 192 }; |
| 177 SkColor fStorage[(kStorageSize + 3) >> 2]; | 193 SkColor fStorage[(kStorageSize + 3) >> 2]; |
| 178 SkColor* fOrigColors; // original colors, before modulation by paint in s
etContext | 194 SkColor* fOrigColors; // original colors, before modulation by paint in s
etContext |
| 179 bool fColorsAreOpaque; | 195 bool fColorsAreOpaque; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 GrGLUniformManager::UniformHandle fColorStartUni; | 399 GrGLUniformManager::UniformHandle fColorStartUni; |
| 384 GrGLUniformManager::UniformHandle fColorMidUni; | 400 GrGLUniformManager::UniformHandle fColorMidUni; |
| 385 GrGLUniformManager::UniformHandle fColorEndUni; | 401 GrGLUniformManager::UniformHandle fColorEndUni; |
| 386 | 402 |
| 387 typedef GrGLEffect INHERITED; | 403 typedef GrGLEffect INHERITED; |
| 388 }; | 404 }; |
| 389 | 405 |
| 390 #endif | 406 #endif |
| 391 | 407 |
| 392 #endif | 408 #endif |
| OLD | NEW |