OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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_CANVAS_H_ | 5 #ifndef SKIA_EXT_VECTOR_CANVAS_H_ |
6 #define SKIA_EXT_VECTOR_CANVAS_H_ | 6 #define SKIA_EXT_VECTOR_CANVAS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "skia/ext/platform_canvas.h" | 9 #include "skia/ext/platform_canvas.h" |
| 10 #include "skia/ext/vector_platform_device.h" |
| 11 |
| 12 #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
| 13 typedef struct _cairo cairo_t; |
| 14 #endif |
10 | 15 |
11 namespace skia { | 16 namespace skia { |
12 | 17 |
13 class PlatformDevice; | |
14 | |
15 // This class is a specialization of the regular PlatformCanvas. It is designed | 18 // This class is a specialization of the regular PlatformCanvas. It is designed |
16 // to work with a VectorDevice to manage platform-specific drawing. It allows | 19 // to work with a VectorDevice to manage platform-specific drawing. It allows |
17 // using both Skia operations and platform-specific operations. It *doesn't* | 20 // using both Skia operations and platform-specific operations. It *doesn't* |
18 // support reading back from the bitmap backstore since it is not used. | 21 // support reading back from the bitmap backstore since it is not used. |
19 class SK_API VectorCanvas : public PlatformCanvas { | 22 class SK_API VectorCanvas : public PlatformCanvas { |
20 public: | 23 public: |
21 // Ownership of |device| is transfered to VectorCanvas. | 24 VectorCanvas(); |
22 explicit VectorCanvas(PlatformDevice* device); | 25 explicit VectorCanvas(SkDeviceFactory* factory); |
| 26 #if defined(WIN32) |
| 27 VectorCanvas(HDC dc, int width, int height); |
| 28 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
| 29 // Caller owns |context|. Ownership is not transferred. |
| 30 VectorCanvas(cairo_t* context, int width, int height); |
| 31 #endif |
23 virtual ~VectorCanvas(); | 32 virtual ~VectorCanvas(); |
24 | 33 |
| 34 // For two-part init, call if you use the no-argument constructor above |
| 35 #if defined(WIN32) |
| 36 bool initialize(HDC context, int width, int height); |
| 37 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
| 38 // Ownership of |context| is not transferred. |
| 39 bool initialize(cairo_t* context, int width, int height); |
| 40 #endif |
| 41 |
25 virtual SkBounder* setBounder(SkBounder* bounder); | 42 virtual SkBounder* setBounder(SkBounder* bounder); |
26 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter); | 43 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter); |
27 | 44 |
28 private: | 45 private: |
29 // Returns true if the top device is vector based and not bitmap based. | 46 // Returns true if the top device is vector based and not bitmap based. |
30 bool IsTopDeviceVectorial() const; | 47 bool IsTopDeviceVectorial() const; |
31 | 48 |
32 // Copy & assign are not supported. | 49 // Copy & assign are not supported. |
33 VectorCanvas(const VectorCanvas&); | 50 VectorCanvas(const VectorCanvas&); |
34 const VectorCanvas& operator=(const VectorCanvas&); | 51 const VectorCanvas& operator=(const VectorCanvas&); |
35 }; | 52 }; |
36 | 53 |
37 } // namespace skia | 54 } // namespace skia |
38 | 55 |
39 #endif // SKIA_EXT_VECTOR_CANVAS_H_ | 56 #endif // SKIA_EXT_VECTOR_CANVAS_H_ |
40 | 57 |
OLD | NEW |