OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkLumaColorFilter.h" | 8 #include "SkLumaColorFilter.h" |
9 | 9 |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 * LumA = (k1 * r / a + k2 * g / a + k3 * b / a) * a | 30 * LumA = (k1 * r / a + k2 * g / a + k3 * b / a) * a |
31 * LumA = (k1 * r + k2 * g + k3 * b) | 31 * LumA = (k1 * r + k2 * g + k3 * b) |
32 */ | 32 */ |
33 unsigned luma = SkComputeLuminance(SkGetPackedR32(c), | 33 unsigned luma = SkComputeLuminance(SkGetPackedR32(c), |
34 SkGetPackedG32(c), | 34 SkGetPackedG32(c), |
35 SkGetPackedB32(c)); | 35 SkGetPackedB32(c)); |
36 dst[i] = SkPackARGB32(luma, 0, 0, 0); | 36 dst[i] = SkPackARGB32(luma, 0, 0, 0); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 SkColorFilter* SkLumaColorFilter::Create() { return new SkLumaColorFilter; } | 40 sk_sp<SkColorFilter> SkLumaColorFilter::Make() { |
| 41 return sk_sp<SkColorFilter>(new SkLumaColorFilter); |
| 42 } |
41 | 43 |
42 SkLumaColorFilter::SkLumaColorFilter() : INHERITED() {} | 44 SkLumaColorFilter::SkLumaColorFilter() : INHERITED() {} |
43 | 45 |
44 SkFlattenable* SkLumaColorFilter::CreateProc(SkReadBuffer&) { return new SkLumaC
olorFilter; } | 46 SkFlattenable* SkLumaColorFilter::CreateProc(SkReadBuffer&) { return new SkLumaC
olorFilter; } |
45 | 47 |
46 void SkLumaColorFilter::flatten(SkWriteBuffer&) const {} | 48 void SkLumaColorFilter::flatten(SkWriteBuffer&) const {} |
47 | 49 |
48 #ifndef SK_IGNORE_TO_STRING | 50 #ifndef SK_IGNORE_TO_STRING |
49 void SkLumaColorFilter::toString(SkString* str) const { | 51 void SkLumaColorFilter::toString(SkString* str) const { |
50 str->append("SkLumaColorFilter "); | 52 str->append("SkLumaColorFilter "); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0
), | 107 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0
), |
106 GrInvariantOutput::kWill_ReadInput); | 108 GrInvariantOutput::kWill_ReadInput); |
107 } | 109 } |
108 }; | 110 }; |
109 | 111 |
110 const GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) co
nst { | 112 const GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) co
nst { |
111 | 113 |
112 return LumaColorFilterEffect::Create(); | 114 return LumaColorFilterEffect::Create(); |
113 } | 115 } |
114 #endif | 116 #endif |
OLD | NEW |