diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkCanvas.h | 4 | ||||
-rw-r--r-- | include/core/SkDevice.h | 33 | ||||
-rw-r--r-- | include/gpu/SkGpuDevice.h | 21 | ||||
-rw-r--r-- | include/utils/SkProxyCanvas.h | 2 |
4 files changed, 38 insertions, 22 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; diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h index 96afa082ff..4d0efeb511 100644 --- a/include/gpu/SkGpuDevice.h +++ b/include/gpu/SkGpuDevice.h @@ -19,6 +19,7 @@ #define SkGpuDevice_DEFINED #include "SkGr.h" +#include "SkBitmap.h" #include "SkDevice.h" #include "SkRegion.h" @@ -33,15 +34,19 @@ class GrTextContext; class SK_API SkGpuDevice : public SkDevice { public: /** - * The SkGpuDevice will render to the GrRenderTarget, or if the paremeter is - * null it will create its own render target and manage that target's - * lifetime. Setting isSaveLayer to true is for internal use and may cause - * problems when using the device's bitmap as a src if used externally. + * New device that will create an offscreen renderTarget based on the + * config, width, height. + * + * isForSaveLayer is a special flag that should only be set by SkCanvas + * internally. */ - SkGpuDevice(GrContext*, - const SkBitmap& bitmap, - GrRenderTarget* renderTargetOrNull, - bool isSaveLayer = false); + SkGpuDevice(GrContext*, SkBitmap::Config, int width, int height, + bool isForSaveLayer = false); + + /** + * New device that will render to the specified renderTarget. + */ + SkGpuDevice(GrContext*, GrRenderTarget*); /** * Magic value that can be passed to constructor. Causes diff --git a/include/utils/SkProxyCanvas.h b/include/utils/SkProxyCanvas.h index 6e55aa6251..5d03c071b7 100644 --- a/include/utils/SkProxyCanvas.h +++ b/include/utils/SkProxyCanvas.h @@ -76,7 +76,7 @@ public: virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter); virtual SkDevice* createDevice(SkBitmap::Config, int width, int height, - bool isOpaque, bool isForLayer); + bool isOpaque); private: SkCanvas* fProxy; |