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 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 paint = &tmp; | 1401 paint = &tmp; |
1402 } | 1402 } |
1403 | 1403 |
1404 LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type) | 1404 LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type) |
1405 while (iter.next()) { | 1405 while (iter.next()) { |
1406 SkBaseDevice* dstDev = iter.fDevice; | 1406 SkBaseDevice* dstDev = iter.fDevice; |
1407 paint = &looper.paint(); | 1407 paint = &looper.paint(); |
1408 SkImageFilter* filter = paint->getImageFilter(); | 1408 SkImageFilter* filter = paint->getImageFilter(); |
1409 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; | 1409 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; |
1410 if (filter) { | 1410 if (filter) { |
1411 SkImageFilter::DeviceProxy proxy(dstDev); | |
1412 SkIPoint offset = SkIPoint::Make(0, 0); | 1411 SkIPoint offset = SkIPoint::Make(0, 0); |
1413 const SkBitmap& srcBM = srcDev->accessBitmap(false); | 1412 const SkBitmap& srcBM = srcDev->accessBitmap(false); |
1414 SkMatrix matrix = *iter.fMatrix; | 1413 SkMatrix matrix = *iter.fMatrix; |
1415 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); | 1414 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); |
1416 const SkIRect clipBounds = iter.fClip->getBounds().makeOffset(-pos.x
(), -pos.y()); | 1415 const SkIRect clipBounds = iter.fClip->getBounds().makeOffset(-pos.x
(), -pos.y()); |
1417 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache
()); | 1416 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache
()); |
1418 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); | 1417 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); |
1419 | 1418 |
1420 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy,
srcBM, | 1419 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(srcBM, |
1421 &dstDev
->surfaceProps())); | 1420 &dstDev
->surfaceProps())); |
1422 if (!srcImg) { | 1421 if (!srcImg) { |
1423 continue; // something disastrous happened | 1422 continue; // something disastrous happened |
1424 } | 1423 } |
1425 | 1424 |
1426 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ct
x, &offset)); | 1425 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ct
x, &offset)); |
1427 if (resultImg) { | 1426 if (resultImg) { |
1428 SkPaint tmpUnfiltered(*paint); | 1427 SkPaint tmpUnfiltered(*paint); |
1429 tmpUnfiltered.setImageFilter(nullptr); | 1428 tmpUnfiltered.setImageFilter(nullptr); |
1430 SkBitmap resultBM; | 1429 SkBitmap resultBM; |
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3052 | 3051 |
3053 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3052 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3054 fCanvas->restoreToCount(fSaveCount); | 3053 fCanvas->restoreToCount(fSaveCount); |
3055 } | 3054 } |
3056 | 3055 |
3057 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3056 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3058 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3057 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
3059 return this->makeSurface(info, props).release(); | 3058 return this->makeSurface(info, props).release(); |
3060 } | 3059 } |
3061 #endif | 3060 #endif |
OLD | NEW |