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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 const Context& ctx, | 102 const Context& ctx, |
103 SkBitmap* result, | 103 SkBitmap* result, |
104 SkIPoint* offset) const { | 104 SkIPoint* offset) const { |
105 SkBitmap src = source; | 105 SkBitmap src = source; |
106 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 106 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
107 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO
ffset)) { | 107 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO
ffset)) { |
108 return false; | 108 return false; |
109 } | 109 } |
110 | 110 |
111 SkIRect bounds; | 111 SkIRect bounds; |
112 src.getBounds(&bounds); | 112 if (!this->applyCropRect(ctx, src, srcOffset, &bounds)) { |
113 bounds.offset(srcOffset); | |
114 if (!this->applyCropRect(&bounds, ctx.ctm())) { | |
115 return false; | 113 return false; |
116 } | 114 } |
117 | 115 |
118 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); | 116 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds
.height())); |
119 if (NULL == device.get()) { | 117 if (NULL == device.get()) { |
120 return false; | 118 return false; |
121 } | 119 } |
122 SkCanvas canvas(device.get()); | 120 SkCanvas canvas(device.get()); |
123 SkPaint paint; | 121 SkPaint paint; |
124 | 122 |
(...skipping 10 matching lines...) Expand all Loading... |
135 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { | 133 bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { |
136 if (!cropRectIsSet()) { | 134 if (!cropRectIsSet()) { |
137 if (filter) { | 135 if (filter) { |
138 *filter = fColorFilter; | 136 *filter = fColorFilter; |
139 fColorFilter->ref(); | 137 fColorFilter->ref(); |
140 } | 138 } |
141 return true; | 139 return true; |
142 } | 140 } |
143 return false; | 141 return false; |
144 } | 142 } |
OLD | NEW |