| 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 19 matching lines...) Expand all Loading... |
| 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 bool initialize(int width, int height, bool is_opaque, uint8_t* data); |
| 34 | 34 |
| 35 // 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 |
| 36 // 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; |
| 37 // a Linux version is added for compatibility. | 37 // a Linux version is added for compatibility. |
| 38 PlatformDeviceLinux& getTopPlatformDevice() const; | 38 PlatformDeviceLinux& getTopPlatformDevice() const; |
| 39 | 39 |
| 40 // See comment in platform_device_linux.h. |
| 41 virtual PlatformDeviceLinux::XDrawable getXDrawable(); |
| 42 |
| 40 // Return the stride (length of a line in bytes) for the given width. Because | 43 // Return the stride (length of a line in bytes) for the given width. Because |
| 41 // we use 32-bits per pixel, this will be roughly 4*width. However, for | 44 // we use 32-bits per pixel, this will be roughly 4*width. However, for |
| 42 // alignment reasons we may wish to increase that. | 45 // alignment reasons we may wish to increase that. |
| 43 static size_t StrideForWidth(unsigned width); | 46 static size_t StrideForWidth(unsigned width); |
| 44 | 47 |
| 45 protected: | 48 protected: |
| 46 // Creates a device store for use by the canvas. We override this so that | 49 // Creates a device store for use by the canvas. We override this so that |
| 47 // the device is always our own so we know that we can use GDI operations | 50 // the device is always our own so we know that we can use GDI operations |
| 48 // on it. Simply calls into createPlatformDevice(). | 51 // on it. Simply calls into createPlatformDevice(). |
| 49 virtual SkDevice* createDevice(SkBitmap::Config, int width, int height, | 52 virtual SkDevice* createDevice(SkBitmap::Config, int width, int height, |
| 50 bool is_opaque, bool isForLayer); | 53 bool is_opaque, bool isForLayer); |
| 51 | 54 |
| 52 // Creates a device store for use by the canvas. By default, it creates a | 55 // Creates a device store for use by the canvas. By default, it creates a |
| 53 // BitmapPlatformDevice object. Can be overridden to change the object type. | 56 // BitmapPlatformDevice object. Can be overridden to change the object type. |
| 54 virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque); | 57 virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque); |
| 55 | 58 |
| 56 // Disallow copy and assign. | 59 // Disallow copy and assign. |
| 57 PlatformCanvasLinux(const PlatformCanvasLinux&); | 60 PlatformCanvasLinux(const PlatformCanvasLinux&); |
| 58 PlatformCanvasLinux& operator=(const PlatformCanvasLinux&); | 61 PlatformCanvasLinux& operator=(const PlatformCanvasLinux&); |
| 59 }; | 62 }; |
| 60 | 63 |
| 61 } // namespace skia | 64 } // namespace skia |
| 62 | 65 |
| 63 #endif // SKIA_EXT_PLATFORM_CANVAS_LINUX_H_ | 66 #endif // SKIA_EXT_PLATFORM_CANVAS_LINUX_H_ |
| OLD | NEW |