diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 18:52:38 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 18:52:38 +0000 |
commit | 6165b4070b7e3a2fd33efd0eb66043c86f61d8b2 (patch) | |
tree | d2f7f195c13274ca524d264dc34639e276805325 /base/gfx/platform_canvas_mac.h | |
parent | 941ac7fca4afc89cb28ffa760f5a4a4ca077912c (diff) | |
download | chromium_src-6165b4070b7e3a2fd33efd0eb66043c86f61d8b2.zip chromium_src-6165b4070b7e3a2fd33efd0eb66043c86f61d8b2.tar.gz chromium_src-6165b4070b7e3a2fd33efd0eb66043c86f61d8b2.tar.bz2 |
Move PlatformCanvas and PlatformDevice from base/gfx to webkit/port. I left header files in the original locations that include the ones in the new location so I don't have to change all the includes in Chrome at once. These will be removed later.
I kept the names, indenting, and the namespaces the same for now. I will also be cleaning this up in separate passes.
Review URL: http://codereview.chromium.org/11244
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/gfx/platform_canvas_mac.h')
-rwxr-xr-x | base/gfx/platform_canvas_mac.h | 80 |
1 files changed, 3 insertions, 77 deletions
diff --git a/base/gfx/platform_canvas_mac.h b/base/gfx/platform_canvas_mac.h index 3f79fb3..6ee78e8 100755 --- a/base/gfx/platform_canvas_mac.h +++ b/base/gfx/platform_canvas_mac.h @@ -5,83 +5,9 @@ #ifndef BASE_GFX_PLATFORM_CANVAS_MAC_H__ #define BASE_GFX_PLATFORM_CANVAS_MAC_H__ -#include "base/gfx/platform_device_mac.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 PlatformCanvasMac : 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() - PlatformCanvasMac(); - PlatformCanvasMac(int width, int height, bool is_opaque); - PlatformCanvasMac(int width, int height, bool is_opaque, CGContextRef context); - virtual ~PlatformCanvasMac(); - - // For two-part init, call if you use the no-argument constructor above - bool initialize(int width, int height, bool is_opaque); - - // These calls should surround calls to platform drawing routines. The CG - // context returned by beginPlatformPaint is the one that can be used to - // draw into. - // Call endPlatformPaint when you are done and want to use Skia operations - // again; this will synchronize the bitmap. - virtual CGContextRef beginPlatformPaint(); - virtual void endPlatformPaint(); - - // Returns the platform device pointer of the topmost rect with a non-empty - // clip. In practice, this is usually either the top layer or nothing, since - // we usually set the clip to new layers when we make them. - // - // If there is no layer that is not all clipped out, this will return a - // dummy device so callers do not have to check. If you are concerned about - // performance, check the clip before doing any painting. - // - // This is different than SkCanvas' getDevice, because that returns the - // bottommost device. - // - // Danger: the resulting device should not be saved. It will be invalidated - // by the next call to save() or restore(). - PlatformDeviceMac& getTopPlatformDevice() const; - - // Allow callers to see the non-virtual function even though we have an - // override of a virtual one. - using SkCanvas::clipRect; - - 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, bool isForLayer); - - // 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, - CGContextRef context); - - private: - // Unimplemented. This is to try to prevent people from calling this function - // on SkCanvas. SkCanvas' version is not virtual, so we can't prevent this - // 100%, but hopefully this will make people notice and not use the function. - // Calling SkCanvas' version will create a new device which is not compatible - // with us and we will crash if somebody tries to draw into it with - // CoreGraphics. - SkDevice* setBitmapDevice(const SkBitmap& bitmap); - - DISALLOW_COPY_AND_ASSIGN(PlatformCanvasMac); -}; - -} // namespace gfx +// TODO(brettw) this file should be removed and the includes changed to this +// new location. +#include "webkit/port/platform/graphics/skia/public/PlatformCanvasMac.h" #endif // BASE_GFX_PLATFORM_CANVAS_MAC_H__ |