OLD | NEW |
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 { | 17 class SK_API VectorPlatformDeviceEmfFactory { |
18 public: | 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, | 19 static PlatformDevice* CreateDevice(int width, int height, bool isOpaque, |
23 HANDLE shared_section); | 20 HANDLE shared_section); |
24 }; | 21 }; |
25 | 22 |
26 // A device is basically a wrapper around SkBitmap that provides a surface for | 23 // 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 | 24 // 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. | 25 // 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. | 26 // This device is a simple wrapper over a Windows device context (HDC) handle. |
30 class VectorPlatformDeviceEmf : public PlatformDevice { | 27 class VectorPlatformDeviceEmf : public PlatformDevice { |
31 public: | 28 public: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, | 71 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, |
75 const SkPaint&) OVERRIDE; | 72 const SkPaint&) OVERRIDE; |
76 | 73 |
77 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, | 74 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, |
78 const SkClipStack&); | 75 const SkClipStack&); |
79 | 76 |
80 void LoadClipRegion(); | 77 void LoadClipRegion(); |
81 bool alpha_blend_used() const { return alpha_blend_used_; } | 78 bool alpha_blend_used() const { return alpha_blend_used_; } |
82 | 79 |
83 protected: | 80 protected: |
84 // Override from SkDevice (through PlatformDevice). | 81 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, |
85 virtual SkDeviceFactory* onNewDeviceFactory(); | 82 int height, bool isOpaque, Usage); |
86 | 83 |
87 private: | 84 private: |
88 // Applies the SkPaint's painting properties in the current GDI context, if | 85 // 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 | 86 // possible. If GDI can't support all paint's properties, returns false. It |
90 // doesn't execute the "commands" in SkPaint. | 87 // doesn't execute the "commands" in SkPaint. |
91 bool ApplyPaint(const SkPaint& paint); | 88 bool ApplyPaint(const SkPaint& paint); |
92 | 89 |
93 // Selects a new object in the device context. It can be a pen, a brush, a | 90 // 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. | 91 // clipping region, a bitmap or a font. Returns the old selected object. |
95 HGDIOBJ SelectObject(HGDIOBJ object); | 92 HGDIOBJ SelectObject(HGDIOBJ object); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // True if AlphaBlend() was called during this print. | 131 // True if AlphaBlend() was called during this print. |
135 bool alpha_blend_used_; | 132 bool alpha_blend_used_; |
136 | 133 |
137 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceEmf); | 134 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceEmf); |
138 }; | 135 }; |
139 | 136 |
140 } // namespace skia | 137 } // namespace skia |
141 | 138 |
142 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_ | 139 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_ |
143 | 140 |
OLD | NEW |