diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 19:28:25 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-19 19:28:25 +0000 |
commit | d92c63f171edb6857fb63222f89109afa1b71a5e (patch) | |
tree | 0dc1f27818fd9fb15ae45d731e9d4dbf90269c1a | |
parent | 8028882175eb5843e68b6a686aebc1025e55fef4 (diff) | |
download | chromium_src-d92c63f171edb6857fb63222f89109afa1b71a5e.zip chromium_src-d92c63f171edb6857fb63222f89109afa1b71a5e.tar.gz chromium_src-d92c63f171edb6857fb63222f89109afa1b71a5e.tar.bz2 |
More Linux build fixes.
Add the bitmap platform device file to the scons and revert a reversion
introduced in the move.
Review URL: http://codereview.chromium.org/11484
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5697 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/SConscript.port | 1 | ||||
-rw-r--r-- | webkit/port/platform/graphics/skia/public/BitmapPlatformDeviceLinux.cpp | 52 |
2 files changed, 44 insertions, 9 deletions
diff --git a/webkit/SConscript.port b/webkit/SConscript.port index bb7fa95..7509ff2 100644 --- a/webkit/SConscript.port +++ b/webkit/SConscript.port @@ -134,6 +134,7 @@ if env['PLATFORM'] == 'posix': '$PORT_DIR/platform/graphics/skia/public/PlatformCanvasLinux.cpp', '$PORT_DIR/platform/graphics/skia/public/PlatformDeviceLinux.cpp', + '$PORT_DIR/platform/graphics/skia/public/BitmapPlatformDeviceLinux.cpp', ]) if env['PLATFORM'] == 'darwin': diff --git a/webkit/port/platform/graphics/skia/public/BitmapPlatformDeviceLinux.cpp b/webkit/port/platform/graphics/skia/public/BitmapPlatformDeviceLinux.cpp index c80a273..18f8ab1 100644 --- a/webkit/port/platform/graphics/skia/public/BitmapPlatformDeviceLinux.cpp +++ b/webkit/port/platform/graphics/skia/public/BitmapPlatformDeviceLinux.cpp @@ -10,6 +10,31 @@ namespace gfx { +// ----------------------------------------------------------------------------- +// These objects are reference counted and own a Cairo surface. The surface is +// the backing store for a Skia bitmap and we reference count it so that we can +// copy BitmapPlatformDeviceLinux objects without having to copy all the image +// data. +// ----------------------------------------------------------------------------- +class BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinuxData + : public base::RefCounted<BitmapPlatformDeviceLinuxData> { + public: + explicit BitmapPlatformDeviceLinuxData(cairo_surface_t* surface) + : surface_(surface) { } + + cairo_surface_t* surface() const { return surface_; } + + protected: + cairo_surface_t *const surface_; + + friend class base::RefCounted<BitmapPlatformDeviceLinuxData>; + ~BitmapPlatformDeviceLinuxData() { + cairo_surface_destroy(surface_); + } + + DISALLOW_EVIL_CONSTRUCTORS(BitmapPlatformDeviceLinuxData); +}; + // We use this static factory function instead of the regular constructor so // that we can create the pixel data before calling the constructor. This is // required so that we can call the base class' constructor with the pixel @@ -33,28 +58,37 @@ BitmapPlatformDeviceLinux* BitmapPlatformDeviceLinux::Create( #endif // The device object will take ownership of the graphics context. - return new BitmapPlatformDeviceLinux(bitmap, surface); + return new BitmapPlatformDeviceLinux + (bitmap, new BitmapPlatformDeviceLinuxData(surface)); } // The device will own the bitmap, which corresponds to also owning the pixel // data. Therefore, we do not transfer ownership to the SkDevice's bitmap. -BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinux(const SkBitmap& bitmap, - cairo_surface_t* surface) +BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinux( + const SkBitmap& bitmap, + BitmapPlatformDeviceLinuxData* data) : PlatformDeviceLinux(bitmap), - surface_(surface) { + data_(data) { } BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinux( const BitmapPlatformDeviceLinux& other) : PlatformDeviceLinux(const_cast<BitmapPlatformDeviceLinux&>( - other).accessBitmap(true)) { + other).accessBitmap(true)), + data_(other.data_) { } BitmapPlatformDeviceLinux::~BitmapPlatformDeviceLinux() { - if (surface_) { - cairo_surface_destroy(surface_); - surface_ = NULL; - } +} + +cairo_surface_t* BitmapPlatformDeviceLinux::surface() const { + return data_->surface(); +} + +BitmapPlatformDeviceLinux& BitmapPlatformDeviceLinux::operator=( + const BitmapPlatformDeviceLinux& other) { + data_ = other.data_; + return *this; } } // namespace gfx |