| 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 | |
| 15 | 10 |
| 16 namespace skia { | 11 namespace skia { |
| 17 | 12 |
| 13 class PlatformDevice; |
| 14 |
| 18 // This class is a specialization of the regular PlatformCanvas. It is designed | 15 // This class is a specialization of the regular PlatformCanvas. It is designed |
| 19 // to work with a VectorDevice to manage platform-specific drawing. It allows | 16 // to work with a VectorDevice to manage platform-specific drawing. It allows |
| 20 // using both Skia operations and platform-specific operations. It *doesn't* | 17 // using both Skia operations and platform-specific operations. It *doesn't* |
| 21 // support reading back from the bitmap backstore since it is not used. | 18 // support reading back from the bitmap backstore since it is not used. |
| 22 class SK_API VectorCanvas : public PlatformCanvas { | 19 class SK_API VectorCanvas : public PlatformCanvas { |
| 23 public: | 20 public: |
| 24 VectorCanvas(); | 21 // Ownership of |device| is transfered to VectorCanvas. |
| 25 explicit VectorCanvas(SkDeviceFactory* factory); | 22 explicit VectorCanvas(PlatformDevice* device); |
| 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 | |
| 32 virtual ~VectorCanvas(); | 23 virtual ~VectorCanvas(); |
| 33 | 24 |
| 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 | |
| 42 virtual SkBounder* setBounder(SkBounder* bounder); | 25 virtual SkBounder* setBounder(SkBounder* bounder); |
| 43 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter); | 26 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter); |
| 44 | 27 |
| 45 private: | 28 private: |
| 46 // Returns true if the top device is vector based and not bitmap based. | 29 // Returns true if the top device is vector based and not bitmap based. |
| 47 bool IsTopDeviceVectorial() const; | 30 bool IsTopDeviceVectorial() const; |
| 48 | 31 |
| 49 // Copy & assign are not supported. | 32 // Copy & assign are not supported. |
| 50 VectorCanvas(const VectorCanvas&); | 33 VectorCanvas(const VectorCanvas&); |
| 51 const VectorCanvas& operator=(const VectorCanvas&); | 34 const VectorCanvas& operator=(const VectorCanvas&); |
| 52 }; | 35 }; |
| 53 | 36 |
| 54 } // namespace skia | 37 } // namespace skia |
| 55 | 38 |
| 56 #endif // SKIA_EXT_VECTOR_CANVAS_H_ | 39 #endif // SKIA_EXT_VECTOR_CANVAS_H_ |
| 57 | 40 |
| OLD | NEW |