| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 if (hdc_) | 44 if (hdc_) |
| 45 ReleaseBitmapDC(); | 45 ReleaseBitmapDC(); |
| 46 | 46 |
| 47 // this will free the bitmap data as well as the bitmap handle | 47 // this will free the bitmap data as well as the bitmap handle |
| 48 DeleteObject(bitmap_context_); | 48 DeleteObject(bitmap_context_); |
| 49 } | 49 } |
| 50 | 50 |
| 51 HDC BitmapPlatformDevice::BitmapPlatformDeviceData::GetBitmapDC() { | 51 HDC BitmapPlatformDevice::BitmapPlatformDeviceData::GetBitmapDC() { |
| 52 if (!hdc_) { | 52 if (!hdc_) { |
| 53 hdc_ = CreateCompatibleDC(NULL); | 53 hdc_ = CreateCompatibleDC(NULL); |
| 54 InitializeDC(hdc_); | 54 platform_util::InitializeDC(hdc_); |
| 55 HGDIOBJ old_bitmap = SelectObject(hdc_, bitmap_context_); | 55 HGDIOBJ old_bitmap = SelectObject(hdc_, bitmap_context_); |
| 56 // When the memory DC is created, its display surface is exactly one | 56 // When the memory DC is created, its display surface is exactly one |
| 57 // monochrome pixel wide and one monochrome pixel high. Since we select our | 57 // monochrome pixel wide and one monochrome pixel high. Since we select our |
| 58 // own bitmap, we must delete the previous one. | 58 // own bitmap, we must delete the previous one. |
| 59 DeleteObject(old_bitmap); | 59 DeleteObject(old_bitmap); |
| 60 } | 60 } |
| 61 | 61 |
| 62 LoadConfig(); | 62 LoadConfig(); |
| 63 return hdc_; | 63 return hdc_; |
| 64 } | 64 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 if (data_->IsBitmapDCCreated()) | 289 if (data_->IsBitmapDCCreated()) |
| 290 GdiFlush(); | 290 GdiFlush(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() { | 293 SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() { |
| 294 return SkNEW(BitmapPlatformDeviceFactory); | 294 return SkNEW(BitmapPlatformDeviceFactory); |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace skia | 297 } // namespace skia |
| 298 | 298 |
| OLD | NEW |