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

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

Issue 15893002: Add flag to gradients to interpolate colors in premul space. Experimental API to encapsulate the sh… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | src/effects/gradients/SkSweepGradient.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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 Descriptor() { 86 Descriptor() {
87 sk_bzero(this, sizeof(*this)); 87 sk_bzero(this, sizeof(*this));
88 fTileMode = SkShader::kClamp_TileMode; 88 fTileMode = SkShader::kClamp_TileMode;
89 } 89 }
90 90
91 const SkColor* fColors; 91 const SkColor* fColors;
92 const SkScalar* fPos; 92 const SkScalar* fPos;
93 int fCount; 93 int fCount;
94 SkShader::TileMode fTileMode; 94 SkShader::TileMode fTileMode;
95 SkUnitMapper* fMapper; 95 SkUnitMapper* fMapper;
96 uint32_t fFlags;
96 }; 97 };
97 98
98 public: 99 public:
99 SkGradientShaderBase(const Descriptor& desc); 100 SkGradientShaderBase(const Descriptor& desc);
100 virtual ~SkGradientShaderBase(); 101 virtual ~SkGradientShaderBase();
101 102
102 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK _OVERRIDE; 103 virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK _OVERRIDE;
103 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; } 104 virtual uint32_t getFlags() SK_OVERRIDE { return fFlags; }
104 virtual bool isOpaque() const SK_OVERRIDE; 105 virtual bool isOpaque() const SK_OVERRIDE;
105 106
(...skipping 28 matching lines...) Expand all
134 135
135 SkUnitMapper* fMapper; 136 SkUnitMapper* fMapper;
136 SkMatrix fPtsToUnit; // set by subclass 137 SkMatrix fPtsToUnit; // set by subclass
137 SkMatrix fDstToIndex; 138 SkMatrix fDstToIndex;
138 SkMatrix::MapXYProc fDstToIndexProc; 139 SkMatrix::MapXYProc fDstToIndexProc;
139 TileMode fTileMode; 140 TileMode fTileMode;
140 TileProc fTileProc; 141 TileProc fTileProc;
141 int fColorCount; 142 int fColorCount;
142 uint8_t fDstToIndexClass; 143 uint8_t fDstToIndexClass;
143 uint8_t fFlags; 144 uint8_t fFlags;
145 uint8_t fGradFlags;
144 146
145 struct Rec { 147 struct Rec {
146 SkFixed fPos; // 0...1 148 SkFixed fPos; // 0...1
147 uint32_t fScale; // (1 << 24) / range 149 uint32_t fScale; // (1 << 24) / range
148 }; 150 };
149 Rec* fRecs; 151 Rec* fRecs;
150 152
151 const uint16_t* getCache16() const; 153 const uint16_t* getCache16() const;
152 const SkPMColor* getCache32() const; 154 const SkPMColor* getCache32() const;
153 155
(...skipping 11 matching lines...) Expand all
165 167
166 mutable uint16_t* fCache16; // working ptr. If this is NULL, we need to recompute the cache values 168 mutable uint16_t* fCache16; // working ptr. If this is NULL, we need to recompute the cache values
167 mutable SkPMColor* fCache32; // working ptr. If this is NULL, we need to recompute the cache values 169 mutable SkPMColor* fCache32; // working ptr. If this is NULL, we need to recompute the cache values
168 170
169 mutable uint16_t* fCache16Storage; // storage for fCache16, allocated o n demand 171 mutable uint16_t* fCache16Storage; // storage for fCache16, allocated o n demand
170 mutable SkMallocPixelRef* fCache32PixelRef; 172 mutable SkMallocPixelRef* fCache32PixelRef;
171 mutable unsigned fCacheAlpha; // the alpha value we used when we c omputed the cache. larger than 8bits so we can store uninitialized value 173 mutable unsigned fCacheAlpha; // the alpha value we used when we c omputed the cache. larger than 8bits so we can store uninitialized value
172 174
173 static void Build16bitCache(uint16_t[], SkColor c0, SkColor c1, int count); 175 static void Build16bitCache(uint16_t[], SkColor c0, SkColor c1, int count);
174 static void Build32bitCache(SkPMColor[], SkColor c0, SkColor c1, int count, 176 static void Build32bitCache(SkPMColor[], SkColor c0, SkColor c1, int count,
175 U8CPU alpha); 177 U8CPU alpha, uint32_t gradFlags);
176 void setCacheAlpha(U8CPU alpha) const; 178 void setCacheAlpha(U8CPU alpha) const;
177 void initCommon(); 179 void initCommon();
178 180
179 typedef SkShader INHERITED; 181 typedef SkShader INHERITED;
180 }; 182 };
181 183
182 static inline int init_dither_toggle(int x, int y) { 184 static inline int init_dither_toggle(int x, int y) {
183 x &= 1; 185 x &= 1;
184 y = (y & 1) << 1; 186 y = (y & 1) << 1;
185 return (x | y) * SkGradientShaderBase::kDitherStride32; 187 return (x | y) * SkGradientShaderBase::kDitherStride32;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 SkScalar fCachedYCoord; 340 SkScalar fCachedYCoord;
339 GrGLUniformManager::UniformHandle fFSYUni; 341 GrGLUniformManager::UniformHandle fFSYUni;
340 GrGLEffectMatrix fEffectMatrix; 342 GrGLEffectMatrix fEffectMatrix;
341 343
342 typedef GrGLEffect INHERITED; 344 typedef GrGLEffect INHERITED;
343 }; 345 };
344 346
345 #endif 347 #endif
346 348
347 #endif 349 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | src/effects/gradients/SkSweepGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698