Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/effects/gradients/SkGradientShaderPriv.h

Issue 2343253002: Support for color-spaces with multi-stop (texture) gradients (Closed)
Patch Set: SkASSERT -> SkDEBUGFAIL Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 bool fDither; 168 bool fDither;
169 169
170 SkAutoTUnref<GradientShaderCache> fCache; 170 SkAutoTUnref<GradientShaderCache> fCache;
171 171
172 private: 172 private:
173 typedef SkShader::Context INHERITED; 173 typedef SkShader::Context INHERITED;
174 }; 174 };
175 175
176 bool isOpaque() const override; 176 bool isOpaque() const override;
177 177
178 void getGradientTableBitmap(SkBitmap*) const; 178 enum class GradientBitmapType : uint8_t {
179 kLegacy,
180 kSRGB,
181 kHalfFloat,
182 };
183
184 void getGradientTableBitmap(SkBitmap*, GradientBitmapType bitmapType) const;
179 185
180 enum { 186 enum {
181 /// Seems like enough for visual accuracy. TODO: if pos[] deserves 187 /// Seems like enough for visual accuracy. TODO: if pos[] deserves
182 /// it, use a larger cache. 188 /// it, use a larger cache.
183 kCache32Bits = 8, 189 kCache32Bits = 8,
184 kCache32Count = (1 << kCache32Bits), 190 kCache32Count = (1 << kCache32Bits),
185 kCache32Shift = 16 - kCache32Bits, 191 kCache32Shift = 16 - kCache32Bits,
186 kSqrt32Shift = 8 - kCache32Bits, 192 kSqrt32Shift = 8 - kCache32Bits,
187 193
188 /// This value is used to *read* the dither cache; it may be 0 194 /// This value is used to *read* the dither cache; it may be 0
(...skipping 18 matching lines...) Expand all
207 struct Rec { 213 struct Rec {
208 SkFixed fPos; // 0...1 214 SkFixed fPos; // 0...1
209 uint32_t fScale; // (1 << 24) / range 215 uint32_t fScale; // (1 << 24) / range
210 }; 216 };
211 Rec* fRecs; 217 Rec* fRecs;
212 218
213 void commonAsAGradient(GradientInfo*, bool flipGrad = false) const; 219 void commonAsAGradient(GradientInfo*, bool flipGrad = false) const;
214 220
215 bool onAsLuminanceColor(SkColor*) const override; 221 bool onAsLuminanceColor(SkColor*) const override;
216 222
223
224 void initLinearBitmap(SkBitmap* bitmap) const;
225
217 /* 226 /*
218 * Takes in pointers to gradient color and Rec info as colorSrc and recSrc r espectively. 227 * Takes in pointers to gradient color and Rec info as colorSrc and recSrc r espectively.
219 * Count is the number of colors in the gradient 228 * Count is the number of colors in the gradient
220 * It will then flip all the color and rec information and return in their r espective Dst 229 * It will then flip all the color and rec information and return in their r espective Dst
221 * pointers. It is assumed that space has already been allocated for the Dst pointers. 230 * pointers. It is assumed that space has already been allocated for the Dst pointers.
222 * The rec src and dst are only assumed to be valid if count > 2 231 * The rec src and dst are only assumed to be valid if count > 2
223 */ 232 */
224 static void FlipGradientColors(SkColor* colorDst, Rec* recDst, 233 static void FlipGradientColors(SkColor* colorDst, Rec* recDst,
225 SkColor* colorSrc, Rec* recSrc, 234 SkColor* colorSrc, Rec* recSrc,
226 int count); 235 int count);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 kMirrorTileMode = 48, 492 kMirrorTileMode = 48,
484 493
485 // Lower six bits for premul, 2/3 color type, and tile mode 494 // Lower six bits for premul, 2/3 color type, and tile mode
486 kReservedBits = 6, 495 kReservedBits = 6,
487 #endif 496 #endif
488 }; 497 };
489 498
490 SkScalar fCachedYCoord; 499 SkScalar fCachedYCoord;
491 GrGLSLProgramDataManager::UniformHandle fColorsUni; 500 GrGLSLProgramDataManager::UniformHandle fColorsUni;
492 GrGLSLProgramDataManager::UniformHandle fFSYUni; 501 GrGLSLProgramDataManager::UniformHandle fFSYUni;
502 GrGLSLProgramDataManager::UniformHandle fColorSpaceXformUni;
493 503
494 typedef GrGLSLFragmentProcessor INHERITED; 504 typedef GrGLSLFragmentProcessor INHERITED;
495 }; 505 };
496 506
497 #endif 507 #endif
498 508
499 #endif 509 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698