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 "SkColorFilterImageFilter.h" | 8 #include "SkColorFilterImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const Context& ctx, | 59 const Context& ctx, |
60 SkBitmap* result, | 60 SkBitmap* result, |
61 SkIPoint* offset) const { | 61 SkIPoint* offset) const { |
62 SkBitmap src = source; | 62 SkBitmap src = source; |
63 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 63 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
64 if (!this->filterInput(0, proxy, source, ctx, &src, &srcOffset)) { | 64 if (!this->filterInput(0, proxy, source, ctx, &src, &srcOffset)) { |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 SkIRect bounds; | 68 SkIRect bounds; |
69 if (!this->applyCropRect(ctx, src, srcOffset, &bounds)) { | 69 SkIRect srcBounds = src.bounds(); |
| 70 srcBounds.offset(srcOffset); |
| 71 if (!this->applyCropRect(ctx, srcBounds, &bounds)) { |
70 return false; | 72 return false; |
71 } | 73 } |
72 | 74 |
73 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); | 75 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); |
74 if (nullptr == device.get()) { | 76 if (nullptr == device.get()) { |
75 return false; | 77 return false; |
76 } | 78 } |
77 SkCanvas canvas(device.get()); | 79 SkCanvas canvas(device.get()); |
78 SkPaint paint; | 80 SkPaint paint; |
79 | 81 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (this->getInput(0)) { | 117 if (this->getInput(0)) { |
116 this->getInput(0)->toString(str); | 118 this->getInput(0)->toString(str); |
117 } | 119 } |
118 | 120 |
119 str->appendf(") color filter: "); | 121 str->appendf(") color filter: "); |
120 fColorFilter->toString(str); | 122 fColorFilter->toString(str); |
121 | 123 |
122 str->append(")"); | 124 str->append(")"); |
123 } | 125 } |
124 #endif | 126 #endif |
OLD | NEW |