aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkSurface.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-31 07:40:33 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-01 12:42:13 +0000
commita54ccb22111e57b57a5fbb6b7f0eebc72e4f02d4 (patch)
treeb90fc03856e5639d537381fb4284f68c7dc67c07 /src/image/SkSurface.cpp
parent99d4721171f9b8f23cd907ef3da938c4c5579ae9 (diff)
Update SkSurface's cached image ownership handling to sk_sp
Change-Id: I9dca3d355bfe39211cb5054a5834d9c1750d8152 Reviewed-on: https://skia-review.googlesource.com/7780 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/image/SkSurface.cpp')
-rw-r--r--src/image/SkSurface.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index cb85708bf5..08f79aea28 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -56,15 +56,11 @@ SkSurfaceProps::SkSurfaceProps(const SkSurfaceProps& other)
///////////////////////////////////////////////////////////////////////////////
SkSurface_Base::SkSurface_Base(int width, int height, const SkSurfaceProps* props)
- : INHERITED(width, height, props)
-{
- fCachedImage = nullptr;
+ : INHERITED(width, height, props) {
}
SkSurface_Base::SkSurface_Base(const SkImageInfo& info, const SkSurfaceProps* props)
- : INHERITED(info, props)
-{
- fCachedImage = nullptr;
+ : INHERITED(info, props) {
}
SkSurface_Base::~SkSurface_Base() {
@@ -72,8 +68,6 @@ SkSurface_Base::~SkSurface_Base() {
if (fCachedCanvas) {
fCachedCanvas->setSurfaceBase(nullptr);
}
-
- SkSafeUnref(fCachedImage);
}
void SkSurface_Base::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) {
@@ -103,8 +97,7 @@ void SkSurface_Base::aboutToDraw(ContentChangeMode mode) {
// regardless of copy-on-write, we must drop our cached image now, so
// that the next request will get our new contents.
- fCachedImage->unref();
- fCachedImage = nullptr;
+ fCachedImage.reset();
if (unique) {
// Our content isn't held by any image now, so we can consider that content mutable.