| 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 BASE_GFX_PLATFORM_CANVAS_LINUX_H_ | 5 #ifndef BASE_GFX_PLATFORM_CANVAS_LINUX_H_ |
| 6 #define BASE_GFX_PLATFORM_CANVAS_LINUX_H_ | 6 #define BASE_GFX_PLATFORM_CANVAS_LINUX_H_ |
| 7 | 7 |
| 8 #include "base/gfx/platform_device_linux.h" | 8 #include "base/gfx/platform_device_linux.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 | 10 |
| 11 #import "SkCanvas.h" | 11 #import "SkCanvas.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 | 14 |
| 15 // This class is a specialization of the regular SkCanvas that is designed to | 15 // This class is a specialization of the regular SkCanvas that is designed to |
| 16 // work with a gfx::PlatformDevice to manage platform-specific drawing. It | 16 // work with a gfx::PlatformDevice to manage platform-specific drawing. It |
| 17 // allows using both Skia operations and platform-specific operations. | 17 // allows using both Skia operations and platform-specific operations. |
| 18 class PlatformCanvasLinux : public SkCanvas { | 18 class PlatformCanvasLinux : public SkCanvas { |
| 19 public: | 19 public: |
| 20 // Set is_opaque if you are going to erase the bitmap and not use | 20 // Set is_opaque if you are going to erase the bitmap and not use |
| 21 // tranparency: this will enable some optimizations. The shared_section | 21 // tranparency: this will enable some optimizations. The shared_section |
| 22 // parameter is passed to gfx::PlatformDevice::create. See it for details. | 22 // parameter is passed to gfx::PlatformDevice::create. See it for details. |
| 23 // | 23 // |
| 24 // If you use the version with no arguments, you MUST call initialize() | 24 // If you use the version with no arguments, you MUST call initialize() |
| 25 PlatformCanvasLinux(); | 25 PlatformCanvasLinux(); |
| 26 PlatformCanvasLinux(int width, int height, bool is_opaque); | 26 PlatformCanvasLinux(int width, int height, bool is_opaque); |
| 27 virtual ~PlatformCanvasLinux(); | 27 virtual ~PlatformCanvasLinux(); |
| 28 | 28 |
| 29 // For two-part init, call if you use the no-argument constructor above | 29 // For two-part init, call if you use the no-argument constructor above |
| 30 void initialize(int width, int height, bool is_opaque); | 30 bool initialize(int width, int height, bool is_opaque); |
| 31 | 31 |
| 32 // Returns the platform device pointer of the topmost rect with a non-empty | 32 // Returns the platform device pointer of the topmost rect with a non-empty |
| 33 // clip. Both the windows and mac versions have an equivalent of this method; | 33 // clip. Both the windows and mac versions have an equivalent of this method; |
| 34 // a Linux version is added for compatibility. | 34 // a Linux version is added for compatibility. |
| 35 PlatformDeviceLinux& getTopPlatformDevice() const; | 35 PlatformDeviceLinux& getTopPlatformDevice() const; |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 // Creates a device store for use by the canvas. We override this so that | 38 // Creates a device store for use by the canvas. We override this so that |
| 39 // the device is always our own so we know that we can use GDI operations | 39 // the device is always our own so we know that we can use GDI operations |
| 40 // on it. Simply calls into createPlatformDevice(). | 40 // on it. Simply calls into createPlatformDevice(). |
| 41 virtual SkDevice* createDevice(SkBitmap::Config, int width, int height, | 41 virtual SkDevice* createDevice(SkBitmap::Config, int width, int height, |
| 42 bool is_opaque); | 42 bool is_opaque); |
| 43 | 43 |
| 44 // Creates a device store for use by the canvas. By default, it creates a | 44 // Creates a device store for use by the canvas. By default, it creates a |
| 45 // BitmapPlatformDevice object. Can be overridden to change the object type. | 45 // BitmapPlatformDevice object. Can be overridden to change the object type. |
| 46 virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque); | 46 virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque); |
| 47 | 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(PlatformCanvasLinux); | 48 DISALLOW_COPY_AND_ASSIGN(PlatformCanvasLinux); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace gfx | 51 } // namespace gfx |
| 52 | 52 |
| 53 #endif // BASE_GFX_PLATFORM_CANVAS_MAC_H_ | 53 #endif // BASE_GFX_PLATFORM_CANVAS_MAC_H_ |
| OLD | NEW |