diff options
author | robertphillips <robertphillips@google.com> | 2016-03-30 13:34:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-30 13:34:17 -0700 |
commit | 2238c9dbca4b791edc512957728a18ce14d55912 (patch) | |
tree | 684102215b697506f7c2dce012bb89183467e208 /src/core | |
parent | 3243143f25f4ccba632847574cf8e1a8ee0fe0f2 (diff) |
Update SkMergeImageFilter to sk_sp
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1847583002
Review URL: https://codereview.chromium.org/1847583002
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkImageFilter.cpp | 16 | ||||
-rw-r--r-- | src/core/SkLocalMatrixImageFilter.cpp | 3 | ||||
-rw-r--r-- | src/core/SkMatrixImageFilter.cpp | 2 |
3 files changed, 6 insertions, 15 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index e999d3aebb..3b4ad31456 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; diff --git a/src/core/SkLocalMatrixImageFilter.cpp b/src/core/SkLocalMatrixImageFilter.cpp index d1b5715b7f..bf29bd235b 100644 --- a/src/core/SkLocalMatrixImageFilter.cpp +++ b/src/core/SkLocalMatrixImageFilter.cpp @@ -20,8 +20,7 @@ SkFlattenable* SkLocalMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); SkMatrix lm; buffer.readMatrix(&lm); - return SkLocalMatrixImageFilter::Make(lm, - sk_ref_sp<SkImageFilter>(common.getInput(0))).release(); + return SkLocalMatrixImageFilter::Make(lm, common.getInput(0)).release(); } void SkLocalMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { diff --git a/src/core/SkMatrixImageFilter.cpp b/src/core/SkMatrixImageFilter.cpp index ec221fdcac..b8f510f91c 100644 --- a/src/core/SkMatrixImageFilter.cpp +++ b/src/core/SkMatrixImageFilter.cpp @@ -34,7 +34,7 @@ SkFlattenable* SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { SkMatrix matrix; buffer.readMatrix(&matrix); SkFilterQuality quality = static_cast<SkFilterQuality>(buffer.readInt()); - return Create(matrix, quality, common.getInput(0)); + return Create(matrix, quality, common.getInput(0).get()); } void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { |