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

Unified Diff: src/effects/SkImageSource.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkSpecialSurface.cpp ('k') | src/effects/SkMergeImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkImageSource.cpp
diff --git a/src/effects/SkImageSource.cpp b/src/effects/SkImageSource.cpp
index 25d37e30016723c5a419c27e4837e369bb4f7a66..c0a8deebf95f7b505ee274383c3c0fb1c556b924 100644
--- a/src/effects/SkImageSource.cpp
+++ b/src/effects/SkImageSource.cpp
@@ -15,25 +15,25 @@
#include "SkWriteBuffer.h"
#include "SkString.h"
-SkImageFilter* SkImageSource::Create(const SkImage* image) {
+SkImageFilter* SkImageSource::Create(SkImage* image) {
return image ? new SkImageSource(image) : nullptr;
}
-SkImageFilter* SkImageSource::Create(const SkImage* image,
+SkImageFilter* SkImageSource::Create(SkImage* image,
const SkRect& srcRect,
const SkRect& dstRect,
SkFilterQuality filterQuality) {
return image ? new SkImageSource(image, srcRect, dstRect, filterQuality) : nullptr;
}
-SkImageSource::SkImageSource(const SkImage* image)
+SkImageSource::SkImageSource(SkImage* image)
: INHERITED(0, nullptr)
, fImage(SkRef(image))
, fSrcRect(SkRect::MakeIWH(image->width(), image->height()))
, fDstRect(fSrcRect)
, fFilterQuality(kHigh_SkFilterQuality) { }
-SkImageSource::SkImageSource(const SkImage* image,
+SkImageSource::SkImageSource(SkImage* image,
const SkRect& srcRect,
const SkRect& dstRect,
SkFilterQuality filterQuality)
@@ -62,7 +62,7 @@ void SkImageSource::flatten(SkWriteBuffer& buffer) const {
buffer.writeInt(fFilterQuality);
buffer.writeRect(fSrcRect);
buffer.writeRect(fDstRect);
- buffer.writeImage(fImage);
+ buffer.writeImage(fImage.get());
}
SkSpecialImage* SkImageSource::onFilterImage(SkSpecialImage* source, const Context& ctx,
@@ -74,9 +74,9 @@ SkSpecialImage* SkImageSource::onFilterImage(SkSpecialImage* source, const Conte
if (fSrcRect == bounds && dstRect == bounds) {
// No regions cropped out or resized; return entire image.
offset->fX = offset->fY = 0;
- return SkSpecialImage::NewFromImage(source->internal_getProxy(),
- SkIRect::MakeWH(fImage->width(), fImage->height()),
- fImage);
+ return SkSpecialImage::MakeFromImage(source->internal_getProxy(),
+ SkIRect::MakeWH(fImage->width(), fImage->height()),
+ fImage).release();
}
const SkIRect dstIRect = dstRect.roundOut();
@@ -84,7 +84,7 @@ SkSpecialImage* SkImageSource::onFilterImage(SkSpecialImage* source, const Conte
const SkImageInfo info = SkImageInfo::MakeN32(dstIRect.width(), dstIRect.height(),
kPremul_SkAlphaType);
- SkAutoTUnref<SkSpecialSurface> surf(source->newSurface(info));
+ sk_sp<SkSpecialSurface> surf(source->makeSurface(info));
if (!surf) {
return nullptr;
}
@@ -105,11 +105,12 @@ SkSpecialImage* SkImageSource::onFilterImage(SkSpecialImage* source, const Conte
paint.setFilterQuality(
fSrcRect.width() == dstRect.width() && fSrcRect.height() == dstRect.height() ?
kNone_SkFilterQuality : fFilterQuality);
- canvas->drawImageRect(fImage, fSrcRect, dstRect, &paint, SkCanvas::kStrict_SrcRectConstraint);
+ canvas->drawImageRect(fImage.get(), fSrcRect, dstRect, &paint,
+ SkCanvas::kStrict_SrcRectConstraint);
offset->fX = dstIRect.fLeft;
offset->fY = dstIRect.fTop;
- return surf->newImageSnapshot();
+ return surf->makeImageSnapshot().release();
}
void SkImageSource::computeFastBounds(const SkRect& src, SkRect* dst) const {
« no previous file with comments | « src/core/SkSpecialSurface.cpp ('k') | src/effects/SkMergeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698