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