diff options
author | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-17 19:09:12 +0000 |
---|---|---|
committer | twiz@chromium.org <twiz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-17 19:09:12 +0000 |
commit | 38846729c719211e1d0a51f3dfb565be650545ca (patch) | |
tree | a68620820aeba423774e0d704419b4d713c694dd /skia | |
parent | 33af5ea0d848f9377628536dd2f1dc197d8b4c03 (diff) | |
download | chromium_src-38846729c719211e1d0a51f3dfb565be650545ca.zip chromium_src-38846729c719211e1d0a51f3dfb565be650545ca.tar.gz chromium_src-38846729c719211e1d0a51f3dfb565be650545ca.tar.bz2 |
CL removing unused copy constructor and assignment operators on BitmapPlatformDevice. These classes should not have value semantics.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7204005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/bitmap_platform_device_linux.cc | 15 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_linux.h | 9 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_mac.cc | 18 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_mac.h | 20 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_win.cc | 19 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_win.h | 18 |
6 files changed, 11 insertions, 88 deletions
diff --git a/skia/ext/bitmap_platform_device_linux.cc b/skia/ext/bitmap_platform_device_linux.cc index a32fafb..ae4d892 100644 --- a/skia/ext/bitmap_platform_device_linux.cc +++ b/skia/ext/bitmap_platform_device_linux.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -133,13 +133,6 @@ BitmapPlatformDevice::BitmapPlatformDevice( data_(data) { } -BitmapPlatformDevice::BitmapPlatformDevice( - const BitmapPlatformDevice& other) - : PlatformDevice(const_cast<BitmapPlatformDevice&>( - other).accessBitmap(true)), - data_(other.data_) { -} - BitmapPlatformDevice::~BitmapPlatformDevice() { } @@ -165,10 +158,4 @@ void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, data_->SetMatrixClip(transform, region); } -BitmapPlatformDevice& BitmapPlatformDevice::operator=( - const BitmapPlatformDevice& other) { - data_ = other.data_; - return *this; -} - } // namespace skia diff --git a/skia/ext/bitmap_platform_device_linux.h b/skia/ext/bitmap_platform_device_linux.h index edbd137..f96b9b7 100644 --- a/skia/ext/bitmap_platform_device_linux.h +++ b/skia/ext/bitmap_platform_device_linux.h @@ -6,6 +6,7 @@ #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ #pragma once +#include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "skia/ext/platform_device_linux.h" @@ -74,14 +75,8 @@ class BitmapPlatformDevice : public PlatformDevice { // // This object takes ownership of @data. BitmapPlatformDevice(const SkBitmap& other, BitmapPlatformDeviceData* data); - - // A stub copy constructor. Needs to be properly implemented. - BitmapPlatformDevice(const BitmapPlatformDevice& other); - virtual ~BitmapPlatformDevice(); - BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); - static BitmapPlatformDevice* Create(int width, int height, bool is_opaque); // This doesn't take ownership of |data| @@ -106,6 +101,8 @@ class BitmapPlatformDevice : public PlatformDevice { cairo_surface_t* surface); scoped_refptr<BitmapPlatformDeviceData> data_; + + DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); }; } // namespace skia diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc index b15a042..9a10bf1 100644 --- a/skia/ext/bitmap_platform_device_mac.cc +++ b/skia/ext/bitmap_platform_device_mac.cc @@ -193,28 +193,10 @@ BitmapPlatformDevice::BitmapPlatformDevice( data_(data) { } -// The copy constructor just adds another reference to the underlying data. -// We use a const cast since the default Skia definitions don't define the -// proper constedness that we expect (accessBitmap should really be const). -BitmapPlatformDevice::BitmapPlatformDevice( - const BitmapPlatformDevice& other) - : PlatformDevice( - const_cast<BitmapPlatformDevice&>(other).accessBitmap(true)), - data_(other.data_) { - data_->ref(); -} - BitmapPlatformDevice::~BitmapPlatformDevice() { data_->unref(); } -BitmapPlatformDevice& BitmapPlatformDevice::operator=( - const BitmapPlatformDevice& other) { - data_ = other.data_; - data_->ref(); - return *this; -} - CGContextRef BitmapPlatformDevice::GetBitmapContext() { data_->LoadConfig(); return data_->bitmap_context(); diff --git a/skia/ext/bitmap_platform_device_mac.h b/skia/ext/bitmap_platform_device_mac.h index 67ef633..45fbcab 100644 --- a/skia/ext/bitmap_platform_device_mac.h +++ b/skia/ext/bitmap_platform_device_mac.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,6 +6,7 @@ #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ #pragma once +#include "base/basictypes.h" #include "skia/ext/platform_device_mac.h" namespace skia { @@ -44,23 +45,8 @@ class BitmapPlatformDevice : public PlatformDevice { int width, int height, bool is_opaque); - // Copy constructor. When copied, devices duplicate their internal data, so - // stay linked. This is because their implementation is very heavyweight - // (lots of memory and CoreGraphics state). If a device has been copied, both - // clip rects and other state will stay in sync. - // - // This means it will NOT work to duplicate a device and assign it to a - // canvas, because the two canvases will each set their own clip rects, and - // the resulting CoreGraphics drawing state will be unpredictable. - // - // Copy constucting and "=" is designed for saving the device or passing it - // around to another routine willing to deal with the bitmap data directly. - BitmapPlatformDevice(const BitmapPlatformDevice& other); virtual ~BitmapPlatformDevice(); - // See warning for copy constructor above. - BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); - // PlatformDevice overrides virtual CGContextRef GetBitmapContext(); virtual void DrawToNativeContext(CGContextRef context, int x, int y, @@ -91,6 +77,8 @@ class BitmapPlatformDevice : public PlatformDevice { // Data associated with this device, guaranteed non-null. We hold a reference // to this object. BitmapPlatformDeviceData* data_; + + DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); }; } // namespace skia diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc index dcc395d..366bdd0 100644 --- a/skia/ext/bitmap_platform_device_win.cc +++ b/skia/ext/bitmap_platform_device_win.cc @@ -180,30 +180,11 @@ BitmapPlatformDevice::BitmapPlatformDevice( SkDEBUGCODE(begin_paint_count_ = 0); } -// The copy constructor just adds another reference to the underlying data. -// We use a const cast since the default Skia definitions don't define the -// proper constedness that we expect (accessBitmap should really be const). -BitmapPlatformDevice::BitmapPlatformDevice( - const BitmapPlatformDevice& other) - : PlatformDevice( - const_cast<BitmapPlatformDevice&>(other).accessBitmap(true)), - data_(other.data_) { - data_->ref(); - SkDEBUGCODE(begin_paint_count_ = 0); -} - BitmapPlatformDevice::~BitmapPlatformDevice() { SkASSERT(begin_paint_count_ == 0); data_->unref(); } -BitmapPlatformDevice& BitmapPlatformDevice::operator=( - const BitmapPlatformDevice& other) { - data_ = other.data_; - data_->ref(); - return *this; -} - HDC BitmapPlatformDevice::BeginPlatformPaint() { SkDEBUGCODE(begin_paint_count_++); return data_->GetBitmapDC(); diff --git a/skia/ext/bitmap_platform_device_win.h b/skia/ext/bitmap_platform_device_win.h index 335bb94..ea6bcc3 100644 --- a/skia/ext/bitmap_platform_device_win.h +++ b/skia/ext/bitmap_platform_device_win.h @@ -6,6 +6,7 @@ #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ #pragma once +#include "base/basictypes.h" #include "skia/ext/platform_device_win.h" namespace skia { @@ -52,23 +53,8 @@ class SK_API BitmapPlatformDevice : public PlatformDevice { bool is_opaque, HANDLE shared_section); - // Copy constructor. When copied, devices duplicate their internal data, so - // stay linked. This is because their implementation is very heavyweight - // (lots of memory and some GDI objects). If a device has been copied, both - // clip rects and other state will stay in sync. - // - // This means it will NOT work to duplicate a device and assign it to a - // canvas, because the two canvases will each set their own clip rects, and - // the resulting GDI clip rect will be random. - // - // Copy constucting and "=" is designed for saving the device or passing it - // around to another routine willing to deal with the bitmap data directly. - BitmapPlatformDevice(const BitmapPlatformDevice& other); virtual ~BitmapPlatformDevice(); - // See warning for copy constructor above. - BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); - // PlatformDevice overrides // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The // bitmap DC is lazy created. @@ -109,6 +95,8 @@ class SK_API BitmapPlatformDevice : public PlatformDevice { #ifdef SK_DEBUG int begin_paint_count_; #endif + + DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); }; } // namespace skia |