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

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

Issue 793763003: Gradient shaders: make fPtsToUnit const, pre-cache getType(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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') | src/effects/gradients/SkLinearGradient.cpp » ('j') | 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 enum { 114 enum {
115 kStorageCount = 16 115 kStorageCount = 16
116 }; 116 };
117 SkColor fColorStorage[kStorageCount]; 117 SkColor fColorStorage[kStorageCount];
118 SkScalar fPosStorage[kStorageCount]; 118 SkScalar fPosStorage[kStorageCount];
119 SkMatrix fLocalMatrixStorage; 119 SkMatrix fLocalMatrixStorage;
120 SkAutoMalloc fDynamicStorage; 120 SkAutoMalloc fDynamicStorage;
121 }; 121 };
122 122
123 public: 123 public:
124 SkGradientShaderBase(const Descriptor& desc); 124 SkGradientShaderBase(const Descriptor& desc, const SkMatrix& ptsToUnit);
125 virtual ~SkGradientShaderBase(); 125 virtual ~SkGradientShaderBase();
126 126
127 // The cache is initialized on-demand when getCache16/32 is called. 127 // The cache is initialized on-demand when getCache16/32 is called.
128 class GradientShaderCache : public SkRefCnt { 128 class GradientShaderCache : public SkRefCnt {
129 public: 129 public:
130 GradientShaderCache(U8CPU alpha, const SkGradientShaderBase& shader); 130 GradientShaderCache(U8CPU alpha, const SkGradientShaderBase& shader);
131 ~GradientShaderCache(); 131 ~GradientShaderCache();
132 132
133 const uint16_t* getCache16(); 133 const uint16_t* getCache16();
134 const SkPMColor* getCache32(); 134 const SkPMColor* getCache32();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // also be filled with the gradient colors 216 // also be filled with the gradient colors
217 GpuColorType getGpuColorType(SkColor colors[3]) const; 217 GpuColorType getGpuColorType(SkColor colors[3]) const;
218 218
219 uint32_t getGradFlags() const { return fGradFlags; } 219 uint32_t getGradFlags() const { return fGradFlags; }
220 220
221 protected: 221 protected:
222 SkGradientShaderBase(SkReadBuffer& ); 222 SkGradientShaderBase(SkReadBuffer& );
223 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 223 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
224 SK_TO_STRING_OVERRIDE() 224 SK_TO_STRING_OVERRIDE()
225 225
226 SkMatrix fPtsToUnit; // set by subclass 226 const SkMatrix fPtsToUnit;
227 TileMode fTileMode; 227 TileMode fTileMode;
228 TileProc fTileProc; 228 TileProc fTileProc;
229 int fColorCount; 229 int fColorCount;
230 uint8_t fGradFlags; 230 uint8_t fGradFlags;
231 231
232 struct Rec { 232 struct Rec {
233 SkFixed fPos; // 0...1 233 SkFixed fPos; // 0...1
234 uint32_t fScale; // (1 << 24) / range 234 uint32_t fScale; // (1 << 24) / range
235 }; 235 };
236 Rec* fRecs; 236 Rec* fRecs;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698