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

Unified Diff: skia/ext/bitmap_platform_device_mac.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/bitmap_platform_device_mac.h ('k') | skia/ext/bitmap_platform_device_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/bitmap_platform_device_mac.cc
diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc
index c97e6fbdd42b010dc80abb6d8d44b7f84be90d8b..b7b05e50a3c8187dcf39880ea920495ef44de06a 100644
--- a/skia/ext/bitmap_platform_device_mac.cc
+++ b/skia/ext/bitmap_platform_device_mac.cc
@@ -156,7 +156,7 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create(CGContextRef context,
CGContextRetain(context);
BitmapPlatformDevice* rv = new BitmapPlatformDevice(
- new BitmapPlatformDeviceData(context), bitmap);
+ skia::AdoptRef(new BitmapPlatformDeviceData(context)), bitmap);
// The device object took ownership of the graphics context with its own
// CGContextRetain call.
@@ -195,14 +195,13 @@ BitmapPlatformDevice* BitmapPlatformDevice::CreateWithData(uint8_t* data,
// The device will own the bitmap, which corresponds to also owning the pixel
// data. Therefore, we do not transfer ownership to the SkDevice's bitmap.
BitmapPlatformDevice::BitmapPlatformDevice(
- BitmapPlatformDeviceData* data, const SkBitmap& bitmap)
+ const skia::RefPtr<BitmapPlatformDeviceData>& data, const SkBitmap& bitmap)
: SkDevice(bitmap),
data_(data) {
SetPlatformDevice(this, this);
}
BitmapPlatformDevice::~BitmapPlatformDevice() {
- data_->unref();
}
CGContextRef BitmapPlatformDevice::GetBitmapContext() {
@@ -265,14 +264,15 @@ SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
SkCanvas* CreatePlatformCanvas(CGContextRef ctx, int width, int height,
bool is_opaque, OnFailureType failureType) {
- SkDevice* dev = BitmapPlatformDevice::Create(ctx, width, height, is_opaque);
+ skia::RefPtr<SkDevice> dev = skia::AdoptRef(
+ BitmapPlatformDevice::Create(ctx, width, height, is_opaque));
return CreateCanvas(dev, failureType);
}
SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque,
uint8_t* data, OnFailureType failureType) {
- SkDevice* dev = BitmapPlatformDevice::CreateWithData(data, width, height,
- is_opaque);
+ skia::RefPtr<SkDevice> dev = skia::AdoptRef(
+ BitmapPlatformDevice::CreateWithData(data, width, height, is_opaque));
return CreateCanvas(dev, failureType);
}
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.h ('k') | skia/ext/bitmap_platform_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698