| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, | 68 bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, |
| 69 const Context& ctx, | 69 const Context& ctx, |
| 70 SkBitmap* result, SkIPoint* offset) const
{ | 70 SkBitmap* result, SkIPoint* offset) const
{ |
| 71 if (countInputs() < 1) { | 71 if (countInputs() < 1) { |
| 72 return false; | 72 return false; |
| 73 } | 73 } |
| 74 | 74 |
| 75 SkIRect bounds; | 75 SkIRect bounds; |
| 76 src.getBounds(&bounds); | 76 if (!this->applyCropRect(ctx, src, SkIPoint::Make(0, 0), &bounds)) { |
| 77 if (!this->applyCropRect(&bounds, ctx.ctm())) { | |
| 78 return false; | 77 return false; |
| 79 } | 78 } |
| 80 | 79 |
| 81 const int x0 = bounds.left(); | 80 const int x0 = bounds.left(); |
| 82 const int y0 = bounds.top(); | 81 const int y0 = bounds.top(); |
| 83 | 82 |
| 84 SkAutoTUnref<SkBaseDevice> dst(proxy->createDevice(bounds.width(), bounds.he
ight())); | 83 SkAutoTUnref<SkBaseDevice> dst(proxy->createDevice(bounds.width(), bounds.he
ight())); |
| 85 if (NULL == dst) { | 84 if (NULL == dst) { |
| 86 return false; | 85 return false; |
| 87 } | 86 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 if (buffer.validate(buffer.getArrayCount() == size) && | 136 if (buffer.validate(buffer.getArrayCount() == size) && |
| 138 buffer.readByteArray(fModes, size)) { | 137 buffer.readByteArray(fModes, size)) { |
| 139 for (int i = 0; i < nbInputs; ++i) { | 138 for (int i = 0; i < nbInputs; ++i) { |
| 140 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i])); | 139 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i])); |
| 141 } | 140 } |
| 142 } | 141 } |
| 143 } else { | 142 } else { |
| 144 fModes = 0; | 143 fModes = 0; |
| 145 } | 144 } |
| 146 } | 145 } |
| OLD | NEW |