Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: src/core/SkCanvas.cpp

Issue 1812023002: Switch SkSpecialImage & SkSpecialSurface classes over to smart pointers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix build Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/effects/SkImageSource.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/effects/SkImageSource.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698