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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 * contains non-linear alpha values in an attempt to create gamma correct blits | 85 * contains non-linear alpha values in an attempt to create gamma correct blits |
86 * in the presence of a gamma incorrect (linear) blend in the blitter. | 86 * in the presence of a gamma incorrect (linear) blend in the blitter. |
87 * | 87 * |
88 * SkMaskGamma creates and maintains tables which convert linear alpha values | 88 * SkMaskGamma creates and maintains tables which convert linear alpha values |
89 * to gamma correcting alpha values. | 89 * to gamma correcting alpha values. |
90 * @param R The number of luminance bits to use [1, 8] from the red channel. | 90 * @param R The number of luminance bits to use [1, 8] from the red channel. |
91 * @param G The number of luminance bits to use [1, 8] from the green channel. | 91 * @param G The number of luminance bits to use [1, 8] from the green channel. |
92 * @param B The number of luminance bits to use [1, 8] from the blue channel. | 92 * @param B The number of luminance bits to use [1, 8] from the blue channel. |
93 */ | 93 */ |
94 template <int R_LUM_BITS, int G_LUM_BITS, int B_LUM_BITS> class SkTMaskGamma : p
ublic SkRefCnt { | 94 template <int R_LUM_BITS, int G_LUM_BITS, int B_LUM_BITS> class SkTMaskGamma : p
ublic SkRefCnt { |
95 SK_DECLARE_INST_COUNT(SkTMaskGamma) | 95 |
96 public: | 96 public: |
97 | 97 |
98 /** Creates a linear SkTMaskGamma. */ | 98 /** Creates a linear SkTMaskGamma. */ |
99 SkTMaskGamma() : fIsLinear(true) { } | 99 SkTMaskGamma() : fIsLinear(true) { } |
100 | 100 |
101 /** | 101 /** |
102 * Creates tables to convert linear alpha values to gamma correcting alpha | 102 * Creates tables to convert linear alpha values to gamma correcting alpha |
103 * values. | 103 * values. |
104 * | 104 * |
105 * @param contrast A value in the range [0.0, 1.0] which indicates the | 105 * @param contrast A value in the range [0.0, 1.0] which indicates the |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 */ | 221 */ |
222 template<bool APPLY_LUT> static inline U8CPU sk_apply_lut_if(U8CPU component, co
nst uint8_t*) { | 222 template<bool APPLY_LUT> static inline U8CPU sk_apply_lut_if(U8CPU component, co
nst uint8_t*) { |
223 return component; | 223 return component; |
224 } | 224 } |
225 template<> /*static*/ inline U8CPU sk_apply_lut_if<true>(U8CPU component, const
uint8_t* lut) { | 225 template<> /*static*/ inline U8CPU sk_apply_lut_if<true>(U8CPU component, const
uint8_t* lut) { |
226 return lut[component]; | 226 return lut[component]; |
227 } | 227 } |
228 ///@} | 228 ///@} |
229 | 229 |
230 #endif | 230 #endif |
OLD | NEW |