| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <windows.h> | 5 #include <windows.h> |
| 6 #include <psapi.h> | 6 #include <psapi.h> |
| 7 | 7 |
| 8 #include "skia/ext/bitmap_platform_device_win.h" | 8 #include "skia/ext/bitmap_platform_device_win.h" |
| 9 | 9 |
| 10 #include "skia/ext/bitmap_platform_device_data.h" | 10 #include "skia/ext/bitmap_platform_device_data.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 screen_dc, width, height, is_opaque, shared_section); | 158 screen_dc, width, height, is_opaque, shared_section); |
| 159 ReleaseDC(NULL, screen_dc); | 159 ReleaseDC(NULL, screen_dc); |
| 160 return device; | 160 return device; |
| 161 } | 161 } |
| 162 | 162 |
| 163 // The device will own the HBITMAP, which corresponds to also owning the pixel | 163 // The device will own the HBITMAP, which corresponds to also owning the pixel |
| 164 // data. Therefore, we do not transfer ownership to the SkDevice's bitmap. | 164 // data. Therefore, we do not transfer ownership to the SkDevice's bitmap. |
| 165 BitmapPlatformDevice::BitmapPlatformDevice( | 165 BitmapPlatformDevice::BitmapPlatformDevice( |
| 166 BitmapPlatformDeviceData* data, | 166 BitmapPlatformDeviceData* data, |
| 167 const SkBitmap& bitmap) | 167 const SkBitmap& bitmap) |
| 168 : SkDevice(bitmap), | 168 : PlatformDevice(bitmap), |
| 169 data_(data) { | 169 data_(data) { |
| 170 // The data object is already ref'ed for us by create(). | 170 // The data object is already ref'ed for us by create(). |
| 171 SkDEBUGCODE(begin_paint_count_ = 0); | 171 SkDEBUGCODE(begin_paint_count_ = 0); |
| 172 SetPlatformDevice(this, this); | |
| 173 } | 172 } |
| 174 | 173 |
| 175 BitmapPlatformDevice::~BitmapPlatformDevice() { | 174 BitmapPlatformDevice::~BitmapPlatformDevice() { |
| 176 SkASSERT(begin_paint_count_ == 0); | 175 SkASSERT(begin_paint_count_ == 0); |
| 177 data_->unref(); | 176 data_->unref(); |
| 178 } | 177 } |
| 179 | 178 |
| 180 HDC BitmapPlatformDevice::BeginPlatformPaint() { | 179 HDC BitmapPlatformDevice::BeginPlatformPaint() { |
| 181 SkDEBUGCODE(begin_paint_count_++); | 180 SkDEBUGCODE(begin_paint_count_++); |
| 182 return data_->GetBitmapDC(); | 181 return data_->GetBitmapDC(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 255 } |
| 257 | 256 |
| 258 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( | 257 SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice( |
| 259 SkBitmap::Config config, int width, int height, bool isOpaque, | 258 SkBitmap::Config config, int width, int height, bool isOpaque, |
| 260 Usage /*usage*/) { | 259 Usage /*usage*/) { |
| 261 SkASSERT(config == SkBitmap::kARGB_8888_Config); | 260 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
| 262 return BitmapPlatformDevice::create(width, height, isOpaque, NULL); | 261 return BitmapPlatformDevice::create(width, height, isOpaque, NULL); |
| 263 } | 262 } |
| 264 | 263 |
| 265 } // namespace skia | 264 } // namespace skia |
| 265 |
| OLD | NEW |