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" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 const SkIRect inputBounds = SkIRect::MakeXYWH(offsets[i].fX, offsets[i].
fY, | 80 const SkIRect inputBounds = SkIRect::MakeXYWH(offsets[i].fX, offsets[i].
fY, |
81 inputs[i]->width(), inputs
[i]->height()); | 81 inputs[i]->width(), inputs
[i]->height()); |
82 bounds.join(inputBounds); | 82 bounds.join(inputBounds); |
83 } | 83 } |
84 if (bounds.isEmpty()) { | 84 if (bounds.isEmpty()) { |
85 return nullptr; | 85 return nullptr; |
86 } | 86 } |
87 | 87 |
88 // Apply the crop rect to the union of the inputs' bounds. | 88 // Apply the crop rect to the union of the inputs' bounds. |
89 this->getCropRect().applyTo(bounds, ctx.ctm(), &bounds); | 89 // Note that the crop rect can only reduce the bounds, since this |
| 90 // filter does not affect transparent black. |
| 91 bool embiggen = false; |
| 92 this->getCropRect().applyTo(bounds, ctx.ctm(), embiggen, &bounds); |
90 if (!bounds.intersect(ctx.clipBounds())) { | 93 if (!bounds.intersect(ctx.clipBounds())) { |
91 return nullptr; | 94 return nullptr; |
92 } | 95 } |
93 | 96 |
94 const int x0 = bounds.left(); | 97 const int x0 = bounds.left(); |
95 const int y0 = bounds.top(); | 98 const int y0 = bounds.top(); |
96 | 99 |
97 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), | 100 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), |
98 kPremul_SkAlphaType); | 101 kPremul_SkAlphaType); |
99 | 102 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 for (int i = 0; i < this->countInputs(); ++i) { | 172 for (int i = 0; i < this->countInputs(); ++i) { |
170 SkImageFilter* filter = this->getInput(i); | 173 SkImageFilter* filter = this->getInput(i); |
171 str->appendf("%d: (", i); | 174 str->appendf("%d: (", i); |
172 filter->toString(str); | 175 filter->toString(str); |
173 str->appendf(")"); | 176 str->appendf(")"); |
174 } | 177 } |
175 | 178 |
176 str->append(")"); | 179 str->append(")"); |
177 } | 180 } |
178 #endif | 181 #endif |
OLD | NEW |