| 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 SkDevice* VectorPlatformDeviceFactory::CreateDevice(int width, int height, | 25 PlatformDevice* VectorPlatformDeviceFactory::CreateDevice( |
| 26 bool is_opaque, | 26 int width, int height, bool is_opaque, HANDLE shared_section) { |
| 27 HANDLE shared_section) { | |
| 28 if (!is_opaque) { | 27 if (!is_opaque) { |
| 29 // TODO(maruel): http://crbug.com/18382 When restoring a semi-transparent | 28 // TODO(maruel): http://crbug.com/18382 When restoring a semi-transparent |
| 30 // layer, i.e. merging it, we need to rasterize it because GDI doesn't | 29 // layer, i.e. merging it, we need to rasterize it because GDI doesn't |
| 31 // support transparency except for AlphaBlend(). Right now, a | 30 // support transparency except for AlphaBlend(). Right now, a |
| 32 // BitmapPlatformDevice is created when VectorCanvas think a saveLayers() | 31 // BitmapPlatformDevice is created when VectorCanvas think a saveLayers() |
| 33 // call is being done. The way to save a layer would be to create an | 32 // call is being done. The way to save a layer would be to create an |
| 34 // EMF-based VectorDevice and have this device registers the drawing. When | 33 // EMF-based VectorDevice and have this device registers the drawing. When |
| 35 // playing back the device into a bitmap, do it at the printer's dpi instead | 34 // playing back the device into a bitmap, do it at the printer's dpi instead |
| 36 // of the layout's dpi (which is much lower). | 35 // of the layout's dpi (which is much lower). |
| 37 return BitmapPlatformDevice::create(width, height, | 36 return BitmapPlatformDevice::create(width, height, |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 reinterpret_cast<const BITMAPINFO*>(&hdr), | 714 reinterpret_cast<const BITMAPINFO*>(&hdr), |
| 716 DIB_RGB_COLORS, | 715 DIB_RGB_COLORS, |
| 717 SRCCOPY); | 716 SRCCOPY); |
| 718 SkASSERT(result); | 717 SkASSERT(result); |
| 719 } | 718 } |
| 720 Cleanup(); | 719 Cleanup(); |
| 721 } | 720 } |
| 722 | 721 |
| 723 } // namespace skia | 722 } // namespace skia |
| 724 | 723 |
| OLD | NEW |