OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 paint = &looper.paint(); | 1157 paint = &looper.paint(); |
1158 SkImageFilter* filter = paint->getImageFilter(); | 1158 SkImageFilter* filter = paint->getImageFilter(); |
1159 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; | 1159 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; |
1160 if (filter && !dstDev->canHandleImageFilter(filter)) { | 1160 if (filter && !dstDev->canHandleImageFilter(filter)) { |
1161 SkDeviceImageFilterProxy proxy(dstDev); | 1161 SkDeviceImageFilterProxy proxy(dstDev); |
1162 SkBitmap dst; | 1162 SkBitmap dst; |
1163 SkIPoint offset = SkIPoint::Make(0, 0); | 1163 SkIPoint offset = SkIPoint::Make(0, 0); |
1164 const SkBitmap& src = srcDev->accessBitmap(false); | 1164 const SkBitmap& src = srcDev->accessBitmap(false); |
1165 SkMatrix matrix = *iter.fMatrix; | 1165 SkMatrix matrix = *iter.fMatrix; |
1166 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); | 1166 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
1167 if (filter->filterImage(&proxy, src, matrix, &dst, &offset)) { | 1167 SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height
()); |
| 1168 SkImageFilter::Context ctx(matrix, clipBounds); |
| 1169 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) { |
1168 SkPaint tmpUnfiltered(*paint); | 1170 SkPaint tmpUnfiltered(*paint); |
1169 tmpUnfiltered.setImageFilter(NULL); | 1171 tmpUnfiltered.setImageFilter(NULL); |
1170 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of
fset.y(), | 1172 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of
fset.y(), |
1171 tmpUnfiltered); | 1173 tmpUnfiltered); |
1172 } | 1174 } |
1173 } else { | 1175 } else { |
1174 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); | 1176 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); |
1175 } | 1177 } |
1176 } | 1178 } |
1177 LOOPER_END | 1179 LOOPER_END |
(...skipping 17 matching lines...) Expand all Loading... |
1195 while (iter.next()) { | 1197 while (iter.next()) { |
1196 paint = &looper.paint(); | 1198 paint = &looper.paint(); |
1197 SkImageFilter* filter = paint->getImageFilter(); | 1199 SkImageFilter* filter = paint->getImageFilter(); |
1198 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; | 1200 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; |
1199 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { | 1201 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { |
1200 SkDeviceImageFilterProxy proxy(iter.fDevice); | 1202 SkDeviceImageFilterProxy proxy(iter.fDevice); |
1201 SkBitmap dst; | 1203 SkBitmap dst; |
1202 SkIPoint offset = SkIPoint::Make(0, 0); | 1204 SkIPoint offset = SkIPoint::Make(0, 0); |
1203 SkMatrix matrix = *iter.fMatrix; | 1205 SkMatrix matrix = *iter.fMatrix; |
1204 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); | 1206 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
1205 if (filter->filterImage(&proxy, bitmap, matrix, &dst, &offset)) { | 1207 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height()
); |
| 1208 SkImageFilter::Context ctx(matrix, clipBounds); |
| 1209 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { |
1206 SkPaint tmpUnfiltered(*paint); | 1210 SkPaint tmpUnfiltered(*paint); |
1207 tmpUnfiltered.setImageFilter(NULL); | 1211 tmpUnfiltered.setImageFilter(NULL); |
1208 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y(
) + offset.y(), | 1212 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y(
) + offset.y(), |
1209 tmpUnfiltered); | 1213 tmpUnfiltered); |
1210 } | 1214 } |
1211 } else { | 1215 } else { |
1212 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint); | 1216 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint); |
1213 } | 1217 } |
1214 } | 1218 } |
1215 LOOPER_END | 1219 LOOPER_END |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2538 if (!bitmap.allocPixels(info)) { | 2542 if (!bitmap.allocPixels(info)) { |
2539 return NULL; | 2543 return NULL; |
2540 } | 2544 } |
2541 | 2545 |
2542 // should this functionality be moved into allocPixels()? | 2546 // should this functionality be moved into allocPixels()? |
2543 if (!bitmap.info().isOpaque()) { | 2547 if (!bitmap.info().isOpaque()) { |
2544 bitmap.eraseColor(0); | 2548 bitmap.eraseColor(0); |
2545 } | 2549 } |
2546 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2550 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2547 } | 2551 } |
OLD | NEW |