diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-17 23:29:40 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-17 23:29:40 +0000 |
commit | 21f527e6a4a812b604dd0891b27878d8418c04d9 (patch) | |
tree | 4dec5cb778e0b0755606f1d2113b3b6097188f85 /skia | |
parent | f8a2599cd63347322133ffa5c89195d66dc3d4b3 (diff) | |
download | chromium_src-21f527e6a4a812b604dd0891b27878d8418c04d9.zip chromium_src-21f527e6a4a812b604dd0891b27878d8418c04d9.tar.gz chromium_src-21f527e6a4a812b604dd0891b27878d8418c04d9.tar.bz2 |
Move the "platform" wrappers in skia/ext to the skia namespace.
Review URL: http://codereview.chromium.org/14110
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7182 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
28 files changed, 104 insertions, 110 deletions
diff --git a/skia/ext/bitmap_platform_device.h b/skia/ext/bitmap_platform_device.h index d33ae73..fcc8644c 100644 --- a/skia/ext/bitmap_platform_device.h +++ b/skia/ext/bitmap_platform_device.h @@ -8,23 +8,20 @@ #if defined(WIN32) #include "skia/ext/bitmap_platform_device_win.h" -namespace gfx { - -typedef BitmapPlatformDeviceWin BitmapPlatformDevice; - -} // namespace gfx #elif defined(__APPLE__) #include "skia/ext/bitmap_platform_device_mac.h" -namespace gfx { - -typedef BitmapPlatformDeviceMac BitmapPlatformDevice; - -} // namespace gfx #elif defined(__linux__) #include "skia/ext/bitmap_platform_device_linux.h" -namespace gfx { +#endif -typedef BitmapPlatformDeviceLinux BitmapPlatformDevice; +namespace skia { -} // namespace gfx +#if defined(WIN32) +typedef BitmapPlatformDeviceWin BitmapPlatformDevice; +#elif defined(__APPLE__) +typedef BitmapPlatformDeviceMac BitmapPlatformDevice; +#elif defined(__linux__) +typedef BitmapPlatformDeviceLinux BitmapPlatformDevice; #endif + +} // namespace skia diff --git a/skia/ext/bitmap_platform_device_linux.cc b/skia/ext/bitmap_platform_device_linux.cc index 4dd322d..4e4615f 100644 --- a/skia/ext/bitmap_platform_device_linux.cc +++ b/skia/ext/bitmap_platform_device_linux.cc @@ -8,7 +8,7 @@ #include "base/logging.h" -namespace gfx { +namespace skia { // ----------------------------------------------------------------------------- // These objects are reference counted and own a Cairo surface. The surface is @@ -91,4 +91,4 @@ BitmapPlatformDeviceLinux& BitmapPlatformDeviceLinux::operator=( return *this; } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/bitmap_platform_device_linux.h b/skia/ext/bitmap_platform_device_linux.h index 14e4c0c..b4f0c1bc 100644 --- a/skia/ext/bitmap_platform_device_linux.h +++ b/skia/ext/bitmap_platform_device_linux.h @@ -40,7 +40,7 @@ typedef struct _cairo_surface cairo_surface_t; // something that we can't easily change. // ----------------------------------------------------------------------------- -namespace gfx { +namespace skia { // ----------------------------------------------------------------------------- // This is the Linux bitmap backing for Skia. We create a Cairo image surface @@ -86,6 +86,6 @@ class BitmapPlatformDeviceLinux : public PlatformDeviceLinux { scoped_refptr<BitmapPlatformDeviceLinuxData> data_; }; -} // namespace gfx +} // namespace skia #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_LINUX_H_ diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc index 52ce586..b338c9f 100755 --- a/skia/ext/bitmap_platform_device_mac.cc +++ b/skia/ext/bitmap_platform_device_mac.cc @@ -13,7 +13,7 @@ #include "base/logging.h" #include "skia/ext/skia_utils_mac.h" -namespace gfx { +namespace skia { namespace { @@ -23,7 +23,7 @@ namespace { bool Constrain(int available_size, int* position, int *size) { if (*size < -2) return false; - + if (*position < 0) { if (*size != -1) *size += *position; @@ -31,7 +31,7 @@ bool Constrain(int available_size, int* position, int *size) { } if (*size == 0 || *position >= available_size) return false; - + if (*size > 0) { int overflow = (*position + *size) - available_size; if (overflow > 0) { @@ -44,7 +44,7 @@ bool Constrain(int available_size, int* position, int *size) { return true; } -} // namespace +} // namespace class BitmapPlatformDeviceMac::BitmapPlatformDeviceMacData : public base::RefCounted<BitmapPlatformDeviceMacData> { @@ -104,8 +104,8 @@ BitmapPlatformDeviceMac::\ : bitmap_context_(bitmap), config_dirty_(true) { // Want to load the config next time. DCHECK(bitmap_context_); - // Initialize the clip region to the entire bitmap. - + // Initialize the clip region to the entire bitmap. + SkIRect rect; rect.set(0, 0, CGBitmapContextGetWidth(bitmap_context_), @@ -151,12 +151,12 @@ BitmapPlatformDeviceMac* BitmapPlatformDeviceMac::Create(CGContextRef context, SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); bitmap.setPixels(data); - + // Note: The Windows implementation clears the Bitmap later on. // This bears mentioning since removal of this line makes the // unit tests only fail periodically (or when MallocPreScribble is set). bitmap.eraseARGB(0, 0, 0, 0); - + bitmap.setIsOpaque(is_opaque); if (is_opaque) { @@ -166,14 +166,14 @@ BitmapPlatformDeviceMac* BitmapPlatformDeviceMac::Create(CGContextRef context, bitmap.eraseARGB(255, 0, 255, 128); // bright bluish green #endif } - + CGColorSpaceRef color_space = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); // allocate a bitmap context with 4 components per pixel (RGBA): CGContextRef bitmap_context = CGBitmapContextCreate(data, width, height, 8, width*4, color_space, kCGImageAlphaPremultipliedLast); - + // Change the coordinate system to match WebCore's CGContextTranslateCTM(bitmap_context, 0, height); CGContextScaleCTM(bitmap_context, 1.0, -1.0); @@ -251,7 +251,7 @@ void BitmapPlatformDeviceMac::DrawToContext(CGContextRef context, int x, int y, if (created_dc) data_->ReleaseBitmapContext(); } - + // Returns the color value at the specified location. SkColor BitmapPlatformDeviceMac::getColorAt(int x, int y) { const SkBitmap& bitmap = accessBitmap(true); @@ -265,7 +265,7 @@ void BitmapPlatformDeviceMac::onAccessBitmap(SkBitmap*) { } void BitmapPlatformDeviceMac::processPixels(int x, int y, - int width, int height, + int width, int height, adjustAlpha adjustor) { const SkBitmap& bitmap = accessBitmap(true); SkMatrix& matrix = data_->transform_; @@ -286,5 +286,5 @@ void BitmapPlatformDeviceMac::processPixels(int x, int y, } } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/bitmap_platform_device_mac.h b/skia/ext/bitmap_platform_device_mac.h index db798eb..01176aa 100755 --- a/skia/ext/bitmap_platform_device_mac.h +++ b/skia/ext/bitmap_platform_device_mac.h @@ -8,7 +8,7 @@ #include "base/ref_counted.h" #include "skia/ext/platform_device_mac.h" -namespace gfx { +namespace skia { // A device is basically a wrapper around SkBitmap that provides a surface for // SkCanvas to draw into. Our device provides a surface CoreGraphics can also @@ -85,11 +85,11 @@ class BitmapPlatformDeviceMac : public PlatformDeviceMac { scoped_refptr<BitmapPlatformDeviceMacData> data_; virtual void processPixels(int x, int y, - int width, int height, + int width, int height, adjustAlpha adjustor); }; -} // namespace gfx +} // namespace skia #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc index 63efc8f..674a6d9 100644 --- a/skia/ext/bitmap_platform_device_win.cc +++ b/skia/ext/bitmap_platform_device_win.cc @@ -10,7 +10,7 @@ #include "SkRegion.h" #include "SkUtils.h" -namespace gfx { +namespace skia { // When Windows draws text, is sets the fourth byte (which Skia uses for alpha) // to zero. This means that if we try compositing with text that Windows has @@ -242,7 +242,7 @@ BitmapPlatformDeviceWin* BitmapPlatformDeviceWin::create(HDC screen_dc, } BITMAPINFOHEADER hdr = {0}; - CreateBitmapHeader(width, height, &hdr); + gfx::CreateBitmapHeader(width, height, &hdr); void* data = NULL; HBITMAP hbitmap = CreateDIBSection(screen_dc, @@ -442,5 +442,5 @@ void BitmapPlatformDeviceWin::processPixels(int x, } } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/bitmap_platform_device_win.h b/skia/ext/bitmap_platform_device_win.h index e392306ea..e3b63cb 100644 --- a/skia/ext/bitmap_platform_device_win.h +++ b/skia/ext/bitmap_platform_device_win.h @@ -8,7 +8,7 @@ #include "base/ref_counted.h" #include "skia/ext/platform_device_win.h" -namespace gfx { +namespace skia { // A device is basically a wrapper around SkBitmap that provides a surface for // SkCanvas to draw into. Our device provides a surface Windows can also write @@ -105,7 +105,7 @@ class BitmapPlatformDeviceWin : public PlatformDeviceWin { scoped_refptr<BitmapPlatformDeviceWinData> data_; }; -} // namespace gfx +} // namespace skia #endif // SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ diff --git a/skia/ext/convolver_unittest.cc b/skia/ext/convolver_unittest.cc index f93b2e5..10db76c 100644 --- a/skia/ext/convolver_unittest.cc +++ b/skia/ext/convolver_unittest.cc @@ -123,5 +123,5 @@ TEST(Convolver, Halve) { } } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h index b1e4310..e0883e3 100644 --- a/skia/ext/platform_canvas.h +++ b/skia/ext/platform_canvas.h @@ -8,23 +8,20 @@ #if defined(WIN32) #include "skia/ext/platform_canvas_win.h" -namespace gfx { - -typedef PlatformCanvasWin PlatformCanvas; - -} // namespace gfx #elif defined(__APPLE__) #include "skia/ext/platform_canvas_mac.h" -namespace gfx { - -typedef PlatformCanvasMac PlatformCanvas; - -} // namespace gfx #elif defined(__linux__) #include "skia/ext/platform_canvas_linux.h" -namespace gfx { +#endif -typedef PlatformCanvasLinux PlatformCanvas; +namespace skia { -} // namespace gfx +#if defined(WIN32) +typedef PlatformCanvasWin PlatformCanvas; +#elif defined(__APPLE__) +typedef PlatformCanvasMac PlatformCanvas; +#elif defined(__linux__) +typedef PlatformCanvasLinux PlatformCanvas; #endif + +} // namespace skia diff --git a/skia/ext/platform_canvas_linux.cc b/skia/ext/platform_canvas_linux.cc index ba2fe81..578575a 100644 --- a/skia/ext/platform_canvas_linux.cc +++ b/skia/ext/platform_canvas_linux.cc @@ -8,7 +8,7 @@ #include "skia/ext/platform_device_linux.h" #include "skia/ext/bitmap_platform_device_linux.h" -namespace gfx { +namespace skia { PlatformCanvasLinux::PlatformCanvasLinux() : SkCanvas() { } @@ -52,4 +52,4 @@ SkDevice* PlatformCanvasLinux::createPlatformDevice(int width, return BitmapPlatformDeviceLinux::Create(width, height, is_opaque); } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/platform_canvas_linux.h b/skia/ext/platform_canvas_linux.h index 93919c6..1a5afe7 100644 --- a/skia/ext/platform_canvas_linux.h +++ b/skia/ext/platform_canvas_linux.h @@ -7,7 +7,7 @@ #include "skia/ext/platform_device_linux.h" -namespace gfx { +namespace skia { // This class is a specialization of the regular SkCanvas that is designed to // work with a gfx::PlatformDevice to manage platform-specific drawing. It @@ -47,6 +47,6 @@ class PlatformCanvasLinux : public SkCanvas { PlatformCanvasLinux& operator=(const PlatformCanvasLinux&); }; -} // namespace gfx +} // namespace skia #endif // SKIA_EXT_PLATFORM_CANVAS_LINUX_H_ diff --git a/skia/ext/platform_canvas_mac.cc b/skia/ext/platform_canvas_mac.cc index 0bb56f4..5b5845c 100755 --- a/skia/ext/platform_canvas_mac.cc +++ b/skia/ext/platform_canvas_mac.cc @@ -7,7 +7,7 @@ #include "base/logging.h" #include "skia/ext/bitmap_platform_device_mac.h" -namespace gfx { +namespace skia { PlatformCanvasMac::PlatformCanvasMac() : SkCanvas() { } @@ -76,5 +76,5 @@ SkDevice* PlatformCanvasMac::setBitmapDevice(const SkBitmap&) { return NULL; } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/platform_canvas_mac.h b/skia/ext/platform_canvas_mac.h index 3f43fb2..adcdb86 100755 --- a/skia/ext/platform_canvas_mac.h +++ b/skia/ext/platform_canvas_mac.h @@ -9,7 +9,7 @@ #include "SkCanvas.h" -namespace gfx { +namespace skia { // This class is a specialization of the regular SkCanvas that is designed to // work with a gfx::PlatformDevice to manage platform-specific drawing. It @@ -82,7 +82,7 @@ class PlatformCanvasMac : public SkCanvas { PlatformCanvasMac& operator=(const PlatformCanvasMac&); }; -} // namespace gfx +} // namespace skia #endif // SKIA_EXT_PLATFORM_CANVAS_MAC_H_ diff --git a/skia/ext/platform_canvas_unittest.cc b/skia/ext/platform_canvas_unittest.cc index a59ef1c..d382477 100644 --- a/skia/ext/platform_canvas_unittest.cc +++ b/skia/ext/platform_canvas_unittest.cc @@ -18,7 +18,7 @@ #include "SkColor.h" -namespace gfx { +namespace skia { namespace { @@ -292,5 +292,5 @@ TEST(PlatformCanvas, TranslateLayer) { kInnerW, kInnerH)); } -} // namespace +} // namespace skia diff --git a/skia/ext/platform_canvas_win.cc b/skia/ext/platform_canvas_win.cc index e3dffeb7..4062d7b 100644 --- a/skia/ext/platform_canvas_win.cc +++ b/skia/ext/platform_canvas_win.cc @@ -8,7 +8,7 @@ #include "base/process_util.h" #include "skia/ext/bitmap_platform_device_win.h" -namespace gfx { +namespace skia { // Crashes the process. This is called when a bitmap allocation fails, and this // function tries to determine why it might have failed, and crash on different @@ -114,4 +114,4 @@ SkDevice* PlatformCanvasWin::setBitmapDevice(const SkBitmap&) { return NULL; } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/platform_canvas_win.h b/skia/ext/platform_canvas_win.h index c3f42a3..c16fa33 100644 --- a/skia/ext/platform_canvas_win.h +++ b/skia/ext/platform_canvas_win.h @@ -12,11 +12,11 @@ #include "SkCanvas.h" -namespace gfx { +namespace skia { // 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. +// work with a PlatformDevice to manage platform-specific drawing. It allows +// using both Skia operations and platform-specific operations. class PlatformCanvasWin : public SkCanvas { public: // Set is_opaque if you are going to erase the bitmap and not use @@ -196,7 +196,7 @@ class CanvasPaintT : public T { typedef CanvasPaintT<PlatformCanvasWin> PlatformCanvasWinPaint; -} // namespace gfx +} // namespace skia #endif // SKIA_EXT_PLATFORM_CANVAS_WIN_H_ diff --git a/skia/ext/platform_device.h b/skia/ext/platform_device.h index 811dfa6..413a47f 100644 --- a/skia/ext/platform_device.h +++ b/skia/ext/platform_device.h @@ -14,7 +14,7 @@ #include "skia/ext/platform_device_linux.h" #endif -namespace gfx { +namespace skia { #if defined(WIN32) typedef PlatformDeviceWin PlatformDevice; @@ -24,4 +24,4 @@ typedef PlatformDeviceMac PlatformDevice; typedef PlatformDeviceLinux PlatformDevice; #endif -} // namespace gfx +} // namespace skia diff --git a/skia/ext/platform_device_linux.cc b/skia/ext/platform_device_linux.cc index f148ed1..e8d12ec 100644 --- a/skia/ext/platform_device_linux.cc +++ b/skia/ext/platform_device_linux.cc @@ -4,10 +4,10 @@ #include "skia/ext/platform_device_linux.h" -namespace gfx { +namespace skia { PlatformDeviceLinux::PlatformDeviceLinux(const SkBitmap& bitmap) : SkDevice(bitmap) { } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/platform_device_linux.h b/skia/ext/platform_device_linux.h index 185baf0..5c16c08 100644 --- a/skia/ext/platform_device_linux.h +++ b/skia/ext/platform_device_linux.h @@ -7,7 +7,7 @@ #include "SkDevice.h" -namespace gfx { +namespace skia { // Blindly copying the mac hierarchy. class PlatformDeviceLinux : public SkDevice { @@ -20,6 +20,6 @@ class PlatformDeviceLinux : public SkDevice { PlatformDeviceLinux(const SkBitmap& bitmap); }; -} // namespace gfx +} // namespace skia #endif // SKIA_EXT_PLATFORM_DEVICE_LINUX_H_ diff --git a/skia/ext/platform_device_mac.cc b/skia/ext/platform_device_mac.cc index 3cc6fb4..58c775d 100755 --- a/skia/ext/platform_device_mac.cc +++ b/skia/ext/platform_device_mac.cc @@ -10,7 +10,10 @@ #include "SkPath.h" #include "SkUtils.h" -namespace gfx { +namespace skia { + +// TODO(brettw) remove this when the gfx namespaces are all removed. +using namespace gfx; namespace { @@ -157,5 +160,5 @@ void PlatformDeviceMac::LoadClippingRegionToCGContext( } } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/platform_device_mac.h b/skia/ext/platform_device_mac.h index 589448c..dbfed5c 100755 --- a/skia/ext/platform_device_mac.h +++ b/skia/ext/platform_device_mac.h @@ -12,7 +12,7 @@ class SkMatrix; class SkPath; class SkRegion; -namespace gfx { +namespace skia { // A device is basically a wrapper around SkBitmap that provides a surface for // SkCanvas to draw into. Our device provides a surface CoreGraphics can also @@ -80,7 +80,7 @@ class PlatformDeviceMac : public SkDevice { adjustAlpha adjustor) = 0; }; -} // namespace gfx +} // namespace skia #endif // SKIA_EXT_PLATFORM_DEVICE_MAC_H_ diff --git a/skia/ext/platform_device_win.cc b/skia/ext/platform_device_win.cc index 5a94efa..905e9bf 100644 --- a/skia/ext/platform_device_win.cc +++ b/skia/ext/platform_device_win.cc @@ -11,10 +11,7 @@ #include "SkRegion.h" #include "SkUtils.h" -namespace gfx { - -// TODO(brettw) remove this when this file is moved into the Skia namespace. -using namespace skia; +namespace skia { PlatformDeviceWin::PlatformDeviceWin(const SkBitmap& bitmap) : SkDevice(bitmap) { @@ -228,5 +225,5 @@ void PlatformDeviceWin::LoadClippingRegionToDC(HDC context, DCHECK_NE(result, 0); } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/platform_device_win.h b/skia/ext/platform_device_win.h index e01a2c5..506bd6a 100644 --- a/skia/ext/platform_device_win.h +++ b/skia/ext/platform_device_win.h @@ -15,7 +15,7 @@ class SkMatrix; class SkPath; class SkRegion; -namespace gfx { +namespace skia { // A device is basically a wrapper around SkBitmap that provides a surface for // SkCanvas to draw into. Our device provides a surface Windows can also write @@ -92,7 +92,7 @@ class PlatformDeviceWin : public SkDevice { static bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath); }; -} // namespace gfx +} // namespace skia #endif // SKIA_EXT_PLATFORM_DEVICE_WIN_H_ diff --git a/skia/ext/vector_canvas.cc b/skia/ext/vector_canvas.cc index a671852..33ac265 100644 --- a/skia/ext/vector_canvas.cc +++ b/skia/ext/vector_canvas.cc @@ -7,7 +7,7 @@ #include "base/logging.h" #include "skia/ext/vector_device.h" -namespace gfx { +namespace skia { VectorCanvas::VectorCanvas() { } @@ -86,5 +86,5 @@ bool VectorCanvas::IsTopDeviceVectorial() const { return getTopPlatformDevice().IsVectorial(); } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/vector_canvas.h b/skia/ext/vector_canvas.h index 66a45eb..6b61b58 100644 --- a/skia/ext/vector_canvas.h +++ b/skia/ext/vector_canvas.h @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_GFX_VECTOR_CANVAS_H_ -#define BASE_GFX_VECTOR_CANVAS_H_ +#ifndef SKIA_EXT_VECTOR_CANVAS_H_ +#define SKIA_EXT_VECTOR_CANVAS_H_ #include "skia/ext/platform_canvas_win.h" #include "skia/ext/vector_device.h" -namespace gfx { +namespace skia { // This class is a specialization of the regular PlatformCanvas. It is designed // to work with a VectorDevice to manage platform-specific drawing. It allows @@ -40,7 +40,7 @@ class VectorCanvas : public PlatformCanvasWin { DISALLOW_COPY_AND_ASSIGN(VectorCanvas); }; -} // namespace gfx +} // namespace skia -#endif // BASE_GFX_VECTOR_CANVAS_H_ +#endif // SKIA_EXT_VECTOR_CANVAS_H_ diff --git a/skia/ext/vector_canvas_unittest.cc b/skia/ext/vector_canvas_unittest.cc index b50c230..03e920f 100644 --- a/skia/ext/vector_canvas_unittest.cc +++ b/skia/ext/vector_canvas_unittest.cc @@ -19,6 +19,8 @@ #include "SkDashPathEffect.h" +namespace skia { + namespace { const wchar_t* const kGenerateSwitch = L"vector-canvas-generate"; @@ -138,7 +140,7 @@ class Image { } // Loads the image from a canvas. - Image(const gfx::PlatformCanvasWin& canvas) : ignore_alpha_(true) { + Image(const skia::PlatformCanvasWin& canvas) : ignore_alpha_(true) { // Use a different way to access the bitmap. The normal way would be to // query the SkBitmap. HDC context = canvas.getTopPlatformDevice().getBitmapDC(); @@ -277,7 +279,7 @@ class ImageTest : public DataUnitTest { // kGenerating value. Returns 0 on success or any positive value between ]0, // 100] on failure. The return value is the percentage of difference between // the image in the file and the image in the canvas. - double ProcessCanvas(const gfx::PlatformCanvasWin& canvas, + double ProcessCanvas(const skia::PlatformCanvasWin& canvas, std::wstring filename) const { filename += L".png"; switch (action_) { @@ -296,8 +298,8 @@ class ImageTest : public DataUnitTest { // Compares the bitmap currently loaded in the context with the file. Returns // the percentage of pixel difference between both images, between 0 and 100. - double CompareImage(const gfx::PlatformCanvasWin& canvas, - const std::wstring& filename) const { + double CompareImage(const skia::PlatformCanvasWin& canvas, + const std::wstring& filename) const { Image image1(canvas); Image image2(test_file(filename)); double diff = image1.PercentageDifferent(image2); @@ -305,7 +307,7 @@ class ImageTest : public DataUnitTest { } // Saves the bitmap currently loaded in the context into the file. - void SaveImage(const gfx::PlatformCanvasWin& canvas, + void SaveImage(const skia::PlatformCanvasWin& canvas, const std::wstring& filename) const { Image(canvas).SaveToFile(test_file(filename)); } @@ -395,8 +397,8 @@ class VectorCanvasTest : public ImageTest { size_ = size; context_ = new Context(); bitmap_ = new Bitmap(*context_, size_, size_); - vcanvas_ = new gfx::VectorCanvas(context_->context(), size_, size_); - pcanvas_ = new gfx::PlatformCanvasWin(size_, size_, false); + vcanvas_ = new VectorCanvas(context_->context(), size_, size_); + pcanvas_ = new PlatformCanvasWin(size_, size_, false); // Clear white. vcanvas_->drawARGB(255, 255, 255, 255, SkPorterDuff::kSrc_Mode); @@ -437,10 +439,10 @@ class VectorCanvasTest : public ImageTest { Bitmap* bitmap_; // Vector based canvas. - gfx::VectorCanvas* vcanvas_; + VectorCanvas* vcanvas_; // Pixel based canvas. - gfx::PlatformCanvasWin* pcanvas_; + PlatformCanvasWin* pcanvas_; // When true (default), vcanvas_ and pcanvas_ contents are compared and // verified to be identical. @@ -460,8 +462,8 @@ TEST_F(VectorCanvasTest, Uninitialized) { context_ = new Context(); bitmap_ = new Bitmap(*context_, size_, size_); - vcanvas_ = new gfx::VectorCanvas(context_->context(), size_, size_); - pcanvas_ = new gfx::PlatformCanvasWin(size_, size_, false); + vcanvas_ = new VectorCanvas(context_->context(), size_, size_); + pcanvas_ = new PlatformCanvasWin(size_, size_, false); // VectorCanvas default initialization is black. // PlatformCanvas default initialization is almost white 0x01FFFEFD (invalid @@ -1007,3 +1009,4 @@ TEST_F(VectorCanvasTest, Matrix) { } } +} // namespace skia diff --git a/skia/ext/vector_device.cc b/skia/ext/vector_device.cc index bf52462..98aaeff 100644 --- a/skia/ext/vector_device.cc +++ b/skia/ext/vector_device.cc @@ -11,10 +11,7 @@ #include "SkUtils.h" -namespace gfx { - -// TODO(brettw) remove this when all the namespaces are moved to skia. -using namespace skia; +namespace skia { VectorDevice* VectorDevice::create(HDC dc, int width, int height) { InitializeDC(dc); @@ -611,5 +608,5 @@ void VectorDevice::InternalDrawBitmap(const SkBitmap& bitmap, int x, int y, Cleanup(); } -} // namespace gfx +} // namespace skia diff --git a/skia/ext/vector_device.h b/skia/ext/vector_device.h index b4f3336..5fdb9a0 100644 --- a/skia/ext/vector_device.h +++ b/skia/ext/vector_device.h @@ -10,7 +10,7 @@ #include "SkMatrix.h" #include "SkRegion.h" -namespace gfx { +namespace skia { // A device is basically a wrapper around SkBitmap that provides a surface for // SkCanvas to draw into. This specific device is not not backed by a surface @@ -113,7 +113,7 @@ class VectorDevice : public PlatformDeviceWin { DISALLOW_COPY_AND_ASSIGN(VectorDevice); }; -} // namespace gfx +} // namespace skia #endif // VectorDevice_h |