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