OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |