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_LINUX_H_ | 5 #ifndef SKIA_EXT_PLATFORM_CANVAS_LINUX_H_ |
6 #define SKIA_EXT_PLATFORM_CANVAS_LINUX_H_ | 6 #define SKIA_EXT_PLATFORM_CANVAS_LINUX_H_ |
7 | 7 |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 | 9 |
10 #include "skia/ext/platform_device_linux.h" | 10 #include "skia/ext/platform_device_linux.h" |
(...skipping 12 matching lines...) Expand all Loading... |
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 PlatformCanvasLinux(); | 24 PlatformCanvasLinux(); |
25 PlatformCanvasLinux(int width, int height, bool is_opaque); | 25 PlatformCanvasLinux(int width, int height, bool is_opaque); |
26 // Construct a canvas from the given memory region. The memory is not cleared | 26 // Construct a canvas from the given memory region. The memory is not cleared |
27 // first. @data must be, at least, @height * StrideForWidth(@width) bytes. | 27 // first. @data must be, at least, @height * StrideForWidth(@width) bytes. |
28 PlatformCanvasLinux(int width, int height, bool is_opaque, uint8_t* data); | 28 PlatformCanvasLinux(int width, int height, bool is_opaque, uint8_t* data); |
29 virtual ~PlatformCanvasLinux(); | 29 virtual ~PlatformCanvasLinux(); |
30 | 30 |
31 // For two-part init, call if you use the no-argument constructor above | 31 // For two-part init, call if you use the no-argument constructor above |
32 bool initialize(int width, int height, bool is_opaque); | 32 bool initialize(int width, int height, bool is_opaque); |
| 33 bool initialize(int width, int height, bool is_opaque, uint8_t* data); |
33 | 34 |
34 // Returns the platform device pointer of the topmost rect with a non-empty | 35 // Returns the platform device pointer of the topmost rect with a non-empty |
35 // clip. Both the windows and mac versions have an equivalent of this method; | 36 // clip. Both the windows and mac versions have an equivalent of this method; |
36 // a Linux version is added for compatibility. | 37 // a Linux version is added for compatibility. |
37 PlatformDeviceLinux& getTopPlatformDevice() const; | 38 PlatformDeviceLinux& getTopPlatformDevice() const; |
38 | 39 |
39 // Return the stride (length of a line in bytes) for the given width. Because | 40 // Return the stride (length of a line in bytes) for the given width. Because |
40 // we use 32-bits per pixel, this will be roughly 4*width. However, for | 41 // we use 32-bits per pixel, this will be roughly 4*width. However, for |
41 // alignment reasons we may wish to increase that. | 42 // alignment reasons we may wish to increase that. |
42 static size_t StrideForWidth(unsigned width); | 43 static size_t StrideForWidth(unsigned width); |
(...skipping 10 matching lines...) Expand all Loading... |
53 virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque); | 54 virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque); |
54 | 55 |
55 // Disallow copy and assign. | 56 // Disallow copy and assign. |
56 PlatformCanvasLinux(const PlatformCanvasLinux&); | 57 PlatformCanvasLinux(const PlatformCanvasLinux&); |
57 PlatformCanvasLinux& operator=(const PlatformCanvasLinux&); | 58 PlatformCanvasLinux& operator=(const PlatformCanvasLinux&); |
58 }; | 59 }; |
59 | 60 |
60 } // namespace skia | 61 } // namespace skia |
61 | 62 |
62 #endif // SKIA_EXT_PLATFORM_CANVAS_LINUX_H_ | 63 #endif // SKIA_EXT_PLATFORM_CANVAS_LINUX_H_ |
OLD | NEW |