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

Unified Diff: src/core/SkImageFilter.cpp

Issue 1847583002: Update SkMergeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to To 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 | « samplecode/SampleFilterFuzz.cpp ('k') | src/core/SkLocalMatrixImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index e999d3aebb3ef885b0ea82926a11eb7319c76190..3b4ad314563217ded15baa1756d36f63ce7aa960 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -105,22 +105,14 @@ static int32_t next_image_filter_unique_id() {
return id;
}
-SkImageFilter::Common::~Common() {
- for (int i = 0; i < fInputs.count(); ++i) {
- SkSafeUnref(fInputs[i]);
- }
-}
-
void SkImageFilter::Common::allocInputs(int count) {
- const size_t size = count * sizeof(SkImageFilter*);
fInputs.reset(count);
- sk_bzero(fInputs.get(), size);
}
void SkImageFilter::Common::detachInputs(SkImageFilter** inputs) {
- const size_t size = fInputs.count() * sizeof(SkImageFilter*);
- memcpy(inputs, fInputs.get(), size);
- sk_bzero(fInputs.get(), size);
+ for (int i = 0; i < fInputs.count(); ++i) {
+ inputs[i] = fInputs[i].release();
+ }
}
bool SkImageFilter::Common::unflatten(SkReadBuffer& buffer, int expectedCount) {
@@ -135,7 +127,7 @@ bool SkImageFilter::Common::unflatten(SkReadBuffer& buffer, int expectedCount) {
this->allocInputs(count);
for (int i = 0; i < count; i++) {
if (buffer.readBool()) {
- fInputs[i] = buffer.readImageFilter();
+ fInputs[i] = sk_sp<SkImageFilter>(buffer.readImageFilter());
}
if (!buffer.isValid()) {
return false;
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | src/core/SkLocalMatrixImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698