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

Unified Diff: gm/srcmode.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « gm/resizeimagefilter.cpp ('k') | gm/surface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/srcmode.cpp
diff --git a/gm/srcmode.cpp b/gm/srcmode.cpp
index 28bb04bd4eab70e8ab30a5c623ec448f3a87017c..93a9bc7f05f74b25de80cdbba61f4b24bab9ca69 100644
--- a/gm/srcmode.cpp
+++ b/gm/srcmode.cpp
@@ -115,7 +115,7 @@ protected:
}
}
- static SkSurface* compat_surface(SkCanvas* canvas, const SkISize& size, bool skipGPU) {
+ static sk_sp<SkSurface> compat_surface(SkCanvas* canvas, const SkISize& size, bool skipGPU) {
SkImageInfo info = SkImageInfo::MakeN32Premul(size);
bool callNewSurface = true;
@@ -124,17 +124,16 @@ protected:
callNewSurface = false;
}
#endif
- SkSurface* surface = callNewSurface ? canvas->newSurface(info) : nullptr;
+ sk_sp<SkSurface> surface = callNewSurface ? canvas->makeSurface(info) : nullptr;
if (nullptr == surface) {
// picture canvas will return null, so fall-back to raster
- surface = SkSurface::NewRaster(info);
+ surface = SkSurface::MakeRaster(info);
}
return surface;
}
virtual void onDraw(SkCanvas* canvas) {
- SkAutoTUnref<SkSurface> surf(compat_surface(canvas, this->getISize(),
- this->isCanvasDeferred()));
+ auto surf(compat_surface(canvas, this->getISize(), this->isCanvasDeferred()));
surf->getCanvas()->drawColor(SK_ColorWHITE);
this->drawContent(surf->getCanvas());
surf->draw(canvas, 0, 0, nullptr);
« no previous file with comments | « gm/resizeimagefilter.cpp ('k') | gm/surface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698