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

Side by Side Diff: src/core/SkMaskGamma.h

Issue 258883002: Gamma correction for distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix SkAutoGlyphCache destructor Created 6 years, 6 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/core/SkGlyphCache.h ('k') | src/core/SkPaint.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 SkMaskGamma_DEFINED 8 #ifndef SkMaskGamma_DEFINED
9 #define SkMaskGamma_DEFINED 9 #define SkMaskGamma_DEFINED
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 /** The type of the mask pre-blend which will be returned from preBlend(SkCo lor). */ 129 /** The type of the mask pre-blend which will be returned from preBlend(SkCo lor). */
130 typedef SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS> PreBlend; 130 typedef SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS> PreBlend;
131 131
132 /** 132 /**
133 * Provides access to the tables appropriate for converting linear alpha 133 * Provides access to the tables appropriate for converting linear alpha
134 * values into gamma correcting alpha values when drawing the given color 134 * values into gamma correcting alpha values when drawing the given color
135 * through the mask. The destination color will be approximated. 135 * through the mask. The destination color will be approximated.
136 */ 136 */
137 PreBlend preBlend(SkColor color) const; 137 PreBlend preBlend(SkColor color) const;
138 138
139 /**
140 * Get dimensions for the full table set, so it can be allocated as a block.
141 */
142 void getGammaTableDimensions(int* tableWidth, int* numTables) const {
143 *tableWidth = 256;
144 *numTables = (1 << MAX_LUM_BITS);
145 }
146
147 /**
148 * Provides direct access to the full table set, so it can be uploaded
149 * into a texture.
150 */
151 const uint8_t* getGammaTables() const {
152 return (const uint8_t*) fGammaTables;
153 }
154
139 private: 155 private:
140 static const int MAX_LUM_BITS = 156 static const int MAX_LUM_BITS =
141 B_LUM_BITS > (R_LUM_BITS > G_LUM_BITS ? R_LUM_BITS : G_LUM_BITS) 157 B_LUM_BITS > (R_LUM_BITS > G_LUM_BITS ? R_LUM_BITS : G_LUM_BITS)
142 ? B_LUM_BITS : (R_LUM_BITS > G_LUM_BITS ? R_LUM_BITS : G_LUM_BITS); 158 ? B_LUM_BITS : (R_LUM_BITS > G_LUM_BITS ? R_LUM_BITS : G_LUM_BITS);
143 uint8_t fGammaTables[1 << MAX_LUM_BITS][256]; 159 uint8_t fGammaTables[1 << MAX_LUM_BITS][256];
144 bool fIsLinear; 160 bool fIsLinear;
145 161
146 typedef SkRefCnt INHERITED; 162 typedef SkRefCnt INHERITED;
147 }; 163 };
148 164
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 */ 223 */
208 template<bool APPLY_LUT> static inline U8CPU sk_apply_lut_if(U8CPU component, co nst uint8_t*) { 224 template<bool APPLY_LUT> static inline U8CPU sk_apply_lut_if(U8CPU component, co nst uint8_t*) {
209 return component; 225 return component;
210 } 226 }
211 template<> /*static*/ inline U8CPU sk_apply_lut_if<true>(U8CPU component, const uint8_t* lut) { 227 template<> /*static*/ inline U8CPU sk_apply_lut_if<true>(U8CPU component, const uint8_t* lut) {
212 return lut[component]; 228 return lut[component];
213 } 229 }
214 ///@} 230 ///@}
215 231
216 #endif 232 #endif
OLDNEW
« no previous file with comments | « src/core/SkGlyphCache.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698