OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; | 1301 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; |
1302 if (filter && !dstDev->canHandleImageFilter(filter)) { | 1302 if (filter && !dstDev->canHandleImageFilter(filter)) { |
1303 SkImageFilter::DeviceProxy proxy(dstDev); | 1303 SkImageFilter::DeviceProxy proxy(dstDev); |
1304 SkBitmap dst; | 1304 SkBitmap dst; |
1305 SkIPoint offset = SkIPoint::Make(0, 0); | 1305 SkIPoint offset = SkIPoint::Make(0, 0); |
1306 const SkBitmap& src = srcDev->accessBitmap(false); | 1306 const SkBitmap& src = srcDev->accessBitmap(false); |
1307 SkMatrix matrix = *iter.fMatrix; | 1307 SkMatrix matrix = *iter.fMatrix; |
1308 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); | 1308 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); |
1309 SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height
()); | 1309 SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height
()); |
1310 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache
()); | 1310 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache
()); |
1311 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); | 1311 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), |
| 1312 SkImageFilter::kApprox_SizeConstraint); |
1312 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) { | 1313 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) { |
1313 SkPaint tmpUnfiltered(*paint); | 1314 SkPaint tmpUnfiltered(*paint); |
1314 tmpUnfiltered.setImageFilter(nullptr); | 1315 tmpUnfiltered.setImageFilter(nullptr); |
1315 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of
fset.y(), | 1316 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of
fset.y(), |
1316 tmpUnfiltered); | 1317 tmpUnfiltered); |
1317 } | 1318 } |
1318 } else if (deviceIsBitmapDevice) { | 1319 } else if (deviceIsBitmapDevice) { |
1319 const SkBitmap& src = static_cast<SkBitmapDevice*>(srcDev)->fBitmap; | 1320 const SkBitmap& src = static_cast<SkBitmapDevice*>(srcDev)->fBitmap; |
1320 dstDev->drawSprite(iter, src, pos.x(), pos.y(), *paint); | 1321 dstDev->drawSprite(iter, src, pos.x(), pos.y(), *paint); |
1321 } else { | 1322 } else { |
(...skipping 30 matching lines...) Expand all Loading... |
1352 SkImageFilter* filter = paint->getImageFilter(); | 1353 SkImageFilter* filter = paint->getImageFilter(); |
1353 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; | 1354 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; |
1354 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { | 1355 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { |
1355 SkImageFilter::DeviceProxy proxy(iter.fDevice); | 1356 SkImageFilter::DeviceProxy proxy(iter.fDevice); |
1356 SkBitmap dst; | 1357 SkBitmap dst; |
1357 SkIPoint offset = SkIPoint::Make(0, 0); | 1358 SkIPoint offset = SkIPoint::Make(0, 0); |
1358 SkMatrix matrix = *iter.fMatrix; | 1359 SkMatrix matrix = *iter.fMatrix; |
1359 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); | 1360 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); |
1360 const SkIRect clipBounds = bitmap.bounds(); | 1361 const SkIRect clipBounds = bitmap.bounds(); |
1361 SkAutoTUnref<SkImageFilter::Cache> cache(iter.fDevice->getImageFilte
rCache()); | 1362 SkAutoTUnref<SkImageFilter::Cache> cache(iter.fDevice->getImageFilte
rCache()); |
1362 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); | 1363 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), |
| 1364 SkImageFilter::kApprox_SizeConstraint); |
1363 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { | 1365 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { |
1364 SkPaint tmpUnfiltered(*paint); | 1366 SkPaint tmpUnfiltered(*paint); |
1365 tmpUnfiltered.setImageFilter(nullptr); | 1367 tmpUnfiltered.setImageFilter(nullptr); |
1366 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y(
) + offset.y(), | 1368 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y(
) + offset.y(), |
1367 tmpUnfiltered); | 1369 tmpUnfiltered); |
1368 } | 1370 } |
1369 } else { | 1371 } else { |
1370 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint); | 1372 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint); |
1371 } | 1373 } |
1372 } | 1374 } |
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2880 } | 2882 } |
2881 | 2883 |
2882 if (matrix) { | 2884 if (matrix) { |
2883 canvas->concat(*matrix); | 2885 canvas->concat(*matrix); |
2884 } | 2886 } |
2885 } | 2887 } |
2886 | 2888 |
2887 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2889 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2888 fCanvas->restoreToCount(fSaveCount); | 2890 fCanvas->restoreToCount(fSaveCount); |
2889 } | 2891 } |
OLD | NEW |