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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 paint = &tmp; | 1293 paint = &tmp; |
1294 } | 1294 } |
1295 | 1295 |
1296 LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type) | 1296 LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type) |
1297 while (iter.next()) { | 1297 while (iter.next()) { |
1298 SkBaseDevice* dstDev = iter.fDevice; | 1298 SkBaseDevice* dstDev = iter.fDevice; |
1299 paint = &looper.paint(); | 1299 paint = &looper.paint(); |
1300 SkImageFilter* filter = paint->getImageFilter(); | 1300 SkImageFilter* filter = paint->getImageFilter(); |
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::Proxy 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 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) { | 1312 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) { |
1313 SkPaint tmpUnfiltered(*paint); | 1313 SkPaint tmpUnfiltered(*paint); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 paint = &tmp; | 1345 paint = &tmp; |
1346 } | 1346 } |
1347 | 1347 |
1348 LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type) | 1348 LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type) |
1349 | 1349 |
1350 while (iter.next()) { | 1350 while (iter.next()) { |
1351 paint = &looper.paint(); | 1351 paint = &looper.paint(); |
1352 SkImageFilter* filter = paint->getImageFilter(); | 1352 SkImageFilter* filter = paint->getImageFilter(); |
1353 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; | 1353 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; |
1354 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { | 1354 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { |
1355 SkImageFilter::Proxy proxy(iter.fDevice); | 1355 SkImageFilter::DeviceProxy proxy(iter.fDevice); |
1356 SkBitmap dst; | 1356 SkBitmap dst; |
1357 SkIPoint offset = SkIPoint::Make(0, 0); | 1357 SkIPoint offset = SkIPoint::Make(0, 0); |
1358 SkMatrix matrix = *iter.fMatrix; | 1358 SkMatrix matrix = *iter.fMatrix; |
1359 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); | 1359 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); |
1360 const SkIRect clipBounds = bitmap.bounds(); | 1360 const SkIRect clipBounds = bitmap.bounds(); |
1361 SkAutoTUnref<SkImageFilter::Cache> cache(iter.fDevice->getImageFilte
rCache()); | 1361 SkAutoTUnref<SkImageFilter::Cache> cache(iter.fDevice->getImageFilte
rCache()); |
1362 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); | 1362 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); |
1363 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { | 1363 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { |
1364 SkPaint tmpUnfiltered(*paint); | 1364 SkPaint tmpUnfiltered(*paint); |
1365 tmpUnfiltered.setImageFilter(nullptr); | 1365 tmpUnfiltered.setImageFilter(nullptr); |
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2880 } | 2880 } |
2881 | 2881 |
2882 if (matrix) { | 2882 if (matrix) { |
2883 canvas->concat(*matrix); | 2883 canvas->concat(*matrix); |
2884 } | 2884 } |
2885 } | 2885 } |
2886 | 2886 |
2887 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2887 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2888 fCanvas->restoreToCount(fSaveCount); | 2888 fCanvas->restoreToCount(fSaveCount); |
2889 } | 2889 } |
OLD | NEW |