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

Side by Side Diff: src/effects/SkMergeImageFilter.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, 8 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/SkMatrixConvolutionImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.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 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkMergeImageFilter.h" 8 #include "SkMergeImageFilter.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 24 matching lines...) Expand all
35 this->initAllocModes(); 35 this->initAllocModes();
36 int inputCount = this->countInputs(); 36 int inputCount = this->countInputs();
37 for (int i = 0; i < inputCount; ++i) { 37 for (int i = 0; i < inputCount; ++i) {
38 fModes[i] = SkToU8(modes[i]); 38 fModes[i] = SkToU8(modes[i]);
39 } 39 }
40 } else { 40 } else {
41 fModes = nullptr; 41 fModes = nullptr;
42 } 42 }
43 } 43 }
44 44
45 SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* filters[], int count, 45 SkMergeImageFilter::SkMergeImageFilter(sk_sp<SkImageFilter> filters[], int count ,
46 const SkXfermode::Mode modes[], 46 const SkXfermode::Mode modes[],
47 const CropRect* cropRect) 47 const CropRect* cropRect)
48 : INHERITED(count, filters, cropRect) { 48 : INHERITED(filters, count, cropRect) {
49 SkASSERT(count >= 0); 49 SkASSERT(count >= 0);
50 this->initModes(modes); 50 this->initModes(modes);
51 } 51 }
52 52
53 SkMergeImageFilter::~SkMergeImageFilter() { 53 SkMergeImageFilter::~SkMergeImageFilter() {
54 54
55 if (fModes != SkTCast<uint8_t*>(fStorage)) { 55 if (fModes != SkTCast<uint8_t*>(fStorage)) {
56 sk_free(fModes); 56 sk_free(fModes);
57 } 57 }
58 } 58 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 if (!buffer.readByteArray(modes8.get(), count)) { 142 if (!buffer.readByteArray(modes8.get(), count)) {
143 return nullptr; 143 return nullptr;
144 } 144 }
145 for (int i = 0; i < count; ++i) { 145 for (int i = 0; i < count; ++i) {
146 modes[i] = (SkXfermode::Mode)modes8[i]; 146 modes[i] = (SkXfermode::Mode)modes8[i];
147 buffer.validate(SkIsValidMode(modes[i])); 147 buffer.validate(SkIsValidMode(modes[i]));
148 } 148 }
149 if (!buffer.isValid()) { 149 if (!buffer.isValid()) {
150 return nullptr; 150 return nullptr;
151 } 151 }
152 return Create(common.inputs(), count, modes.get(), &common.cropRect()); 152 return Make(common.inputs(), count, modes.get(), &common.cropRect()).rel ease();
153 } 153 }
154 return Create(common.inputs(), count, nullptr, &common.cropRect()); 154 return Make(common.inputs(), count, nullptr, &common.cropRect()).release();
155 } 155 }
156 156
157 void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const { 157 void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const {
158 this->INHERITED::flatten(buffer); 158 this->INHERITED::flatten(buffer);
159 buffer.writeBool(fModes != nullptr); 159 buffer.writeBool(fModes != nullptr);
160 if (fModes) { 160 if (fModes) {
161 buffer.writeByteArray(fModes, this->countInputs() * sizeof(fModes[0])); 161 buffer.writeByteArray(fModes, this->countInputs() * sizeof(fModes[0]));
162 } 162 }
163 } 163 }
164 164
165 #ifndef SK_IGNORE_TO_STRING 165 #ifndef SK_IGNORE_TO_STRING
166 void SkMergeImageFilter::toString(SkString* str) const { 166 void SkMergeImageFilter::toString(SkString* str) const {
167 str->appendf("SkMergeImageFilter: ("); 167 str->appendf("SkMergeImageFilter: (");
168 168
169 for (int i = 0; i < this->countInputs(); ++i) { 169 for (int i = 0; i < this->countInputs(); ++i) {
170 SkImageFilter* filter = this->getInput(i); 170 SkImageFilter* filter = this->getInput(i);
171 str->appendf("%d: (", i); 171 str->appendf("%d: (", i);
172 filter->toString(str); 172 filter->toString(str);
173 str->appendf(")"); 173 str->appendf(")");
174 } 174 }
175 175
176 str->append(")"); 176 str->append(")");
177 } 177 }
178 #endif 178 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698