OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 "SkComposeImageFilter.h" | 8 #include "SkComposeImageFilter.h" |
9 | 9 |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
11 #include "SkSpecialImage.h" | 11 #include "SkSpecialImage.h" |
12 #include "SkWriteBuffer.h" | 12 #include "SkWriteBuffer.h" |
13 | 13 |
| 14 sk_sp<SkImageFilter> SkComposeImageFilter::Make(sk_sp<SkImageFilter> outer, |
| 15 sk_sp<SkImageFilter> inner) { |
| 16 if (!outer) { |
| 17 return inner; |
| 18 } |
| 19 if (!inner) { |
| 20 return outer; |
| 21 } |
| 22 sk_sp<SkImageFilter> inputs[2] = { std::move(outer), std::move(inner) }; |
| 23 return sk_sp<SkImageFilter>(new SkComposeImageFilter(inputs)); |
| 24 } |
14 | 25 |
15 SkRect SkComposeImageFilter::computeFastBounds(const SkRect& src) const { | 26 SkRect SkComposeImageFilter::computeFastBounds(const SkRect& src) const { |
16 SkImageFilter* outer = this->getInput(0); | 27 SkImageFilter* outer = this->getInput(0); |
17 SkImageFilter* inner = this->getInput(1); | 28 SkImageFilter* inner = this->getInput(1); |
18 | 29 |
19 return outer->computeFastBounds(inner->computeFastBounds(src)); | 30 return outer->computeFastBounds(inner->computeFastBounds(src)); |
20 } | 31 } |
21 | 32 |
22 sk_sp<SkSpecialImage> SkComposeImageFilter::onFilterImage(SkSpecialImage* source
, | 33 sk_sp<SkSpecialImage> SkComposeImageFilter::onFilterImage(SkSpecialImage* source
, |
23 const Context& ctx, | 34 const Context& ctx, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 83 |
73 str->appendf("outer: "); | 84 str->appendf("outer: "); |
74 outer->toString(str); | 85 outer->toString(str); |
75 | 86 |
76 str->appendf("inner: "); | 87 str->appendf("inner: "); |
77 inner->toString(str); | 88 inner->toString(str); |
78 | 89 |
79 str->appendf(")"); | 90 str->appendf(")"); |
80 } | 91 } |
81 #endif | 92 #endif |
OLD | NEW |