OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_PLATFORM_CANVAS_MAC_H_ | 5 #ifndef SKIA_EXT_PLATFORM_CANVAS_MAC_H_ |
6 #define SKIA_EXT_PLATFORM_CANVAS_MAC_H_ | 6 #define SKIA_EXT_PLATFORM_CANVAS_MAC_H_ |
7 | 7 |
8 #include "skia/ext/platform_device_mac.h" | 8 #include "skia/ext/platform_device_mac.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
11 | 11 |
12 namespace skia { | 12 namespace skia { |
13 | 13 |
14 // This class is a specialization of the regular SkCanvas that is designed to | 14 // This class is a specialization of the regular SkCanvas that is designed to |
15 // work with a gfx::PlatformDevice to manage platform-specific drawing. It | 15 // work with a gfx::PlatformDevice to manage platform-specific drawing. It |
16 // allows using both Skia operations and platform-specific operations. | 16 // allows using both Skia operations and platform-specific operations. |
17 class PlatformCanvasMac : public SkCanvas { | 17 class PlatformCanvasMac : public SkCanvas { |
18 public: | 18 public: |
19 // Set is_opaque if you are going to erase the bitmap and not use | 19 // Set is_opaque if you are going to erase the bitmap and not use |
20 // tranparency: this will enable some optimizations. The shared_section | 20 // tranparency: this will enable some optimizations. The shared_section |
21 // parameter is passed to gfx::PlatformDevice::create. See it for details. | 21 // parameter is passed to gfx::PlatformDevice::create. See it for details. |
22 // | 22 // |
23 // If you use the version with no arguments, you MUST call initialize() | 23 // If you use the version with no arguments, you MUST call initialize() |
24 PlatformCanvasMac(); | 24 PlatformCanvasMac(); |
25 PlatformCanvasMac(int width, int height, bool is_opaque); | 25 PlatformCanvasMac(int width, int height, bool is_opaque); |
26 PlatformCanvasMac(int width, int height, bool is_opaque, | 26 PlatformCanvasMac(int width, int height, bool is_opaque, |
27 CGContextRef context); | 27 CGContextRef context); |
| 28 PlatformCanvasMac(int width, int height, bool is_opaque, |
| 29 uint8_t* context); |
28 virtual ~PlatformCanvasMac(); | 30 virtual ~PlatformCanvasMac(); |
29 | 31 |
30 // For two-part init, call if you use the no-argument constructor above | 32 // For two-part init, call if you use the no-argument constructor above |
31 bool initialize(int width, int height, bool is_opaque); | 33 bool initialize(int width, int height, bool is_opaque); |
| 34 bool initialize(int width, int height, bool is_opaque, uint8_t* data); |
32 | 35 |
33 // These calls should surround calls to platform drawing routines. The CG | 36 // These calls should surround calls to platform drawing routines. The CG |
34 // context returned by beginPlatformPaint is the one that can be used to | 37 // context returned by beginPlatformPaint is the one that can be used to |
35 // draw into. | 38 // draw into. |
36 // Call endPlatformPaint when you are done and want to use Skia operations | 39 // Call endPlatformPaint when you are done and want to use Skia operations |
37 // again; this will synchronize the bitmap. | 40 // again; this will synchronize the bitmap. |
38 virtual CGContextRef beginPlatformPaint(); | 41 virtual CGContextRef beginPlatformPaint(); |
39 virtual void endPlatformPaint(); | 42 virtual void endPlatformPaint(); |
40 | 43 |
41 // Returns the platform device pointer of the topmost rect with a non-empty | 44 // Returns the platform device pointer of the topmost rect with a non-empty |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 SkDevice* setBitmapDevice(const SkBitmap& bitmap); | 87 SkDevice* setBitmapDevice(const SkBitmap& bitmap); |
85 | 88 |
86 // Disallow copy and assign. | 89 // Disallow copy and assign. |
87 PlatformCanvasMac(const PlatformCanvasMac&); | 90 PlatformCanvasMac(const PlatformCanvasMac&); |
88 PlatformCanvasMac& operator=(const PlatformCanvasMac&); | 91 PlatformCanvasMac& operator=(const PlatformCanvasMac&); |
89 }; | 92 }; |
90 | 93 |
91 } // namespace skia | 94 } // namespace skia |
92 | 95 |
93 #endif // SKIA_EXT_PLATFORM_CANVAS_MAC_H_ | 96 #endif // SKIA_EXT_PLATFORM_CANVAS_MAC_H_ |
OLD | NEW |