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

Unified Diff: skia/ext/platform_canvas.h

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/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas.h
diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h
index c83e6bf69f6ad07676848a9e4044064a5de87bdb..68e00072acb91d4cb25fde2324406d6d0392888e 100644
--- a/skia/ext/platform_canvas.h
+++ b/skia/ext/platform_canvas.h
@@ -9,6 +9,7 @@
// to get the surface type.
#include "base/basictypes.h"
#include "skia/ext/platform_device.h"
+#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace skia {
@@ -71,8 +72,8 @@ static inline SkCanvas* CreatePlatformCanvas(int width,
return CreatePlatformCanvas(width, height, is_opaque, 0, CRASH_ON_FAILURE);
}
-// Takes ownership of the device, so the caller need not call unref().
-SK_API SkCanvas* CreateCanvas(SkDevice* device, OnFailureType failure_type);
+SK_API SkCanvas* CreateCanvas(const skia::RefPtr<SkDevice>& device,
+ OnFailureType failure_type);
static inline SkCanvas* CreateBitmapCanvas(int width,
int height,
@@ -87,10 +88,12 @@ static inline SkCanvas* TryCreateBitmapCanvas(int width,
RETURN_NULL_ON_FAILURE);
}
-class SK_API ScopedPlatformCanvas : public SkAutoTUnref<SkCanvas> {
+class SK_API ScopedPlatformCanvas : public RefPtr<SkCanvas> {
public:
ScopedPlatformCanvas(int width, int height, bool is_opaque)
- : SkAutoTUnref<SkCanvas>(CreatePlatformCanvas(width, height, is_opaque)){}
+ : RefPtr<SkCanvas>(AdoptRef(
+ CreatePlatformCanvas(width, height, is_opaque)))
+ {}
};
// Return the stride (length of a line in bytes) for the given width. Because
« no previous file with comments | « skia/ext/bitmap_platform_device_win.cc ('k') | skia/ext/platform_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698