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 "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
11 #include "SkWriteBuffer.h" | 11 #include "SkWriteBuffer.h" |
12 | 12 |
13 SkComposeImageFilter::~SkComposeImageFilter() { | 13 SkComposeImageFilter::~SkComposeImageFilter() { |
14 } | 14 } |
15 | 15 |
16 void SkComposeImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) con
st { | 16 void SkComposeImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) con
st { |
17 SkImageFilter* outer = getInput(0); | 17 SkImageFilter* outer = getInput(0); |
18 SkImageFilter* inner = getInput(1); | 18 SkImageFilter* inner = getInput(1); |
19 | 19 |
20 SkRect tmp; | 20 SkRect tmp; |
21 inner->computeFastBounds(src, &tmp); | 21 inner->computeFastBounds(src, &tmp); |
22 outer->computeFastBounds(tmp, dst); | 22 outer->computeFastBounds(tmp, dst); |
23 } | 23 } |
24 | 24 |
25 bool SkComposeImageFilter::onFilterImage(Proxy* proxy, | 25 bool SkComposeImageFilter::onFilterImageDeprecated(Proxy* proxy, |
26 const SkBitmap& src, | 26 const SkBitmap& src, |
27 const Context& ctx, | 27 const Context& ctx, |
28 SkBitmap* result, | 28 SkBitmap* result, |
29 SkIPoint* offset) const { | 29 SkIPoint* offset) const { |
30 SkBitmap tmp; | 30 SkBitmap tmp; |
31 SkIPoint innerOffset = SkIPoint::Make(0, 0); | 31 SkIPoint innerOffset = SkIPoint::Make(0, 0); |
32 SkIPoint outerOffset = SkIPoint::Make(0, 0); | 32 SkIPoint outerOffset = SkIPoint::Make(0, 0); |
33 if (!this->filterInput(1, proxy, src, ctx, &tmp, &innerOffset)) | 33 if (!this->filterInputDeprecated(1, proxy, src, ctx, &tmp, &innerOffset)) |
34 return false; | 34 return false; |
35 | 35 |
36 SkMatrix outerMatrix(ctx.ctm()); | 36 SkMatrix outerMatrix(ctx.ctm()); |
37 outerMatrix.postTranslate(SkIntToScalar(-innerOffset.x()), SkIntToScalar(-in
nerOffset.y())); | 37 outerMatrix.postTranslate(SkIntToScalar(-innerOffset.x()), SkIntToScalar(-in
nerOffset.y())); |
38 SkIRect clipBounds = ctx.clipBounds(); | 38 SkIRect clipBounds = ctx.clipBounds(); |
39 clipBounds.offset(-innerOffset.x(), -innerOffset.y()); | 39 clipBounds.offset(-innerOffset.x(), -innerOffset.y()); |
40 Context outerContext(outerMatrix, clipBounds, ctx.cache()); | 40 Context outerContext(outerMatrix, clipBounds, ctx.cache()); |
41 if (!this->filterInput(0, proxy, tmp, outerContext, result, &outerOffset)) { | 41 if (!this->filterInputDeprecated(0, proxy, tmp, outerContext, result, &outer
Offset)) { |
42 return false; | 42 return false; |
43 } | 43 } |
44 | 44 |
45 *offset = innerOffset + outerOffset; | 45 *offset = innerOffset + outerOffset; |
46 return true; | 46 return true; |
47 } | 47 } |
48 | 48 |
49 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, | 49 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, |
50 const SkMatrix& ctm, | 50 const SkMatrix& ctm, |
51 SkIRect* dst, | 51 SkIRect* dst, |
(...skipping 20 matching lines...) Expand all Loading... |
72 | 72 |
73 str->appendf("outer: "); | 73 str->appendf("outer: "); |
74 outer->toString(str); | 74 outer->toString(str); |
75 | 75 |
76 str->appendf("inner: "); | 76 str->appendf("inner: "); |
77 inner->toString(str); | 77 inner->toString(str); |
78 | 78 |
79 str->appendf(")"); | 79 str->appendf(")"); |
80 } | 80 } |
81 #endif | 81 #endif |
OLD | NEW |