diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 18:06:45 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 18:06:45 +0000 |
commit | a502bbe7a3ea0d4909e4e163ab00a1f3be483143 (patch) | |
tree | c53bf6b7492be39d1fb2eaa4cacbc74f8d0c8cb1 /skia | |
parent | 8ebb7703fb1fd95f993081e674d04167fe1413fc (diff) | |
download | chromium_src-a502bbe7a3ea0d4909e4e163ab00a1f3be483143.zip chromium_src-a502bbe7a3ea0d4909e4e163ab00a1f3be483143.tar.gz chromium_src-a502bbe7a3ea0d4909e4e163ab00a1f3be483143.tar.bz2 |
Start sorting methods in class declarations.
A lot of our headers are a mess and aren't organized. Impose the following
order on files in the base/ directory:
class Blah {
each public/protected/private section:
typedefs;
enums;
static constants;
ctors;
dtors;
methods;
overridden virtual methods;
data members;
};
BUG=68682
TEST=compiles
Review URL: http://codereview.chromium.org/6081007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/bitmap_platform_device_linux.h | 33 | ||||
-rw-r--r-- | skia/ext/convolver.h | 6 | ||||
-rw-r--r-- | skia/ext/platform_canvas.h | 41 | ||||
-rw-r--r-- | skia/ext/vector_platform_device_linux.h | 26 |
4 files changed, 52 insertions, 54 deletions
diff --git a/skia/ext/bitmap_platform_device_linux.h b/skia/ext/bitmap_platform_device_linux.h index 27109e3..d183749 100644 --- a/skia/ext/bitmap_platform_device_linux.h +++ b/skia/ext/bitmap_platform_device_linux.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -66,12 +66,6 @@ class BitmapPlatformDevice : public PlatformDevice { class BitmapPlatformDeviceData; public: - static BitmapPlatformDevice* Create(int width, int height, bool is_opaque); - - // This doesn't take ownership of |data| - static BitmapPlatformDevice* Create(int width, int height, - bool is_opaque, uint8_t* data); - // Create a BitmapPlatformDeviceLinux from an already constructed bitmap; // you should probably be using Create(). This may become private later if // we ever have to share state between some native drawing UI and Skia, like @@ -79,27 +73,30 @@ class BitmapPlatformDevice : public PlatformDevice { // // This object takes ownership of @data. BitmapPlatformDevice(const SkBitmap& other, BitmapPlatformDeviceData* data); - virtual ~BitmapPlatformDevice(); - BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); // A stub copy constructor. Needs to be properly implemented. BitmapPlatformDevice(const BitmapPlatformDevice& other); - virtual SkDeviceFactory* getDeviceFactory(); + virtual ~BitmapPlatformDevice(); - virtual void makeOpaque(int x, int y, int width, int height); + BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); - // Bitmaps aren't vector graphics. - virtual bool IsVectorial(); + static BitmapPlatformDevice* Create(int width, int height, bool is_opaque); - // If someone wants to paint on a Cairo surface version of our - // buffer, then give them the surface we're already using. - virtual cairo_t* beginPlatformPaint(); + // This doesn't take ownership of |data| + static BitmapPlatformDevice* Create(int width, int height, + bool is_opaque, uint8_t* data); - // Loads the given transform and clipping region into the HDC. This is - // overridden from SkDevice. + virtual void makeOpaque(int x, int y, int width, int height); + + // Overridden from SkDevice: + virtual SkDeviceFactory* getDeviceFactory(); virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region); + // Overridden from PlatformDevice: + virtual bool IsVectorial(); + virtual cairo_t* beginPlatformPaint(); + private: static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, cairo_surface_t* surface); diff --git a/skia/ext/convolver.h b/skia/ext/convolver.h index 97f191c..80c48a9 100644 --- a/skia/ext/convolver.h +++ b/skia/ext/convolver.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -25,11 +25,11 @@ namespace skia { // Entries are stored in fixed point, shifted left by kShiftBits. class ConvolutionFilter1D { public: + typedef short Fixed; + // The number of bits that fixed point values are shifted by. enum { kShiftBits = 14 }; - typedef short Fixed; - ConvolutionFilter1D(); ~ConvolutionFilter1D(); diff --git a/skia/ext/platform_canvas.h b/skia/ext/platform_canvas.h index 1e51717..fd65fc0 100644 --- a/skia/ext/platform_canvas.h +++ b/skia/ext/platform_canvas.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. @@ -24,32 +24,15 @@ class PlatformCanvas : public SkCanvas { // Set is_opaque if you are going to erase the bitmap and not use // transparency: this will enable some optimizations. PlatformCanvas(int width, int height, bool is_opaque); - virtual ~PlatformCanvas(); #if defined(WIN32) - // Windows ------------------------------------------------------------------ - // The shared_section parameter is passed to gfx::PlatformDevice::create. // See it for details. PlatformCanvas(int width, int height, bool is_opaque, HANDLE shared_section); - - // For two-part init, call if you use the no-argument constructor above. Note - // that we want this to optionally match the Linux initialize if you only - // pass 3 arguments, hence the evil default argument. - bool initialize(int width, int height, bool is_opaque, - HANDLE shared_section = NULL); - #elif defined(__APPLE__) - // Mac ----------------------------------------------------------------------- - PlatformCanvas(int width, int height, bool is_opaque, CGContextRef context); PlatformCanvas(int width, int height, bool is_opaque, uint8_t* context); - - // For two-part init, call if you use the no-argument constructor above - bool initialize(CGContextRef context, int width, int height, bool is_opaque); - bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL); - #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ defined(__Solaris__) // Linux --------------------------------------------------------------------- @@ -57,11 +40,27 @@ class PlatformCanvas : public SkCanvas { // Construct a canvas from the given memory region. The memory is not cleared // first. @data must be, at least, @height * StrideForWidth(@width) bytes. PlatformCanvas(int width, int height, bool is_opaque, uint8_t* data); +#endif + + virtual ~PlatformCanvas(); +#if defined(WIN32) + // For two-part init, call if you use the no-argument constructor above. Note + // that we want this to optionally match the Linux initialize if you only + // pass 3 arguments, hence the evil default argument. + bool initialize(int width, int height, bool is_opaque, + HANDLE shared_section = NULL); +#elif defined(__APPLE__) // For two-part init, call if you use the no-argument constructor above + bool initialize(CGContextRef context, int width, int height, bool is_opaque); bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL); +#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ + defined(__Solaris__) + // For two-part init, call if you use the no-argument constructor above + bool initialize(int width, int height, bool is_opaque, uint8_t* data = NULL); #endif + // Shared -------------------------------------------------------------------- // These calls should surround calls to platform drawing routines, the @@ -99,6 +98,9 @@ class PlatformCanvas : public SkCanvas { using SkCanvas::clipRect; private: + // Helper method used internally by the initialize() methods. + bool initializeWithDevice(SkDevice* device); + // 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. @@ -107,9 +109,6 @@ class PlatformCanvas : public SkCanvas { // CoreGraphics. virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap); - // Helper method used internally by the initialize() methods. - bool initializeWithDevice(SkDevice* device); - // Disallow copy and assign. PlatformCanvas(const PlatformCanvas&); PlatformCanvas& operator=(const PlatformCanvas&); diff --git a/skia/ext/vector_platform_device_linux.h b/skia/ext/vector_platform_device_linux.h index 1cf8a0c..eb767cc 100644 --- a/skia/ext/vector_platform_device_linux.h +++ b/skia/ext/vector_platform_device_linux.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -14,11 +14,12 @@ namespace skia { class VectorPlatformDeviceFactory : public SkDeviceFactory { public: - virtual SkDevice* newDevice(SkBitmap::Config config, int width, int height, - bool isOpaque, bool isForLayer); - static SkDevice* CreateDevice(cairo_t* context, int width, int height, bool isOpaque); + + // Overridden from SkDeviceFactory: + virtual SkDevice* newDevice(SkBitmap::Config config, int width, int height, + bool isOpaque, bool isForLayer); }; // This device is basically a wrapper that provides a surface for SkCanvas @@ -28,17 +29,23 @@ class VectorPlatformDeviceFactory : public SkDeviceFactory { // meaningless. class VectorPlatformDevice : public PlatformDevice { public: + virtual ~VectorPlatformDevice(); + // Factory function. Ownership of |context| is not transferred. static VectorPlatformDevice* create(PlatformSurface context, int width, int height); - virtual ~VectorPlatformDevice(); + // Clean up cached fonts. It is an error to call this while some + // VectorPlatformDevice callee is still using fonts created for it by this + // class. + static void ClearFontCache(); + + // Overridden from SkDevice (through PlatformDevice): virtual SkDeviceFactory* getDeviceFactory(); + // Overridden from PlatformDevice: virtual bool IsVectorial(); virtual PlatformSurface beginPlatformPaint(); - - // We translate following skia APIs into corresponding Cairo APIs. virtual void drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, const SkMatrix& matrix, const SkPaint& paint); virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, @@ -69,11 +76,6 @@ class VectorPlatformDevice : public PlatformDevice { virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region); - // Clean up cached fonts. It is an error to call this while some - // VectorPlatformDevice callee is still using fonts created for it by this - // class. - static void ClearFontCache(); - protected: explicit VectorPlatformDevice(PlatformSurface context, const SkBitmap& bitmap); |