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

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

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