| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 SkAutoTDeleteArray<sk_sp<SkSpecialImage>> inputs(new sk_sp<SkSpecialImage>[i
nputCount]); | 70 SkAutoTDeleteArray<sk_sp<SkSpecialImage>> inputs(new sk_sp<SkSpecialImage>[i
nputCount]); |
| 71 SkAutoTDeleteArray<SkIPoint> offsets(new SkIPoint[inputCount]); | 71 SkAutoTDeleteArray<SkIPoint> offsets(new SkIPoint[inputCount]); |
| 72 | 72 |
| 73 // Filter all of the inputs. | 73 // Filter all of the inputs. |
| 74 for (int i = 0; i < inputCount; ++i) { | 74 for (int i = 0; i < inputCount; ++i) { |
| 75 offsets[i].setZero(); | 75 offsets[i].setZero(); |
| 76 inputs[i] = this->filterInput(i, source, ctx, &offsets[i]); | 76 inputs[i] = this->filterInput(i, source, ctx, &offsets[i]); |
| 77 if (!inputs[i]) { | 77 if (!inputs[i]) { |
| 78 continue; | 78 continue; |
| 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 this->getCropRect().applyTo(bounds, ctx.ctm(), &bounds); |
| 90 if (!bounds.intersect(ctx.clipBounds())) { | 90 if (!bounds.intersect(ctx.clipBounds())) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 this->INHERITED::flatten(buffer); | 158 this->INHERITED::flatten(buffer); |
| 159 buffer.writeBool(fModes != nullptr); | 159 buffer.writeBool(fModes != nullptr); |
| 160 if (fModes) { | 160 if (fModes) { |
| 161 buffer.writeByteArray(fModes, this->countInputs() * sizeof(fModes[0])); | 161 buffer.writeByteArray(fModes, this->countInputs() * sizeof(fModes[0])); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 #ifndef SK_IGNORE_TO_STRING | 165 #ifndef SK_IGNORE_TO_STRING |
| 166 void SkMergeImageFilter::toString(SkString* str) const { | 166 void SkMergeImageFilter::toString(SkString* str) const { |
| 167 str->appendf("SkMergeImageFilter: ("); | 167 str->appendf("SkMergeImageFilter: ("); |
| 168 | 168 |
| 169 for (int i = 0; i < this->countInputs(); ++i) { | 169 for (int i = 0; i < this->countInputs(); ++i) { |
| 170 SkImageFilter* filter = this->getInput(i); | 170 SkImageFilter* filter = this->getInput(i); |
| 171 str->appendf("%d: (", i); | 171 str->appendf("%d: (", i); |
| 172 filter->toString(str); | 172 filter->toString(str); |
| 173 str->appendf(")"); | 173 str->appendf(")"); |
| 174 } | 174 } |
| 175 | 175 |
| 176 str->append(")"); | 176 str->append(")"); |
| 177 } | 177 } |
| 178 #endif | 178 #endif |
| OLD | NEW |