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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 bool isOpaque, | 24 bool isOpaque, |
25 HANDLE shared_section); | 25 HANDLE shared_section); |
26 | 26 |
27 // Factory function. The DC is kept as the output context. | 27 // Factory function. The DC is kept as the output context. |
28 static VectorPlatformDeviceEmf* create(HDC dc, int width, int height); | 28 static VectorPlatformDeviceEmf* create(HDC dc, int width, int height); |
29 | 29 |
30 VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap); | 30 VectorPlatformDeviceEmf(HDC dc, const SkBitmap& bitmap); |
31 virtual ~VectorPlatformDeviceEmf(); | 31 virtual ~VectorPlatformDeviceEmf(); |
32 | 32 |
33 // PlatformDevice methods | 33 // PlatformDevice methods |
34 virtual PlatformSurface BeginPlatformPaint(); | 34 virtual PlatformSurface BeginPlatformPaint() OVERRIDE; |
35 virtual void DrawToNativeContext(HDC dc, int x, int y, const RECT* src_rect); | 35 virtual void DrawToNativeContext(HDC dc, int x, int y, |
| 36 const RECT* src_rect) OVERRIDE; |
| 37 virtual bool AlphaBlendUsed() const OVERRIDE { return alpha_blend_used_; } |
36 | 38 |
37 // SkDevice methods. | 39 // SkDevice methods. |
38 virtual uint32_t getDeviceCapabilities(); | 40 virtual uint32_t getDeviceCapabilities(); |
39 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE; | 41 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE; |
40 virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, | 42 virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, |
41 size_t count, const SkPoint[], | 43 size_t count, const SkPoint[], |
42 const SkPaint& paint) OVERRIDE; | 44 const SkPaint& paint) OVERRIDE; |
43 virtual void drawRect(const SkDraw& draw, const SkRect& r, | 45 virtual void drawRect(const SkDraw& draw, const SkRect& r, |
44 const SkPaint& paint) OVERRIDE; | 46 const SkPaint& paint) OVERRIDE; |
45 virtual void drawPath(const SkDraw& draw, const SkPath& path, | 47 virtual void drawPath(const SkDraw& draw, const SkPath& path, |
(...skipping 17 matching lines...) Expand all Loading... |
63 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, | 65 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, |
64 int vertexCount, | 66 int vertexCount, |
65 const SkPoint verts[], const SkPoint texs[], | 67 const SkPoint verts[], const SkPoint texs[], |
66 const SkColor colors[], SkXfermode* xmode, | 68 const SkColor colors[], SkXfermode* xmode, |
67 const uint16_t indices[], int indexCount, | 69 const uint16_t indices[], int indexCount, |
68 const SkPaint& paint) OVERRIDE; | 70 const SkPaint& paint) OVERRIDE; |
69 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, | 71 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, |
70 const SkPaint&) OVERRIDE; | 72 const SkPaint&) OVERRIDE; |
71 | 73 |
72 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, | 74 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, |
73 const SkClipStack&); | 75 const SkClipStack&) OVERRIDE; |
74 | 76 |
75 void LoadClipRegion(); | 77 void LoadClipRegion(); |
76 bool alpha_blend_used() const { return alpha_blend_used_; } | |
77 | 78 |
78 protected: | 79 protected: |
79 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, | 80 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, |
80 int height, bool isOpaque, | 81 int height, bool isOpaque, |
81 Usage usage); | 82 Usage usage) OVERRIDE; |
82 | 83 |
83 private: | 84 private: |
84 // 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 |
85 // 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 |
86 // doesn't execute the "commands" in SkPaint. | 87 // doesn't execute the "commands" in SkPaint. |
87 bool ApplyPaint(const SkPaint& paint); | 88 bool ApplyPaint(const SkPaint& paint); |
88 | 89 |
89 // 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 |
90 // 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. |
91 HGDIOBJ SelectObject(HGDIOBJ object); | 92 HGDIOBJ SelectObject(HGDIOBJ object); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // True if AlphaBlend() was called during this print. | 131 // True if AlphaBlend() was called during this print. |
131 bool alpha_blend_used_; | 132 bool alpha_blend_used_; |
132 | 133 |
133 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceEmf); | 134 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceEmf); |
134 }; | 135 }; |
135 | 136 |
136 } // namespace skia | 137 } // namespace skia |
137 | 138 |
138 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_ | 139 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_EMF_WIN_H_ |
139 | 140 |
OLD | NEW |