summaryrefslogtreecommitdiffstats
path: root/skia/ext/bitmap_platform_device_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'skia/ext/bitmap_platform_device_win.cc')
-rw-r--r--skia/ext/bitmap_platform_device_win.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc
index 4e5bbce..8c304e6 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);
}