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

Unified Diff: skia/ext/platform_canvas.cc

Issue 11418217: Add skia::RefPtr class to wrap ref counted classes from Skia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit+rebase Created 8 years 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 | « skia/ext/platform_canvas.h ('k') | skia/ext/platform_canvas_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas.cc
diff --git a/skia/ext/platform_canvas.cc b/skia/ext/platform_canvas.cc
index 461dba4e71b740bc5ac0a76424c26408472c579a..6a2548100bc708eeec2c7df7aaf0075c79fd6477 100644
--- a/skia/ext/platform_canvas.cc
+++ b/skia/ext/platform_canvas.cc
@@ -54,7 +54,9 @@ void MakeOpaque(SkCanvas* canvas, int x, int y, int width, int height) {
// so we don't draw anything on a device that ignores xfermodes
paint.setColor(0);
// install our custom mode
- paint.setXfermode(new SkProcXfermode(MakeOpaqueXfermodeProc))->unref();
+ skia::RefPtr<SkProcXfermode> xfermode =
+ skia::AdoptRef(new SkProcXfermode(MakeOpaqueXfermodeProc));
+ paint.setXfermode(xfermode.get());
canvas->drawRect(rect, paint);
}
@@ -62,14 +64,13 @@ size_t PlatformCanvasStrideForWidth(unsigned width) {
return 4 * width;
}
-SkCanvas* CreateCanvas(SkDevice* device, OnFailureType failureType) {
+SkCanvas* CreateCanvas(const skia::RefPtr<SkDevice>& device, OnFailureType failureType) {
if (!device) {
if (CRASH_ON_FAILURE == failureType)
SK_CRASH();
return NULL;
}
- SkAutoUnref aur(device);
- return new SkCanvas(device);
+ return new SkCanvas(device.get());
}
PlatformBitmap::PlatformBitmap() : surface_(0), platform_extra_(0) {}
« no previous file with comments | « skia/ext/platform_canvas.h ('k') | skia/ext/platform_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698