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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "skia/ext/platform_device.h" | 10 #include "skia/ext/platform_device.h" |
11 #include "third_party/skia/include/core/SkMatrix.h" | 11 #include "third_party/skia/include/core/SkMatrix.h" |
12 #include "third_party/skia/include/core/SkRegion.h" | 12 #include "third_party/skia/include/core/SkRegion.h" |
13 | 13 |
14 namespace skia { | 14 namespace skia { |
15 | 15 |
16 // A device is basically a wrapper around SkBitmap that provides a surface for | 16 // A device is basically a wrapper around SkBitmap that provides a surface for |
17 // SkCanvas to draw into. This specific device is not not backed by a surface | 17 // SkCanvas to draw into. This specific device is not not backed by a surface |
18 // and is thus unreadable. This is because the backend is completely vectorial. | 18 // and is thus unreadable. This is because the backend is completely vectorial. |
19 // This device is a simple wrapper over a Windows device context (HDC) handle. | 19 // This device is a simple wrapper over a Windows device context (HDC) handle. |
20 class VectorPlatformDeviceEmf : public SkDevice, public PlatformDevice { | 20 class VectorPlatformDeviceEmf : public SkBitmapDevice, public PlatformDevice { |
vandebo (ex-Chrome)
2013/08/22 20:41:58
Should this be SkBaseDevice ?
robertphillips
2013/08/23 14:01:03
Ultimately yes - short term no. Please see earlier
vandebo (ex-Chrome)
2013/08/23 17:10:04
Does it make sense to add a TODO? Down the road it
robertphillips
2013/08/26 13:11:48
Done.
| |
21 public: | 21 public: |
22 SK_API static SkDevice* CreateDevice(int width, int height, bool isOpaque, | 22 SK_API static SkBaseDevice* CreateDevice(int width, int height, bool isOpaque, |
23 HANDLE shared_section); | 23 HANDLE shared_section); |
24 | 24 |
25 // Factory function. The DC is kept as the output context. | 25 // Factory function. The DC is kept as the output context. |
26 static SkDevice* create(HDC dc, int width, int height); | 26 static SkBaseDevice* create(HDC dc, int width, int height); |
27 | 27 |
28 VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap); | 28 VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap); |
29 virtual ~VectorPlatformDeviceEmf(); | 29 virtual ~VectorPlatformDeviceEmf(); |
30 | 30 |
31 // PlatformDevice methods | 31 // PlatformDevice methods |
32 virtual PlatformSurface BeginPlatformPaint() OVERRIDE; | 32 virtual PlatformSurface BeginPlatformPaint() OVERRIDE; |
33 virtual void DrawToNativeContext(HDC dc, int x, int y, | 33 virtual void DrawToNativeContext(HDC dc, int x, int y, |
34 const RECT* src_rect) OVERRIDE; | 34 const RECT* src_rect) OVERRIDE; |
35 // SkDevice methods. | 35 // SkBaseDevice methods. |
36 virtual uint32_t getDeviceCapabilities(); | 36 virtual uint32_t getDeviceCapabilities(); |
37 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE; | 37 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE; |
38 virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, | 38 virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, |
39 size_t count, const SkPoint[], | 39 size_t count, const SkPoint[], |
40 const SkPaint& paint) OVERRIDE; | 40 const SkPaint& paint) OVERRIDE; |
41 virtual void drawRect(const SkDraw& draw, const SkRect& r, | 41 virtual void drawRect(const SkDraw& draw, const SkRect& r, |
42 const SkPaint& paint) OVERRIDE; | 42 const SkPaint& paint) OVERRIDE; |
43 virtual void drawPath(const SkDraw& draw, const SkPath& path, | 43 virtual void drawPath(const SkDraw& draw, const SkPath& path, |
44 const SkPaint& paint, | 44 const SkPaint& paint, |
45 const SkMatrix* prePathMatrix = NULL, | 45 const SkMatrix* prePathMatrix = NULL, |
(...skipping 14 matching lines...) Expand all Loading... | |
60 int scalarsPerPos, const SkPaint& paint) OVERRIDE; | 60 int scalarsPerPos, const SkPaint& paint) OVERRIDE; |
61 virtual void drawTextOnPath(const SkDraw& draw, const void* text, size_t len, | 61 virtual void drawTextOnPath(const SkDraw& draw, const void* text, size_t len, |
62 const SkPath& path, const SkMatrix* matrix, | 62 const SkPath& path, const SkMatrix* matrix, |
63 const SkPaint& paint) OVERRIDE; | 63 const SkPaint& paint) OVERRIDE; |
64 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, | 64 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, |
65 int vertexCount, | 65 int vertexCount, |
66 const SkPoint verts[], const SkPoint texs[], | 66 const SkPoint verts[], const SkPoint texs[], |
67 const SkColor colors[], SkXfermode* xmode, | 67 const SkColor colors[], SkXfermode* xmode, |
68 const uint16_t indices[], int indexCount, | 68 const uint16_t indices[], int indexCount, |
69 const SkPaint& paint) OVERRIDE; | 69 const SkPaint& paint) OVERRIDE; |
70 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, | 70 virtual void drawDevice(const SkDraw& draw, SkBaseDevice*, int x, int y, |
71 const SkPaint&) OVERRIDE; | 71 const SkPaint&) OVERRIDE; |
72 | 72 |
73 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, | 73 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, |
74 const SkClipStack&) OVERRIDE; | 74 const SkClipStack&) OVERRIDE; |
75 | 75 |
76 void LoadClipRegion(); | 76 void LoadClipRegion(); |
77 | 77 |
78 protected: | 78 protected: |
79 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, | 79 virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, |
80 int height, bool isOpaque, | 80 int height, bool isOpaque, |
81 Usage usage) OVERRIDE; | 81 Usage usage) OVERRIDE; |
82 | 82 |
83 private: | 83 private: |
84 // 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 |
85 // 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 |
86 // doesn't execute the "commands" in SkPaint. | 86 // doesn't execute the "commands" in SkPaint. |
87 bool ApplyPaint(const SkPaint& paint); | 87 bool ApplyPaint(const SkPaint& paint); |
88 | 88 |
89 // 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 |
90 // 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. |
91 HGDIOBJ SelectObject(HGDIOBJ object); | 91 HGDIOBJ SelectObject(HGDIOBJ object); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 | 132 |
133 typedef void (*SkiaEnsureTypefaceCharactersAccessible) | 133 typedef void (*SkiaEnsureTypefaceCharactersAccessible) |
134 (const LOGFONT& font, const wchar_t* text, unsigned int text_length); | 134 (const LOGFONT& font, const wchar_t* text, unsigned int text_length); |
135 | 135 |
136 SK_API void SetSkiaEnsureTypefaceCharactersAccessible( | 136 SK_API void SetSkiaEnsureTypefaceCharactersAccessible( |
137 SkiaEnsureTypefaceCharactersAccessible func); | 137 SkiaEnsureTypefaceCharactersAccessible func); |
138 | 138 |
139 } // namespace skia | 139 } // namespace skia |
140 | 140 |
141 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_ | 141 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_ |
OLD | NEW |