Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: skia/ext/vector_platform_device_emf_win.cc

Issue 7273013: Stop using deprecated factory API for SkDevice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 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/SkUtils.h" 11 #include "third_party/skia/include/core/SkUtils.h"
12 12
13 namespace skia { 13 namespace skia {
14 14
15 SkDevice* VectorPlatformDeviceEmfFactory::newDevice(SkCanvas* unused, 15 SkDevice* VectorPlatformDeviceEmf::onCreateCompatibleDevice(
16 SkBitmap::Config config, 16 SkBitmap::Config config, int width, int height, bool isOpaque, Usage) {
17 int width, int height,
18 bool isOpaque,
19 bool isForLayer) {
20 SkASSERT(config == SkBitmap::kARGB_8888_Config); 17 SkASSERT(config == SkBitmap::kARGB_8888_Config);
21 return CreateDevice(width, height, isOpaque, NULL); 18 return VectorPlatformDeviceEmfFactory::CreateDevice(width, height, isOpaque,
19 NULL);
22 } 20 }
23 21
24 //static 22 //static
25 PlatformDevice* VectorPlatformDeviceEmfFactory::CreateDevice( 23 PlatformDevice* VectorPlatformDeviceEmfFactory::CreateDevice(
vandebo (ex-Chrome) 2011/06/28 19:07:54 CreateDevice used to be a method of VectorCanvas,
26 int width, int height, bool is_opaque, HANDLE shared_section) { 24 int width, int height, bool is_opaque, HANDLE shared_section) {
27 if (!is_opaque) { 25 if (!is_opaque) {
28 // TODO(maruel): http://crbug.com/18382 When restoring a semi-transparent 26 // 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 27 // layer, i.e. merging it, we need to rasterize it because GDI doesn't
30 // support transparency except for AlphaBlend(). Right now, a 28 // support transparency except for AlphaBlend(). Right now, a
31 // BitmapPlatformDevice is created when VectorCanvas think a saveLayers() 29 // BitmapPlatformDevice is created when VectorCanvas think a saveLayers()
32 // call is being done. The way to save a layer would be to create an 30 // 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 31 // 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 32 // 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). 33 // of the layout's dpi (which is much lower).
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 previous_pen_(NULL), 106 previous_pen_(NULL),
109 alpha_blend_used_(false) { 107 alpha_blend_used_(false) {
110 transform_.reset(); 108 transform_.reset();
111 } 109 }
112 110
113 VectorPlatformDeviceEmf::~VectorPlatformDeviceEmf() { 111 VectorPlatformDeviceEmf::~VectorPlatformDeviceEmf() {
114 SkASSERT(previous_brush_ == NULL); 112 SkASSERT(previous_brush_ == NULL);
115 SkASSERT(previous_pen_ == NULL); 113 SkASSERT(previous_pen_ == NULL);
116 } 114 }
117 115
118 SkDeviceFactory* VectorPlatformDeviceEmf::onNewDeviceFactory() {
119 return SkNEW(VectorPlatformDeviceEmfFactory);
120 }
121
122 HDC VectorPlatformDeviceEmf::BeginPlatformPaint() { 116 HDC VectorPlatformDeviceEmf::BeginPlatformPaint() {
123 return hdc_; 117 return hdc_;
124 } 118 }
125 119
126 uint32_t VectorPlatformDeviceEmf::getDeviceCapabilities() { 120 uint32_t VectorPlatformDeviceEmf::getDeviceCapabilities() {
127 return SkDevice::getDeviceCapabilities() | kVector_Capability; 121 return SkDevice::getDeviceCapabilities() | kVector_Capability;
128 } 122 }
129 123
130 void VectorPlatformDeviceEmf::drawPaint(const SkDraw& draw, 124 void VectorPlatformDeviceEmf::drawPaint(const SkDraw& draw,
131 const SkPaint& paint) { 125 const SkPaint& paint) {
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 DIB_RGB_COLORS, 726 DIB_RGB_COLORS,
733 SRCCOPY); 727 SRCCOPY);
734 SkASSERT(result); 728 SkASSERT(result);
735 } 729 }
736 EndPlatformPaint(); 730 EndPlatformPaint();
737 Cleanup(); 731 Cleanup();
738 } 732 }
739 733
740 } // namespace skia 734 } // namespace skia
741 735
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698