| 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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 this->initModes(modes); | 48 this->initModes(modes); |
| 49 } | 49 } |
| 50 | 50 |
| 51 SkMergeImageFilter::~SkMergeImageFilter() { | 51 SkMergeImageFilter::~SkMergeImageFilter() { |
| 52 | 52 |
| 53 if (fModes != SkTCast<uint8_t*>(fStorage)) { | 53 if (fModes != SkTCast<uint8_t*>(fStorage)) { |
| 54 sk_free(fModes); | 54 sk_free(fModes); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, | 58 bool SkMergeImageFilter::onFilterImageDeprecated(Proxy* proxy, const SkBitmap& s
rc, |
| 59 const Context& ctx, | 59 const Context& ctx, |
| 60 SkBitmap* result, SkIPoint* offset) const
{ | 60 SkBitmap* result, SkIPoint* off
set) const { |
| 61 int inputCount = this->countInputs(); | 61 int inputCount = this->countInputs(); |
| 62 if (inputCount < 1) { | 62 if (inputCount < 1) { |
| 63 return false; | 63 return false; |
| 64 } | 64 } |
| 65 | 65 |
| 66 SkIRect bounds; | 66 SkIRect bounds; |
| 67 | 67 |
| 68 SkAutoTDeleteArray<SkBitmap> inputs(new SkBitmap[inputCount]); | 68 SkAutoTDeleteArray<SkBitmap> inputs(new SkBitmap[inputCount]); |
| 69 SkAutoTDeleteArray<SkIPoint> offsets(new SkIPoint[inputCount]); | 69 SkAutoTDeleteArray<SkIPoint> offsets(new SkIPoint[inputCount]); |
| 70 bool didProduceResult = false; | 70 bool didProduceResult = false; |
| 71 | 71 |
| 72 // Filter all of the inputs. | 72 // Filter all of the inputs. |
| 73 for (int i = 0; i < inputCount; ++i) { | 73 for (int i = 0; i < inputCount; ++i) { |
| 74 inputs[i] = src; | 74 inputs[i] = src; |
| 75 offsets[i].setZero(); | 75 offsets[i].setZero(); |
| 76 if (!this->filterInput(i, proxy, src, ctx, &inputs[i], &offsets[i])) { | 76 if (!this->filterInputDeprecated(i, proxy, src, ctx, &inputs[i], &offset
s[i])) { |
| 77 inputs[i].reset(); | 77 inputs[i].reset(); |
| 78 continue; | 78 continue; |
| 79 } | 79 } |
| 80 SkIRect srcBounds; | 80 SkIRect srcBounds; |
| 81 inputs[i].getBounds(&srcBounds); | 81 inputs[i].getBounds(&srcBounds); |
| 82 srcBounds.offset(offsets[i]); | 82 srcBounds.offset(offsets[i]); |
| 83 if (!didProduceResult) { | 83 if (!didProduceResult) { |
| 84 bounds = srcBounds; | 84 bounds = srcBounds; |
| 85 didProduceResult = true; | 85 didProduceResult = true; |
| 86 } else { | 86 } else { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 for (int i = 0; i < this->countInputs(); ++i) { | 164 for (int i = 0; i < this->countInputs(); ++i) { |
| 165 SkImageFilter* filter = this->getInput(i); | 165 SkImageFilter* filter = this->getInput(i); |
| 166 str->appendf("%d: (", i); | 166 str->appendf("%d: (", i); |
| 167 filter->toString(str); | 167 filter->toString(str); |
| 168 str->appendf(")"); | 168 str->appendf(")"); |
| 169 } | 169 } |
| 170 | 170 |
| 171 str->append(")"); | 171 str->append(")"); |
| 172 } | 172 } |
| 173 #endif | 173 #endif |
| OLD | NEW |