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

Side by Side Diff: src/core/SkDevice.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 | « src/core/SkCanvas.cpp ('k') | src/core/SkImageFilter.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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "SkColorFilter.h" 8 #include "SkColorFilter.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 SkImageFilter* filter = paint.getImageFilter(); 409 SkImageFilter* filter = paint.getImageFilter();
410 if (filter && !this->canHandleImageFilter(filter)) { 410 if (filter && !this->canHandleImageFilter(filter)) {
411 SkImageFilter::DeviceProxy proxy(this); 411 SkImageFilter::DeviceProxy proxy(this);
412 SkIPoint offset = SkIPoint::Make(0, 0); 412 SkIPoint offset = SkIPoint::Make(0, 0);
413 SkMatrix matrix = *draw.fMatrix; 413 SkMatrix matrix = *draw.fMatrix;
414 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); 414 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
415 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); 415 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y);
416 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); 416 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache());
417 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); 417 SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
418 418
419 SkAutoTUnref<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&pro xy, bitmap)); 419 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, bit map));
420 if (!srcImg) { 420 if (!srcImg) {
421 return; // something disastrous happened 421 return; // something disastrous happened
422 } 422 }
423 423
424 SkAutoTUnref<SkSpecialImage> resultImg(filter->filterImage(srcImg, ctx, &offset)); 424 SkAutoTUnref<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offset));
425 if (resultImg) { 425 if (resultImg) {
426 SkPaint tmpUnfiltered(paint); 426 SkPaint tmpUnfiltered(paint);
427 tmpUnfiltered.setImageFilter(nullptr); 427 tmpUnfiltered.setImageFilter(nullptr);
428 SkBitmap resultBM; 428 SkBitmap resultBM;
429 if (resultImg->internal_getBM(&resultBM)) { 429 if (resultImg->internal_getBM(&resultBM)) {
430 // TODO: add drawSprite(SkSpecialImage) to SkDevice? (see skbug. com/5073) 430 // TODO: add drawSprite(SkSpecialImage) to SkDevice? (see skbug. com/5073)
431 this->drawSprite(draw, resultBM, x + offset.x(), y + offset.y(), tmpUnfiltered); 431 this->drawSprite(draw, resultBM, x + offset.x(), y + offset.y(), tmpUnfiltered);
432 } 432 }
433 } 433 }
434 } else { 434 } else {
(...skipping 11 matching lines...) Expand all
446 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() 446 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry()
447 || this->onShouldDisableLCD(paint)) { 447 || this->onShouldDisableLCD(paint)) {
448 448
449 flags &= ~SkPaint::kLCDRenderText_Flag; 449 flags &= ~SkPaint::kLCDRenderText_Flag;
450 flags |= SkPaint::kGenA8FromLCD_Flag; 450 flags |= SkPaint::kGenA8FromLCD_Flag;
451 } 451 }
452 452
453 return flags; 453 return flags;
454 } 454 }
455 455
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698