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" |
(...skipping 17 matching lines...) Expand all Loading... |
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->filterInput(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 Context outerContext(outerMatrix, ctx.clipBounds(), ctx.cache(), ctx.sizeCon
straint()); | 38 SkIRect clipBounds = ctx.clipBounds(); |
| 39 clipBounds.offset(-innerOffset.x(), -innerOffset.y()); |
| 40 Context outerContext(outerMatrix, clipBounds, ctx.cache(), ctx.sizeConstrain
t()); |
39 if (!this->filterInput(0, proxy, tmp, outerContext, result, &outerOffset, fa
lse)) { | 41 if (!this->filterInput(0, proxy, tmp, outerContext, result, &outerOffset, fa
lse)) { |
40 return false; | 42 return false; |
41 } | 43 } |
42 | 44 |
43 *offset = innerOffset + outerOffset; | 45 *offset = innerOffset + outerOffset; |
44 return true; | 46 return true; |
45 } | 47 } |
46 | 48 |
47 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, | 49 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, |
48 const SkMatrix& ctm, | 50 const SkMatrix& ctm, |
(...skipping 19 matching lines...) Expand all Loading... |
68 | 70 |
69 str->appendf("outer: "); | 71 str->appendf("outer: "); |
70 outer->toString(str); | 72 outer->toString(str); |
71 | 73 |
72 str->appendf("inner: "); | 74 str->appendf("inner: "); |
73 inner->toString(str); | 75 inner->toString(str); |
74 | 76 |
75 str->appendf(")"); | 77 str->appendf(")"); |
76 } | 78 } |
77 #endif | 79 #endif |
OLD | NEW |