OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_WIN_H_ | 5 #ifndef SKIA_EXT_VECTOR_PLATFORM_DEVICE_WIN_H_ |
6 #define SKIA_EXT_VECTOR_PLATFORM_DEVICE_WIN_H_ | 6 #define SKIA_EXT_VECTOR_PLATFORM_DEVICE_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "skia/ext/platform_device.h" | 9 #include "skia/ext/platform_device.h" |
10 #include "third_party/skia/include/core/SkMatrix.h" | 10 #include "third_party/skia/include/core/SkMatrix.h" |
11 #include "third_party/skia/include/core/SkRegion.h" | 11 #include "third_party/skia/include/core/SkRegion.h" |
12 | 12 |
13 namespace skia { | 13 namespace skia { |
14 | 14 |
| 15 class SkVectorPlatformDeviceFactory : public SkRasterDeviceFactory { |
| 16 public: |
| 17 virtual SkDevice* newDevice(SkBitmap::Config config, int width, int height, |
| 18 bool isOpaque, bool isForLayer); |
| 19 static SkDevice* CreateDevice(int width, int height, bool isOpaque, |
| 20 HANDLE shared_section); |
| 21 }; |
| 22 |
15 // 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 |
16 // 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 |
17 // 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. |
18 // 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. |
19 class VectorPlatformDevice : public PlatformDevice { | 27 class VectorPlatformDevice : public PlatformDevice { |
20 public: | 28 public: |
21 // Factory function. The DC is kept as the output context. | 29 // Factory function. The DC is kept as the output context. |
22 static VectorPlatformDevice* create(HDC dc, int width, int height); | 30 static VectorPlatformDevice* create(HDC dc, int width, int height); |
23 | 31 |
24 VectorPlatformDevice(HDC dc, const SkBitmap& bitmap); | 32 VectorPlatformDevice(HDC dc, const SkBitmap& bitmap); |
25 virtual ~VectorPlatformDevice(); | 33 virtual ~VectorPlatformDevice(); |
26 | 34 |
| 35 virtual SkDeviceFactory* getDeviceFactory() { |
| 36 return SkNEW(SkVectorPlatformDeviceFactory); |
| 37 } |
| 38 |
27 virtual HDC getBitmapDC() { | 39 virtual HDC getBitmapDC() { |
28 return hdc_; | 40 return hdc_; |
29 } | 41 } |
30 | 42 |
31 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint); | 43 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint); |
32 virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, | 44 virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, |
33 size_t count, const SkPoint[], const SkPaint& paint); | 45 size_t count, const SkPoint[], const SkPaint& paint); |
34 virtual void drawRect(const SkDraw& draw, const SkRect& r, | 46 virtual void drawRect(const SkDraw& draw, const SkRect& r, |
35 const SkPaint& paint); | 47 const SkPaint& paint); |
36 virtual void drawPath(const SkDraw& draw, const SkPath& path, | 48 virtual void drawPath(const SkDraw& draw, const SkPath& path, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 124 |
113 // Copy & assign are not supported. | 125 // Copy & assign are not supported. |
114 VectorPlatformDevice(const VectorPlatformDevice&); | 126 VectorPlatformDevice(const VectorPlatformDevice&); |
115 const VectorPlatformDevice& operator=(const VectorPlatformDevice&); | 127 const VectorPlatformDevice& operator=(const VectorPlatformDevice&); |
116 }; | 128 }; |
117 | 129 |
118 } // namespace skia | 130 } // namespace skia |
119 | 131 |
120 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_WIN_H_ | 132 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_WIN_H_ |
121 | 133 |
OLD | NEW |