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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 /** | 187 /** |
188 * This copy contructor exists for correctness, but should never be called | 188 * This copy contructor exists for correctness, but should never be called |
189 * when return value optimization is enabled. | 189 * when return value optimization is enabled. |
190 */ | 190 */ |
191 SkTMaskPreBlend(const SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>& t
hat) | 191 SkTMaskPreBlend(const SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>& t
hat) |
192 : fParent(SkSafeRef(that.fParent.get())), fR(that.fR), fG(that.fG), fB(that.
fB) { } | 192 : fParent(SkSafeRef(that.fParent.get())), fR(that.fR), fG(that.fG), fB(that.
fB) { } |
193 | 193 |
194 ~SkTMaskPreBlend() { } | 194 ~SkTMaskPreBlend() { } |
195 | 195 |
196 /** True if this PreBlend should be applied. When false, fR, fG, and fB are
NULL. */ | 196 /** True if this PreBlend should be applied. When false, fR, fG, and fB are
NULL. */ |
197 bool isApplicable() const { | 197 bool isApplicable() const { return SkToBool(this->fG); } |
198 return NULL != this->fG; | |
199 } | |
200 | 198 |
201 const uint8_t* fR; | 199 const uint8_t* fR; |
202 const uint8_t* fG; | 200 const uint8_t* fG; |
203 const uint8_t* fB; | 201 const uint8_t* fB; |
204 }; | 202 }; |
205 | 203 |
206 template <int R_LUM_BITS, int G_LUM_BITS, int B_LUM_BITS> | 204 template <int R_LUM_BITS, int G_LUM_BITS, int B_LUM_BITS> |
207 SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS> | 205 SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS> |
208 SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>::preBlend(SkColor color) const
{ | 206 SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>::preBlend(SkColor color) const
{ |
209 return fIsLinear ? SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>() | 207 return fIsLinear ? SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>() |
(...skipping 13 matching lines...) Expand all Loading... |
223 */ | 221 */ |
224 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*) { |
225 return component; | 223 return component; |
226 } | 224 } |
227 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) { |
228 return lut[component]; | 226 return lut[component]; |
229 } | 227 } |
230 ///@} | 228 ///@} |
231 | 229 |
232 #endif | 230 #endif |
OLD | NEW |