OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 6 |
7 #include "skia/ext/vector_platform_device_win.h" | 7 #include "skia/ext/vector_platform_device_win.h" |
8 | 8 |
9 #include "skia/ext/bitmap_platform_device.h" | 9 #include "skia/ext/bitmap_platform_device.h" |
10 #include "skia/ext/skia_utils_win.h" | 10 #include "skia/ext/skia_utils_win.h" |
11 #include "third_party/skia/include/core/SkUtils.h" | 11 #include "third_party/skia/include/core/SkUtils.h" |
12 | 12 |
13 namespace skia { | 13 namespace skia { |
14 | 14 |
15 SkDevice* VectorPlatformDeviceFactory::newDevice(SkCanvas* unused, | 15 SkDevice* VectorPlatformDeviceFactory::newDevice(SkCanvas* unused, |
16 SkBitmap::Config config, | 16 SkBitmap::Config config, |
17 int width, int height, | 17 int width, int height, |
18 bool isOpaque, | 18 bool isOpaque, |
19 bool isForLayer) { | 19 bool isForLayer) { |
20 SkASSERT(config == SkBitmap::kARGB_8888_Config); | 20 SkASSERT(config == SkBitmap::kARGB_8888_Config); |
21 return CreateDevice(width, height, isOpaque, NULL); | 21 return CreateDevice(width, height, isOpaque, NULL); |
22 } | 22 } |
23 | 23 |
24 //static | 24 //static |
25 PlatformDevice* VectorPlatformDeviceFactory::CreateDevice( | 25 SkDevice* VectorPlatformDeviceFactory::CreateDevice(int width, int height, |
26 int width, int height, bool is_opaque, HANDLE shared_section) { | 26 bool is_opaque, |
| 27 HANDLE shared_section) { |
27 if (!is_opaque) { | 28 if (!is_opaque) { |
28 // TODO(maruel): http://crbug.com/18382 When restoring a semi-transparent | 29 // TODO(maruel): http://crbug.com/18382 When restoring a semi-transparent |
29 // layer, i.e. merging it, we need to rasterize it because GDI doesn't | 30 // layer, i.e. merging it, we need to rasterize it because GDI doesn't |
30 // support transparency except for AlphaBlend(). Right now, a | 31 // support transparency except for AlphaBlend(). Right now, a |
31 // BitmapPlatformDevice is created when VectorCanvas think a saveLayers() | 32 // BitmapPlatformDevice is created when VectorCanvas think a saveLayers() |
32 // call is being done. The way to save a layer would be to create an | 33 // call is being done. The way to save a layer would be to create an |
33 // EMF-based VectorDevice and have this device registers the drawing. When | 34 // EMF-based VectorDevice and have this device registers the drawing. When |
34 // playing back the device into a bitmap, do it at the printer's dpi instead | 35 // playing back the device into a bitmap, do it at the printer's dpi instead |
35 // of the layout's dpi (which is much lower). | 36 // of the layout's dpi (which is much lower). |
36 return BitmapPlatformDevice::create(width, height, | 37 return BitmapPlatformDevice::create(width, height, |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 reinterpret_cast<const BITMAPINFO*>(&hdr), | 715 reinterpret_cast<const BITMAPINFO*>(&hdr), |
715 DIB_RGB_COLORS, | 716 DIB_RGB_COLORS, |
716 SRCCOPY); | 717 SRCCOPY); |
717 SkASSERT(result); | 718 SkASSERT(result); |
718 } | 719 } |
719 Cleanup(); | 720 Cleanup(); |
720 } | 721 } |
721 | 722 |
722 } // namespace skia | 723 } // namespace skia |
723 | 724 |
OLD | NEW |