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

Unified Diff: src/effects/SkTableColorFilter.cpp

Issue 1822623002: switch colorfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkTableColorFilter.cpp
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 5ae175ffca7822f43c40c83206d11465249950c5..4ce0b4bb0ee4fb0e4b4b0678a64269634176e520 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -46,7 +46,7 @@ public:
virtual ~SkTable_ColorFilter() { delete fBitmap; }
bool asComponentTable(SkBitmap* table) const override;
- SkColorFilter* newComposed(const SkColorFilter* inner) const override;
+ sk_sp<SkColorFilter> makeComposed(sk_sp<SkColorFilter> inner) const override;
#if SK_SUPPORT_GPU
const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override;
@@ -251,7 +251,7 @@ SkFlattenable* SkTable_ColorFilter::CreateProc(SkReadBuffer& buffer) {
b = ptr;
ptr += 256;
}
- return SkTableColorFilter::CreateARGB(a, r, g, b);
+ return SkTableColorFilter::MakeARGB(a, r, g, b).release();
}
bool SkTable_ColorFilter::asComponentTable(SkBitmap* table) const {
@@ -287,7 +287,7 @@ static void combine_tables(uint8_t res[256], const uint8_t outer[256], const uin
}
}
-SkColorFilter* SkTable_ColorFilter::newComposed(const SkColorFilter* innerFilter) const {
+sk_sp<SkColorFilter> SkTable_ColorFilter::makeComposed(sk_sp<SkColorFilter> innerFilter) const {
SkBitmap innerBM;
if (!innerFilter->asComponentTable(&innerBM)) {
return nullptr;
@@ -326,7 +326,7 @@ SkColorFilter* SkTable_ColorFilter::newComposed(const SkColorFilter* innerFilter
combine_tables(concatG, tableG, innerBM.getAddr8(0, 2));
combine_tables(concatB, tableB, innerBM.getAddr8(0, 3));
- return SkTableColorFilter::CreateARGB(concatA, concatR, concatG, concatB);
+ return SkTableColorFilter::MakeARGB(concatA, concatR, concatG, concatB);
}
#if SK_SUPPORT_GPU
@@ -554,7 +554,7 @@ const GrFragmentProcessor* ColorTableEffect::TestCreate(GrProcessorTestData* d)
}
}
}
- SkAutoTUnref<SkColorFilter> filter(SkTableColorFilter::CreateARGB(
+ auto filter(SkTableColorFilter::MakeARGB(
(flags & (1 << 0)) ? luts[0] : nullptr,
(flags & (1 << 1)) ? luts[1] : nullptr,
(flags & (1 << 2)) ? luts[2] : nullptr,
@@ -587,15 +587,15 @@ const GrFragmentProcessor* SkTable_ColorFilter::asFragmentProcessor(GrContext* c
///////////////////////////////////////////////////////////////////////////////
-SkColorFilter* SkTableColorFilter::Create(const uint8_t table[256]) {
- return new SkTable_ColorFilter(table, table, table, table);
+sk_sp<SkColorFilter> SkTableColorFilter::Make(const uint8_t table[256]) {
+ return sk_make_sp<SkTable_ColorFilter>(table, table, table, table);
}
-SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256],
- const uint8_t tableR[256],
- const uint8_t tableG[256],
- const uint8_t tableB[256]) {
- return new SkTable_ColorFilter(tableA, tableR, tableG, tableB);
+sk_sp<SkColorFilter> SkTableColorFilter::MakeARGB(const uint8_t tableA[256],
+ const uint8_t tableR[256],
+ const uint8_t tableG[256],
+ const uint8_t tableB[256]) {
+ return sk_make_sp<SkTable_ColorFilter>(tableA, tableR, tableG, tableB);
}
SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter)
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698