diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-14 16:58:55 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-14 16:58:55 +0000 |
commit | 87080c619c9d60f0ed3aa988d89b36c35eca95b1 (patch) | |
tree | 93d5c34a529858c1d891a55a092ee53efd06976b /skia | |
parent | c31085d9656ff79a389318ffc7afed0fd2cd296c (diff) | |
download | chromium_src-87080c619c9d60f0ed3aa988d89b36c35eca95b1.zip chromium_src-87080c619c9d60f0ed3aa988d89b36c35eca95b1.tar.gz chromium_src-87080c619c9d60f0ed3aa988d89b36c35eca95b1.tar.bz2 |
Remove a bunch of base dependencies from skia/ext. The only nontrivial change is
in bitmap_platform_device_mac. The refcounting now matches the way the Windows
file works.
Review URL: http://codereview.chromium.org/17627
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8015 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/bitmap_platform_device_linux.cc | 7 | ||||
-rwxr-xr-x | skia/ext/bitmap_platform_device_mac.cc | 16 | ||||
-rwxr-xr-x | skia/ext/bitmap_platform_device_mac.h | 7 | ||||
-rw-r--r-- | skia/ext/convolver.cc | 4 | ||||
-rw-r--r-- | skia/ext/convolver.h | 2 | ||||
-rw-r--r-- | skia/ext/platform_canvas_linux.cc | 6 | ||||
-rwxr-xr-x | skia/ext/platform_canvas_mac.cc | 20 | ||||
-rwxr-xr-x | skia/ext/platform_device_mac.cc | 8 | ||||
-rw-r--r-- | skia/ext/skia_utils.h | 4 | ||||
-rw-r--r-- | skia/ext/skia_utils_win.h | 4 |
10 files changed, 41 insertions, 37 deletions
diff --git a/skia/ext/bitmap_platform_device_linux.cc b/skia/ext/bitmap_platform_device_linux.cc index 4e4615f..6f7277e 100644 --- a/skia/ext/bitmap_platform_device_linux.cc +++ b/skia/ext/bitmap_platform_device_linux.cc @@ -6,8 +6,6 @@ #include <cairo/cairo.h> -#include "base/logging.h" - namespace skia { // ----------------------------------------------------------------------------- @@ -32,7 +30,10 @@ class BitmapPlatformDeviceLinux::BitmapPlatformDeviceLinuxData cairo_surface_destroy(surface_); } - DISALLOW_EVIL_CONSTRUCTORS(BitmapPlatformDeviceLinuxData); + // Disallow copy & assign. + BitmapPlatformDeviceLinuxData(const BitmapPlatformDeviceLinuxData&); + BitmapPlatformDeviceLinuxData& operator=( + const BitmapPlatformDeviceLinuxData&); }; // We use this static factory function instead of the regular constructor so diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc index f544684..9b4beb0 100755 --- a/skia/ext/bitmap_platform_device_mac.cc +++ b/skia/ext/bitmap_platform_device_mac.cc @@ -8,9 +8,9 @@ #include "SkMatrix.h" #include "SkRegion.h" +#include "SkTypes.h" #include "SkUtils.h" -#include "base/logging.h" #include "skia/ext/skia_utils_mac.h" namespace skia { @@ -46,8 +46,7 @@ bool Constrain(int available_size, int* position, int *size) { } // namespace -class BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData - : public base::RefCounted<BitmapPlatformDeviceMacData> { +class BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData : public SkRefCnt { public: explicit BitmapPlatformDeviceMacData(CGContextRef bitmap); @@ -58,7 +57,7 @@ class BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData } void ReleaseBitmapContext() { - DCHECK(bitmap_context_); + SkASSERT(bitmap_context_); CGContextRelease(bitmap_context_); bitmap_context_ = NULL; } @@ -95,7 +94,9 @@ class BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData CGContextRelease(bitmap_context_); } - DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDeviceMacData); + // Disallow copy & assign. + BitmapPlatformDeviceMacData(const BitmapPlatformDeviceMacData&); + BitmapPlatformDeviceMacData& operator=(const BitmapPlatformDeviceMacData&); }; BitmapPlatformDeviceMac::\ @@ -103,7 +104,7 @@ BitmapPlatformDeviceMac::\ CGContextRef bitmap) : bitmap_context_(bitmap), config_dirty_(true) { // Want to load the config next time. - DCHECK(bitmap_context_); + SkASSERT(bitmap_context_); // Initialize the clip region to the entire bitmap. SkIRect rect; @@ -203,14 +204,17 @@ BitmapPlatformDeviceMac::BitmapPlatformDeviceMac( : PlatformDeviceMac( const_cast<BitmapPlatformDeviceMac&>(other).accessBitmap(true)), data_(other.data_) { + data_->ref(); } BitmapPlatformDeviceMac::~BitmapPlatformDeviceMac() { + data_->unref(); } BitmapPlatformDeviceMac& BitmapPlatformDeviceMac::operator=( const BitmapPlatformDeviceMac& other) { data_ = other.data_; + data_->ref(); return *this; } diff --git a/skia/ext/bitmap_platform_device_mac.h b/skia/ext/bitmap_platform_device_mac.h index 01176aa..2e31eb2 100755 --- a/skia/ext/bitmap_platform_device_mac.h +++ b/skia/ext/bitmap_platform_device_mac.h @@ -81,12 +81,13 @@ class BitmapPlatformDeviceMac : public PlatformDeviceMac { // starts accessing pixel data. virtual void onAccessBitmap(SkBitmap*); - // Data associated with this device, guaranteed non-null. - scoped_refptr<BitmapPlatformDeviceMacData> data_; - virtual void processPixels(int x, int y, int width, int height, adjustAlpha adjustor); + + // Data associated with this device, guaranteed non-null. We hold a reference + // to this object. + BitmapPlatformDeviceMacData* data_; }; } // namespace skia diff --git a/skia/ext/convolver.cc b/skia/ext/convolver.cc index 930f9e5..f826b53 100644 --- a/skia/ext/convolver.cc +++ b/skia/ext/convolver.cc @@ -127,7 +127,7 @@ void ConvolveHorizontally(const unsigned char* src_data, const unsigned char* row_to_filter = &src_data[filter_offset * 4]; // Apply the filter to the row to get the destination pixel in |accum|. - int32 accum[4] = {0}; + int accum[4] = {0}; for (int filter_x = 0; filter_x < filter_length; filter_x++) { ConvolusionFilter1D::Fixed cur_filter = filter_values[filter_x]; accum[0] += cur_filter * row_to_filter[filter_x * 4 + 0]; @@ -174,7 +174,7 @@ void ConvolveVertically(const ConvolusionFilter1D::Fixed* filter_values, int byte_offset = out_x * 4; // Apply the filter to one column of pixels. - int32 accum[4] = {0}; + int accum[4] = {0}; for (int filter_y = 0; filter_y < filter_length; filter_y++) { ConvolusionFilter1D::Fixed cur_filter = filter_values[filter_y]; accum[0] += cur_filter * source_data_rows[filter_y][byte_offset + 0]; diff --git a/skia/ext/convolver.h b/skia/ext/convolver.h index 225a17d..91c7ccb 100644 --- a/skia/ext/convolver.h +++ b/skia/ext/convolver.h @@ -7,8 +7,6 @@ #include <vector> -#include "base/basictypes.h" - // avoid confusion with Mac OS X's math library (Carbon) #if defined(__APPLE__) #undef FloatToFixed diff --git a/skia/ext/platform_canvas_linux.cc b/skia/ext/platform_canvas_linux.cc index 578575a..5c14707 100644 --- a/skia/ext/platform_canvas_linux.cc +++ b/skia/ext/platform_canvas_linux.cc @@ -4,9 +4,9 @@ #include "skia/ext/platform_canvas_linux.h" -#include "base/logging.h" #include "skia/ext/platform_device_linux.h" #include "skia/ext/bitmap_platform_device_linux.h" +#include "SkTypes.h" namespace skia { @@ -16,7 +16,7 @@ PlatformCanvasLinux::PlatformCanvasLinux() : SkCanvas() { PlatformCanvasLinux::PlatformCanvasLinux(int width, int height, bool is_opaque) : SkCanvas() { if (!initialize(width, height, is_opaque)) - CHECK(false); + SK_CRASH(); } PlatformCanvasLinux::~PlatformCanvasLinux() { @@ -42,7 +42,7 @@ SkDevice* PlatformCanvasLinux::createDevice(SkBitmap::Config config, int width, int height, bool is_opaque, bool isForLayer) { - DCHECK(config == SkBitmap::kARGB_8888_Config); + SkASSERT(config == SkBitmap::kARGB_8888_Config); return createPlatformDevice(width, height, is_opaque); } diff --git a/skia/ext/platform_canvas_mac.cc b/skia/ext/platform_canvas_mac.cc index 5b5845c..6d08454 100755 --- a/skia/ext/platform_canvas_mac.cc +++ b/skia/ext/platform_canvas_mac.cc @@ -4,8 +4,8 @@ #include "skia/ext/platform_canvas_mac.h" -#include "base/logging.h" #include "skia/ext/bitmap_platform_device_mac.h" +#include "SkTypes.h" namespace skia { @@ -55,24 +55,24 @@ PlatformDeviceMac& PlatformCanvasMac::getTopPlatformDevice() const { } SkDevice* PlatformCanvasMac::createDevice(SkBitmap::Config config, - int width, - int height, - bool is_opaque, bool isForLayer) { - DCHECK(config == SkBitmap::kARGB_8888_Config); + int width, + int height, + bool is_opaque, bool isForLayer) { + SkASSERT(config == SkBitmap::kARGB_8888_Config); return createPlatformDevice(width, height, is_opaque, NULL); } SkDevice* PlatformCanvasMac::createPlatformDevice(int width, - int height, - bool is_opaque, - CGContextRef context) { + int height, + bool is_opaque, + CGContextRef context) { SkDevice* device = BitmapPlatformDeviceMac::Create(context, width, height, - is_opaque); + is_opaque); return device; } SkDevice* PlatformCanvasMac::setBitmapDevice(const SkBitmap&) { - NOTREACHED(); + SkASSERT(false); return NULL; } diff --git a/skia/ext/platform_device_mac.cc b/skia/ext/platform_device_mac.cc index 58c775d..6722105 100755 --- a/skia/ext/platform_device_mac.cc +++ b/skia/ext/platform_device_mac.cc @@ -4,10 +4,10 @@ #include "skia/ext/bitmap_platform_device_mac.h" -#include "base/logging.h" #include "skia/ext/skia_utils_mac.h" #include "SkMatrix.h" #include "SkPath.h" +#include "SkTypes.h" #include "SkUtils.h" namespace skia { @@ -89,7 +89,7 @@ void PlatformDeviceMac::LoadPathToCGContext(CGContextRef context, } case SkPath::kDone_Verb: // iter.next returns 0 points default: { - NOTREACHED(); + SkASSERT(false); break; } } @@ -110,7 +110,7 @@ void PlatformDeviceMac::LoadTransformToCGContext(CGContextRef context, CGContextConcatCTM(context, orig_cg_matrix_inv); // assert that we have indeed returned to the identity Matrix. - DCHECK(CGAffineTransformIsIdentity(CGContextGetCTM(context))); + SkASSERT(CGAffineTransformIsIdentity(CGContextGetCTM(context))); // Convert xform to CG-land. // Our coordinate system is flipped to match WebKit's so we need to modify @@ -154,7 +154,7 @@ void PlatformDeviceMac::LoadClippingRegionToCGContext( // transform so apply it manually. path.transform(transformation); // TODO(playmobil): Implement. - NOTREACHED(); + SkASSERT(false); // LoadPathToDC(context, path); // hrgn = PathToRegion(context); } diff --git a/skia/ext/skia_utils.h b/skia/ext/skia_utils.h index 86cb8f54..4ab40f3 100644 --- a/skia/ext/skia_utils.h +++ b/skia/ext/skia_utils.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_GFX_SKIA_UTILS_H_ -#define BASE_GFX_SKIA_UTILS_H_ +#ifndef SKIA_EXT_SKIA_UTILS_H_ +#define SKIA_EXT_SKIA_UTILS_H_ #include "SkColor.h" #include "SkShader.h" diff --git a/skia/ext/skia_utils_win.h b/skia/ext/skia_utils_win.h index 677892e..bf58fba 100644 --- a/skia/ext/skia_utils_win.h +++ b/skia/ext/skia_utils_win.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_GFX_SKIA_UTILS_WIN_H_ -#define BASE_GFX_SKIA_UTILS_WIN_H_ +#ifndef SKIA_EXT_SKIA_UTILS_WIN_H_ +#define SKIA_EXT_SKIA_UTILS_WIN_H_ #include "SkColor.h" |