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

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: Drop TNoRef Created 8 years, 1 month 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
Index: skia/ext/platform_canvas.cc
diff --git a/skia/ext/platform_canvas.cc b/skia/ext/platform_canvas.cc
index 461dba4e71b740bc5ac0a76424c26408472c579a..93a29c464451a5f623a4061cbd2e0b166cf2cd63 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 =
+ 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/refptr.h » ('j') | skia/ext/refptr.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698