diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 22:34:22 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 22:34:22 +0000 |
commit | 96ffd0f9c67f2be3f77c630d11c5d24fa32db736 (patch) | |
tree | f60125c88d7b61536530b0bf1926c0b7a1b337c7 /base/gfx/platform_canvas_linux.h | |
parent | a03a3b25f70f7cf8b061b32c04f0575625b1bc6e (diff) | |
download | chromium_src-96ffd0f9c67f2be3f77c630d11c5d24fa32db736.zip chromium_src-96ffd0f9c67f2be3f77c630d11c5d24fa32db736.tar.gz chromium_src-96ffd0f9c67f2be3f77c630d11c5d24fa32db736.tar.bz2 |
Provide what looks like the minimal platform specific interface for skia. This will undoubtedly grow in the future.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/gfx/platform_canvas_linux.h')
-rw-r--r-- | base/gfx/platform_canvas_linux.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/base/gfx/platform_canvas_linux.h b/base/gfx/platform_canvas_linux.h new file mode 100644 index 0000000..4030a55 --- /dev/null +++ b/base/gfx/platform_canvas_linux.h @@ -0,0 +1,53 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_GFX_PLATFORM_CANVAS_LINUX_H_ +#define BASE_GFX_PLATFORM_CANVAS_LINUX_H_ + +#include "base/gfx/platform_device_linux.h" +#include "base/basictypes.h" + +#import "SkCanvas.h" + +namespace gfx { + +// This class is a specialization of the regular SkCanvas that is designed to +// work with a gfx::PlatformDevice to manage platform-specific drawing. It +// allows using both Skia operations and platform-specific operations. +class PlatformCanvasLinux : public SkCanvas { + public: + // Set is_opaque if you are going to erase the bitmap and not use + // tranparency: this will enable some optimizations. The shared_section + // parameter is passed to gfx::PlatformDevice::create. See it for details. + // + // If you use the version with no arguments, you MUST call initialize() + PlatformCanvasLinux(); + PlatformCanvasLinux(int width, int height, bool is_opaque); + virtual ~PlatformCanvasLinux(); + + // For two-part init, call if you use the no-argument constructor above + void initialize(int width, int height, bool is_opaque); + + // Returns the platform device pointer of the topmost rect with a non-empty + // clip. Both the windows and mac versions have an equivalent of this method; + // a Linux version is added for compatibility. + PlatformDeviceLinux& getTopPlatformDevice() const; + + protected: + // Creates a device store for use by the canvas. We override this so that + // the device is always our own so we know that we can use GDI operations + // on it. Simply calls into createPlatformDevice(). + virtual SkDevice* createDevice(SkBitmap::Config, int width, int height, + bool is_opaque); + + // Creates a device store for use by the canvas. By default, it creates a + // BitmapPlatformDevice object. Can be overridden to change the object type. + virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque); + + DISALLOW_COPY_AND_ASSIGN(PlatformCanvasLinux); +}; + +} // namespace gfx + +#endif // BASE_GFX_PLATFORM_CANVAS_MAC_H_ |