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

Side by Side Diff: src/effects/SkLumaColorFilter.cpp

Issue 1827433002: Reland of [2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « src/effects/SkLayerDrawLooper.cpp ('k') | src/effects/SkTableColorFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/effects/SkLayerDrawLooper.cpp ('k') | src/effects/SkTableColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698