OLD | NEW |
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" |
11 #include "SkReadBuffer.h" | 11 #include "SkReadBuffer.h" |
12 #include "SkSpecialImage.h" | 12 #include "SkSpecialImage.h" |
13 #include "SkSpecialSurface.h" | 13 #include "SkSpecialSurface.h" |
14 #include "SkWriteBuffer.h" | 14 #include "SkWriteBuffer.h" |
15 #include "SkValidationUtils.h" | 15 #include "SkValidationUtils.h" |
16 | 16 |
| 17 sk_sp<SkImageFilter> SkMergeImageFilter::Make(sk_sp<SkImageFilter> first, |
| 18 sk_sp<SkImageFilter> second, |
| 19 SkXfermode::Mode mode, |
| 20 const CropRect* cropRect) { |
| 21 sk_sp<SkImageFilter> inputs[2] = { first, second }; |
| 22 SkXfermode::Mode modes[2] = { mode, mode }; |
| 23 return sk_sp<SkImageFilter>(new SkMergeImageFilter(inputs, 2, modes, cropRec
t)); |
| 24 } |
| 25 |
| 26 sk_sp<SkImageFilter> SkMergeImageFilter::Make(sk_sp<SkImageFilter> filters[], |
| 27 int count, |
| 28 const SkXfermode::Mode modes[], |
| 29 const CropRect* cropRect) { |
| 30 return sk_sp<SkImageFilter>(new SkMergeImageFilter(filters, count, modes, cr
opRect)); |
| 31 } |
| 32 |
17 /////////////////////////////////////////////////////////////////////////////// | 33 /////////////////////////////////////////////////////////////////////////////// |
18 | 34 |
19 void SkMergeImageFilter::initAllocModes() { | 35 void SkMergeImageFilter::initAllocModes() { |
20 int inputCount = this->countInputs(); | 36 int inputCount = this->countInputs(); |
21 if (inputCount) { | 37 if (inputCount) { |
22 size_t size = sizeof(uint8_t) * inputCount; | 38 size_t size = sizeof(uint8_t) * inputCount; |
23 if (size <= sizeof(fStorage)) { | 39 if (size <= sizeof(fStorage)) { |
24 fModes = SkTCast<uint8_t*>(fStorage); | 40 fModes = SkTCast<uint8_t*>(fStorage); |
25 } else { | 41 } else { |
26 fModes = SkTCast<uint8_t*>(sk_malloc_throw(size)); | 42 fModes = SkTCast<uint8_t*>(sk_malloc_throw(size)); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 for (int i = 0; i < this->countInputs(); ++i) { | 188 for (int i = 0; i < this->countInputs(); ++i) { |
173 SkImageFilter* filter = this->getInput(i); | 189 SkImageFilter* filter = this->getInput(i); |
174 str->appendf("%d: (", i); | 190 str->appendf("%d: (", i); |
175 filter->toString(str); | 191 filter->toString(str); |
176 str->appendf(")"); | 192 str->appendf(")"); |
177 } | 193 } |
178 | 194 |
179 str->append(")"); | 195 str->append(")"); |
180 } | 196 } |
181 #endif | 197 #endif |
OLD | NEW |