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_PLATFORM_CANVAS_H_ | 5 #ifndef SKIA_EXT_PLATFORM_CANVAS_H_ |
6 #define SKIA_EXT_PLATFORM_CANVAS_H_ | 6 #define SKIA_EXT_PLATFORM_CANVAS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // The platform-specific device will include the necessary platform headers | 9 // The platform-specific device will include the necessary platform headers |
10 // to get the surface type. | 10 // to get the surface type. |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #if defined(WIN32) | 28 #if defined(WIN32) |
29 // The shared_section parameter is passed to gfx::PlatformDevice::create. | 29 // The shared_section parameter is passed to gfx::PlatformDevice::create. |
30 // See it for details. | 30 // See it for details. |
31 PlatformCanvas(int width, int height, bool is_opaque, HANDLE shared_section); | 31 PlatformCanvas(int width, int height, bool is_opaque, HANDLE shared_section); |
32 #elif defined(__APPLE__) | 32 #elif defined(__APPLE__) |
33 PlatformCanvas(int width, int height, bool is_opaque, | 33 PlatformCanvas(int width, int height, bool is_opaque, |
34 CGContextRef context); | 34 CGContextRef context); |
35 PlatformCanvas(int width, int height, bool is_opaque, uint8_t* context); | 35 PlatformCanvas(int width, int height, bool is_opaque, uint8_t* context); |
36 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ | 36 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ |
37 defined(__Solaris__) | 37 defined(__sun) |
38 // Linux --------------------------------------------------------------------- | 38 // Linux --------------------------------------------------------------------- |
39 | 39 |
40 // Construct a canvas from the given memory region. The memory is not cleared | 40 // Construct a canvas from the given memory region. The memory is not cleared |
41 // first. @data must be, at least, @height * StrideForWidth(@width) bytes. | 41 // first. @data must be, at least, @height * StrideForWidth(@width) bytes. |
42 PlatformCanvas(int width, int height, bool is_opaque, uint8_t* data); | 42 PlatformCanvas(int width, int height, bool is_opaque, uint8_t* data); |
43 #endif | 43 #endif |
44 | 44 |
45 virtual ~PlatformCanvas(); | 45 virtual ~PlatformCanvas(); |
46 | 46 |
47 #if defined(WIN32) | 47 #if defined(WIN32) |
48 // For two-part init, call if you use the no-argument constructor above. Note | 48 // For two-part init, call if you use the no-argument constructor above. Note |
49 // that we want this to optionally match the Linux initialize if you only | 49 // that we want this to optionally match the Linux initialize if you only |
50 // pass 3 arguments, hence the evil default argument. | 50 // pass 3 arguments, hence the evil default argument. |
51 bool initialize(int width, int height, bool is_opaque, | 51 bool initialize(int width, int height, bool is_opaque, |
52 HANDLE shared_section = NULL); | 52 HANDLE shared_section = NULL); |
53 #elif defined(__APPLE__) | 53 #elif defined(__APPLE__) |
54 // For two-part init, call if you use the no-argument constructor above | 54 // For two-part init, call if you use the no-argument constructor above |
55 bool initialize(CGContextRef context, int width, int height, bool is_opaque); | 55 bool initialize(CGContextRef context, int width, int height, bool is_opaque); |
56 bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL); | 56 bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL); |
57 | 57 |
58 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ | 58 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ |
59 defined(__Solaris__) | 59 defined(__sun) |
60 // For two-part init, call if you use the no-argument constructor above | 60 // For two-part init, call if you use the no-argument constructor above |
61 bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL); | 61 bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL); |
62 #endif | 62 #endif |
63 | 63 |
64 // Shared -------------------------------------------------------------------- | 64 // Shared -------------------------------------------------------------------- |
65 | 65 |
66 // Return the stride (length of a line in bytes) for the given width. Because | 66 // Return the stride (length of a line in bytes) for the given width. Because |
67 // we use 32-bits per pixel, this will be roughly 4*width. However, for | 67 // we use 32-bits per pixel, this will be roughly 4*width. However, for |
68 // alignment reasons we may wish to increase that. | 68 // alignment reasons we may wish to increase that. |
69 static size_t StrideForWidth(unsigned width); | 69 static size_t StrideForWidth(unsigned width); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 PlatformSurface platform_surface_; | 150 PlatformSurface platform_surface_; |
151 | 151 |
152 // Disallow copy and assign | 152 // Disallow copy and assign |
153 ScopedPlatformPaint(const ScopedPlatformPaint&); | 153 ScopedPlatformPaint(const ScopedPlatformPaint&); |
154 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&); | 154 ScopedPlatformPaint& operator=(const ScopedPlatformPaint&); |
155 }; | 155 }; |
156 | 156 |
157 } // namespace skia | 157 } // namespace skia |
158 | 158 |
159 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ | 159 #endif // SKIA_EXT_PLATFORM_CANVAS_H_ |
OLD | NEW |