OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
11 #include "third_party/skia/include/core/SkMatrix.h" | 11 #include "third_party/skia/include/core/SkMatrix.h" |
12 #include "third_party/skia/include/core/SkRefCnt.h" | 12 #include "third_party/skia/include/core/SkRefCnt.h" |
13 #include "third_party/skia/include/core/SkRegion.h" | 13 #include "third_party/skia/include/core/SkRegion.h" |
14 #include "third_party/skia/include/core/SkUtils.h" | 14 #include "third_party/skia/include/core/SkUtils.h" |
15 | 15 |
16 namespace skia { | 16 namespace skia { |
17 | 17 |
| 18 SkDevice* SkBitmapPlatformDeviceFactory::newDevice(SkBitmap::Config config, |
| 19 int width, int height, |
| 20 bool isOpaque, |
| 21 bool isForLayer) { |
| 22 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
| 23 return BitmapPlatformDevice::create(width, height, isOpaque, NULL); |
| 24 } |
| 25 |
18 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( | 26 BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( |
19 HBITMAP hbitmap) | 27 HBITMAP hbitmap) |
20 : bitmap_context_(hbitmap), | 28 : bitmap_context_(hbitmap), |
21 hdc_(NULL), | 29 hdc_(NULL), |
22 config_dirty_(true) { // Want to load the config next time. | 30 config_dirty_(true) { // Want to load the config next time. |
23 // Initialize the clip region to the entire bitmap. | 31 // Initialize the clip region to the entire bitmap. |
24 BITMAP bitmap_data; | 32 BITMAP bitmap_data; |
25 if (GetObject(bitmap_context_, sizeof(BITMAP), &bitmap_data)) { | 33 if (GetObject(bitmap_context_, sizeof(BITMAP), &bitmap_data)) { |
26 SkIRect rect; | 34 SkIRect rect; |
27 rect.set(0, 0, bitmap_data.bmWidth, bitmap_data.bmHeight); | 35 rect.set(0, 0, bitmap_data.bmWidth, bitmap_data.bmHeight); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 273 |
266 void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) { | 274 void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) { |
267 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI | 275 // FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI |
268 // operation has occurred on our DC. | 276 // operation has occurred on our DC. |
269 if (data_->IsBitmapDCCreated()) | 277 if (data_->IsBitmapDCCreated()) |
270 GdiFlush(); | 278 GdiFlush(); |
271 } | 279 } |
272 | 280 |
273 } // namespace skia | 281 } // namespace skia |
274 | 282 |
OLD | NEW |