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

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: Add comments for the magic bold factor 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 | « no previous file | src/core/SkPaint.cpp » ('j') | src/core/SkPaint.cpp » ('J')
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 * Provides direct access to the full table set, so it can be uploaded
141 * into a texture.
142 */
143 const uint8_t* getGammaTables(int& tableWidth, int& numTables) const {
reed1 2014/05/28 19:45:17 style: skia always uses pointers for out-params
jvanverth1 2014/05/29 18:53:49 Done.
144 tableWidth = 256;
145 numTables = (1 << MAX_LUM_BITS);
146 return (const uint8_t*) fGammaTables;
147 }
148
139 private: 149 private:
140 static const int MAX_LUM_BITS = 150 static const int MAX_LUM_BITS =
141 B_LUM_BITS > (R_LUM_BITS > G_LUM_BITS ? R_LUM_BITS : G_LUM_BITS) 151 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); 152 ? B_LUM_BITS : (R_LUM_BITS > G_LUM_BITS ? R_LUM_BITS : G_LUM_BITS);
143 uint8_t fGammaTables[1 << MAX_LUM_BITS][256]; 153 uint8_t fGammaTables[1 << MAX_LUM_BITS][256];
144 bool fIsLinear; 154 bool fIsLinear;
145 155
146 typedef SkRefCnt INHERITED; 156 typedef SkRefCnt INHERITED;
147 }; 157 };
148 158
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 */ 217 */
208 template<bool APPLY_LUT> static inline U8CPU sk_apply_lut_if(U8CPU component, co nst uint8_t*) { 218 template<bool APPLY_LUT> static inline U8CPU sk_apply_lut_if(U8CPU component, co nst uint8_t*) {
209 return component; 219 return component;
210 } 220 }
211 template<> /*static*/ inline U8CPU sk_apply_lut_if<true>(U8CPU component, const uint8_t* lut) { 221 template<> /*static*/ inline U8CPU sk_apply_lut_if<true>(U8CPU component, const uint8_t* lut) {
212 return lut[component]; 222 return lut[component];
213 } 223 }
214 ///@} 224 ///@}
215 225
216 #endif 226 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | src/core/SkPaint.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698