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

Unified Diff: skia/ext/bitmap_platform_device_win.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_win.h ('k') | skia/ext/platform_canvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/bitmap_platform_device_win.cc
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc
index 4e5bbce33895aeb93d23483bef9504f6d74add68..8c304e623737e4ff465690d711fd442c873fa68a 100644
--- a/skia/ext/bitmap_platform_device_win.cc
+++ b/skia/ext/bitmap_platform_device_win.cc
@@ -142,8 +142,8 @@ BitmapPlatformDevice* BitmapPlatformDevice::Create(
// The device object will take ownership of the HBITMAP. The initial refcount
// of the data object will be 1, which is what the constructor expects.
- return new BitmapPlatformDevice(new BitmapPlatformDeviceData(hbitmap),
- bitmap);
+ return new BitmapPlatformDevice(
+ skia::AdoptRef(new BitmapPlatformDeviceData(hbitmap)), bitmap);
}
// static
@@ -166,7 +166,7 @@ BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width,
// The device will own the HBITMAP, which corresponds to also owning the pixel
// data. Therefore, we do not transfer ownership to the SkDevice's bitmap.
BitmapPlatformDevice::BitmapPlatformDevice(
- BitmapPlatformDeviceData* data,
+ const skia::RefPtr<BitmapPlatformDeviceData>& data,
const SkBitmap& bitmap)
: SkDevice(bitmap),
data_(data) {
@@ -177,7 +177,6 @@ BitmapPlatformDevice::BitmapPlatformDevice(
BitmapPlatformDevice::~BitmapPlatformDevice() {
SkASSERT(begin_paint_count_ == 0);
- data_->unref();
}
HDC BitmapPlatformDevice::BeginPlatformPaint() {
@@ -272,10 +271,8 @@ SkCanvas* CreatePlatformCanvas(int width,
bool is_opaque,
HANDLE shared_section,
OnFailureType failureType) {
- SkDevice* dev = BitmapPlatformDevice::Create(width,
- height,
- is_opaque,
- shared_section);
+ skia::RefPtr<SkDevice> dev = skia::AdoptRef(
+ BitmapPlatformDevice::Create(width, height, is_opaque, shared_section));
return CreateCanvas(dev, failureType);
}
« no previous file with comments | « skia/ext/bitmap_platform_device_win.h ('k') | skia/ext/platform_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698