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

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

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 #ifndef SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_ 5 #ifndef SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_
6 #define SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_ 6 #define SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "skia/ext/platform_device.h" 11 #include "skia/ext/platform_device.h"
12 #include "third_party/skia/include/core/SkMatrix.h" 12 #include "third_party/skia/include/core/SkMatrix.h"
13 #include "third_party/skia/include/core/SkRegion.h" 13 #include "third_party/skia/include/core/SkRegion.h"
14 14
15 namespace skia { 15 namespace skia {
16 16
17 class SK_API VectorPlatformDeviceEmfFactory : public SkDeviceFactory {
18 public:
19 virtual SkDevice* newDevice(SkCanvas* ignored, SkBitmap::Config config,
20 int width, int height,
21 bool isOpaque, bool isForLayer) OVERRIDE;
22 static PlatformDevice* CreateDevice(int width, int height, bool isOpaque,
23 HANDLE shared_section);
24 };
25
26 // A device is basically a wrapper around SkBitmap that provides a surface for 17 // A device is basically a wrapper around SkBitmap that provides a surface for
27 // SkCanvas to draw into. This specific device is not not backed by a surface 18 // SkCanvas to draw into. This specific device is not not backed by a surface
28 // and is thus unreadable. This is because the backend is completely vectorial. 19 // and is thus unreadable. This is because the backend is completely vectorial.
29 // This device is a simple wrapper over a Windows device context (HDC) handle. 20 // This device is a simple wrapper over a Windows device context (HDC) handle.
30 class VectorPlatformDeviceEmf : public PlatformDevice { 21 class VectorPlatformDeviceEmf : public PlatformDevice {
31 public: 22 public:
23 SK_API static PlatformDevice* CreateDevice(int width, int height,
24 bool isOpaque,
25 HANDLE shared_section);
26
32 // Factory function. The DC is kept as the output context. 27 // Factory function. The DC is kept as the output context.
33 static VectorPlatformDeviceEmf* create(HDC dc, int width, int height); 28 static VectorPlatformDeviceEmf* create(HDC dc, int width, int height);
34 29
35 VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap); 30 VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap);
36 virtual ~VectorPlatformDeviceEmf(); 31 virtual ~VectorPlatformDeviceEmf();
37 32
38 // PlatformDevice methods 33 // PlatformDevice methods
39 virtual PlatformSurface BeginPlatformPaint(); 34 virtual PlatformSurface BeginPlatformPaint();
40 virtual void DrawToNativeContext(HDC dc, int x, int y, const RECT* src_rect); 35 virtual void DrawToNativeContext(HDC dc, int x, int y, const RECT* src_rect);
41 36
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, 69 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y,
75 const SkPaint&) OVERRIDE; 70 const SkPaint&) OVERRIDE;
76 71
77 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, 72 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region,
78 const SkClipStack&); 73 const SkClipStack&);
79 74
80 void LoadClipRegion(); 75 void LoadClipRegion();
81 bool alpha_blend_used() const { return alpha_blend_used_; } 76 bool alpha_blend_used() const { return alpha_blend_used_; }
82 77
83 protected: 78 protected:
84 // Override from SkDevice (through PlatformDevice). 79 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
85 virtual SkDeviceFactory* onNewDeviceFactory(); 80 int height, bool isOpaque,
81 Usage usage);
86 82
87 private: 83 private:
88 // Applies the SkPaint's painting properties in the current GDI context, if 84 // Applies the SkPaint's painting properties in the current GDI context, if
89 // possible. If GDI can't support all paint's properties, returns false. It 85 // possible. If GDI can't support all paint's properties, returns false. It
90 // doesn't execute the "commands" in SkPaint. 86 // doesn't execute the "commands" in SkPaint.
91 bool ApplyPaint(const SkPaint& paint); 87 bool ApplyPaint(const SkPaint& paint);
92 88
93 // Selects a new object in the device context. It can be a pen, a brush, a 89 // Selects a new object in the device context. It can be a pen, a brush, a
94 // clipping region, a bitmap or a font. Returns the old selected object. 90 // clipping region, a bitmap or a font. Returns the old selected object.
95 HGDIOBJ SelectObject(HGDIOBJ object); 91 HGDIOBJ SelectObject(HGDIOBJ object);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // True if AlphaBlend() was called during this print. 130 // True if AlphaBlend() was called during this print.
135 bool alpha_blend_used_; 131 bool alpha_blend_used_;
136 132
137 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceEmf); 133 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceEmf);
138 }; 134 };
139 135
140 } // namespace skia 136 } // namespace skia
141 137
142 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_ 138 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_
143 139
OLDNEW
« no previous file with comments | « skia/ext/vector_platform_device_cairo_linux.cc ('k') | skia/ext/vector_platform_device_emf_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698