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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkComposeImageFilter.h" | 9 #include "SkComposeImageFilter.h" |
10 #include "SkFlattenableBuffers.h" | 10 #include "SkFlattenableBuffers.h" |
11 | 11 |
12 SkComposeImageFilter::~SkComposeImageFilter() { | 12 SkComposeImageFilter::~SkComposeImageFilter() { |
13 } | 13 } |
14 | 14 |
15 bool SkComposeImageFilter::onFilterImage(Proxy* proxy, | 15 bool SkComposeImageFilter::onFilterImage(Proxy* proxy, |
16 const SkBitmap& src, | 16 const SkBitmap& src, |
17 const SkMatrix& ctm, | 17 const SkMatrix& ctm, |
18 SkBitmap* result, | 18 SkBitmap* result, |
19 SkIPoint* loc) { | 19 SkIPoint* offset) { |
20 SkImageFilter* outer = getInput(0); | 20 SkImageFilter* outer = getInput(0); |
21 SkImageFilter* inner = getInput(1); | 21 SkImageFilter* inner = getInput(1); |
22 | 22 |
23 if (!outer && !inner) { | 23 if (!outer && !inner) { |
24 return false; | 24 return false; |
25 } | 25 } |
26 | 26 |
27 if (!outer || !inner) { | 27 if (!outer || !inner) { |
28 return (outer ? outer : inner)->filterImage(proxy, src, ctm, result, loc
); | 28 return (outer ? outer : inner)->filterImage(proxy, src, ctm, result, off
set); |
29 } | 29 } |
30 | 30 |
31 SkBitmap tmp; | 31 SkBitmap tmp; |
32 return inner->filterImage(proxy, src, ctm, &tmp, loc) && | 32 return inner->filterImage(proxy, src, ctm, &tmp, offset) && |
33 outer->filterImage(proxy, tmp, ctm, result, loc); | 33 outer->filterImage(proxy, tmp, ctm, result, offset); |
34 } | 34 } |
35 | 35 |
36 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, | 36 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, |
37 const SkMatrix& ctm, | 37 const SkMatrix& ctm, |
38 SkIRect* dst) { | 38 SkIRect* dst) { |
39 SkImageFilter* outer = getInput(0); | 39 SkImageFilter* outer = getInput(0); |
40 SkImageFilter* inner = getInput(1); | 40 SkImageFilter* inner = getInput(1); |
41 | 41 |
42 if (!outer && !inner) { | 42 if (!outer && !inner) { |
43 return false; | 43 return false; |
44 } | 44 } |
45 | 45 |
46 if (!outer || !inner) { | 46 if (!outer || !inner) { |
47 return (outer ? outer : inner)->filterBounds(src, ctm, dst); | 47 return (outer ? outer : inner)->filterBounds(src, ctm, dst); |
48 } | 48 } |
49 | 49 |
50 SkIRect tmp; | 50 SkIRect tmp; |
51 return inner->filterBounds(src, ctm, &tmp) && | 51 return inner->filterBounds(src, ctm, &tmp) && |
52 outer->filterBounds(tmp, ctm, dst); | 52 outer->filterBounds(tmp, ctm, dst); |
53 } | 53 } |
54 | 54 |
55 SkComposeImageFilter::SkComposeImageFilter(SkFlattenableReadBuffer& buffer) | 55 SkComposeImageFilter::SkComposeImageFilter(SkFlattenableReadBuffer& buffer) |
56 : INHERITED(2, buffer) { | 56 : INHERITED(2, buffer) { |
57 } | 57 } |
OLD | NEW |