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 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 if (filter && !dstDev->canHandleImageFilter(filter)) { | 1400 if (filter && !dstDev->canHandleImageFilter(filter)) { |
1401 SkImageFilter::DeviceProxy proxy(dstDev); | 1401 SkImageFilter::DeviceProxy proxy(dstDev); |
1402 SkIPoint offset = SkIPoint::Make(0, 0); | 1402 SkIPoint offset = SkIPoint::Make(0, 0); |
1403 const SkBitmap& srcBM = srcDev->accessBitmap(false); | 1403 const SkBitmap& srcBM = srcDev->accessBitmap(false); |
1404 SkMatrix matrix = *iter.fMatrix; | 1404 SkMatrix matrix = *iter.fMatrix; |
1405 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); | 1405 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y()
)); |
1406 const SkIRect clipBounds = iter.fClip->getBounds().makeOffset(-pos.x
(), -pos.y()); | 1406 const SkIRect clipBounds = iter.fClip->getBounds().makeOffset(-pos.x
(), -pos.y()); |
1407 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache
()); | 1407 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache
()); |
1408 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); | 1408 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); |
1409 | 1409 |
1410 SkAutoTUnref<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(
&proxy, srcBM)); | 1410 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy,
srcBM)); |
1411 if (!srcImg) { | 1411 if (!srcImg) { |
1412 continue; // something disastrous happened | 1412 continue; // something disastrous happened |
1413 } | 1413 } |
1414 | 1414 |
1415 SkAutoTUnref<SkSpecialImage> resultImg(filter->filterImage(srcImg, c
tx, &offset)); | 1415 SkAutoTUnref<SkSpecialImage> resultImg(filter->filterImage(srcImg.ge
t(), ctx, |
| 1416 &offset))
; |
1416 if (resultImg) { | 1417 if (resultImg) { |
1417 SkPaint tmpUnfiltered(*paint); | 1418 SkPaint tmpUnfiltered(*paint); |
1418 tmpUnfiltered.setImageFilter(nullptr); | 1419 tmpUnfiltered.setImageFilter(nullptr); |
1419 SkBitmap resultBM; | 1420 SkBitmap resultBM; |
1420 if (resultImg->internal_getBM(&resultBM)) { | 1421 if (resultImg->internal_getBM(&resultBM)) { |
1421 // TODO: add drawSprite(SkSpecialImage) to SkDevice? (see sk
bug.com/5073) | 1422 // TODO: add drawSprite(SkSpecialImage) to SkDevice? (see sk
bug.com/5073) |
1422 dstDev->drawSprite(iter, resultBM, pos.x() + offset.x(), pos
.y() + offset.y(), | 1423 dstDev->drawSprite(iter, resultBM, pos.x() + offset.x(), pos
.y() + offset.y(), |
1423 tmpUnfiltered); | 1424 tmpUnfiltered); |
1424 } | 1425 } |
1425 } | 1426 } |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 } | 3036 } |
3036 | 3037 |
3037 if (matrix) { | 3038 if (matrix) { |
3038 canvas->concat(*matrix); | 3039 canvas->concat(*matrix); |
3039 } | 3040 } |
3040 } | 3041 } |
3041 | 3042 |
3042 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3043 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3043 fCanvas->restoreToCount(fSaveCount); | 3044 fCanvas->restoreToCount(fSaveCount); |
3044 } | 3045 } |
OLD | NEW |