OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_emf_win.h" | 7 #include "skia/ext/vector_platform_device_emf_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/SkTemplates.h" | 11 #include "third_party/skia/include/core/SkTemplates.h" |
12 #include "third_party/skia/include/core/SkUtils.h" | 12 #include "third_party/skia/include/core/SkUtils.h" |
13 #include "third_party/skia/include/ports/SkTypeface_win.h" | 13 #include "third_party/skia/include/ports/SkTypeface_win.h" |
14 | 14 |
15 namespace skia { | 15 namespace skia { |
16 | 16 |
17 // static | 17 // static |
18 SkDevice* VectorPlatformDeviceEmf::CreateDevice( | 18 SkDevice* VectorPlatformDeviceEmf::CreateDevice( |
19 int width, int height, bool is_opaque, HANDLE shared_section) { | 19 int width, int height, bool is_opaque, HANDLE shared_section) { |
20 if (!is_opaque) { | 20 if (!is_opaque) { |
21 // TODO(maruel): http://crbug.com/18382 When restoring a semi-transparent | 21 // TODO(maruel): http://crbug.com/18382 When restoring a semi-transparent |
22 // layer, i.e. merging it, we need to rasterize it because GDI doesn't | 22 // layer, i.e. merging it, we need to rasterize it because GDI doesn't |
23 // support transparency except for AlphaBlend(). Right now, a | 23 // support transparency except for AlphaBlend(). Right now, a |
24 // BitmapPlatformDevice is created when VectorCanvas think a saveLayers() | 24 // BitmapPlatformDevice is created when VectorCanvas think a saveLayers() |
25 // call is being done. The way to save a layer would be to create an | 25 // call is being done. The way to save a layer would be to create an |
26 // EMF-based VectorDevice and have this device registers the drawing. When | 26 // EMF-based VectorDevice and have this device registers the drawing. When |
27 // playing back the device into a bitmap, do it at the printer's dpi instead | 27 // playing back the device into a bitmap, do it at the printer's dpi instead |
28 // of the layout's dpi (which is much lower). | 28 // of the layout's dpi (which is much lower). |
29 return BitmapPlatformDevice::create(width, height, is_opaque, | 29 return BitmapPlatformDevice::Create(width, height, is_opaque, |
30 shared_section); | 30 shared_section); |
31 } | 31 } |
32 | 32 |
33 // TODO(maruel): http://crbug.com/18383 Look if it would be worth to | 33 // TODO(maruel): http://crbug.com/18383 Look if it would be worth to |
34 // increase the resolution by ~10x (any worthy factor) to increase the | 34 // increase the resolution by ~10x (any worthy factor) to increase the |
35 // rendering precision (think about printing) while using a relatively | 35 // rendering precision (think about printing) while using a relatively |
36 // low dpi. This happens because we receive float as input but the GDI | 36 // low dpi. This happens because we receive float as input but the GDI |
37 // functions works with integers. The idea is to premultiply the matrix | 37 // functions works with integers. The idea is to premultiply the matrix |
38 // with this factor and multiply each SkScalar that are passed to | 38 // with this factor and multiply each SkScalar that are passed to |
39 // SkScalarRound(value) as SkScalarRound(value * 10). Safari is already | 39 // SkScalarRound(value) as SkScalarRound(value * 10). Safari is already |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 pixels, | 862 pixels, |
863 reinterpret_cast<const BITMAPINFO*>(&hdr), | 863 reinterpret_cast<const BITMAPINFO*>(&hdr), |
864 DIB_RGB_COLORS, | 864 DIB_RGB_COLORS, |
865 SRCCOPY); | 865 SRCCOPY); |
866 } | 866 } |
867 EndPlatformPaint(); | 867 EndPlatformPaint(); |
868 Cleanup(); | 868 Cleanup(); |
869 } | 869 } |
870 | 870 |
871 } // namespace skia | 871 } // namespace skia |
OLD | NEW |