diff options
author | 2011-06-16 19:10:39 +0000 | |
---|---|---|
committer | 2011-06-16 19:10:39 +0000 | |
commit | af951c9bc4cbb6e60b430194fe5127ebe99c53fb (patch) | |
tree | b1eba8d71a9db8d02de1cf5ca0c13f7a5f6f1e4e /include/core | |
parent | 3cbd37535083a83d517e9d032ba732c2ff8afc6b (diff) |
make SkDevice constructors explicit between offscreen and on/direct
http://codereview.appspot.com/4632044/
git-svn-id: http://skia.googlecode.com/svn/trunk@1620 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkCanvas.h | 4 | ||||
-rw-r--r-- | include/core/SkDevice.h | 33 |
2 files changed, 24 insertions, 13 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 273153f991..d5032a76c4 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -101,13 +101,13 @@ public: is raster, the pixels will be allocated automatically. */ virtual SkDevice* createDevice(SkBitmap::Config, int width, int height, - bool isOpaque, bool forLayer = false); + bool isOpaque); /** * Create a new raster device and make it current. This also returns * the new device. */ - SkDevice* setBitmapDevice(const SkBitmap& bitmap, bool forLayer = false); + SkDevice* setBitmapDevice(const SkBitmap& bitmap); /** * Return the current device factory, or NULL. The reference count of diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index d9a4fde4c2..ff9c4d1361 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -52,18 +52,30 @@ public: class SK_API SkDevice : public SkRefCnt { public: - SkDevice(SkCanvas*); - /** Construct a new device, extracting the width/height/config/isOpaque values from - the bitmap. If transferPixelOwnership is true, and the bitmap claims to own its - own pixels (getOwnsPixels() == true), then transfer this responsibility to the - device, and call setOwnsPixels(false) on the bitmap. +// SkDevice(); - Subclasses may override the destructor, which is virtual, even though this class - doesn't have one. SkRefCnt does. - - @param bitmap A copy of this bitmap is made and stored in the device + /** + * Construct a new device with the specified bitmap as its backend. It is + * valid for the bitmap to have no pixels associated with it. In that case, + * any drawing to this device will have no effect. */ - SkDevice(SkCanvas*, const SkBitmap& bitmap, bool forOffscreen); + SkDevice(const SkBitmap& bitmap); + + /** + * Create a new raster device and have the pixels be automatically + * allocated. The rowBytes of the device will be computed automatically + * based on the config and the width. + * + * @param config The desired config for the pixels. If the request cannot + * be met, the closest matching support config will be used. + * @param width width (in pixels) of the device + * @param height height (in pixels) of the device + * @param isOpaque Set to true if it is known that all of the pixels will + * be drawn to opaquely. Used as an accelerator when drawing + * these pixels to another device. + */ + SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false); + virtual ~SkDevice(); /** @@ -276,7 +288,6 @@ private: // just called by SkCanvas when built as a layer void setOrigin(int x, int y) { fOrigin.set(x, y); } - SkCanvas* fCanvas; SkBitmap fBitmap; SkIPoint fOrigin; SkMetaData* fMetaData; |