aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkDevice.h
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-22 19:25:14 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-22 19:25:14 +0000
commit532470f34dbe9fc0b8b71e3917eca8894feaf336 (patch)
tree32189d576d8183776ac6ace8cdebce1d55600bb3 /include/core/SkDevice.h
parentda7cb287682a1bcc1c2703fdf75a4dce867e5cc9 (diff)
Expose geometry and gamma on device.
Diffstat (limited to 'include/core/SkDevice.h')
-rw-r--r--include/core/SkDevice.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 5c32f768a5..81bbf43cb4 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -14,6 +14,7 @@
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkColor.h"
+#include "SkDeviceProperties.h"
class SkClipStack;
class SkDraw;
@@ -37,6 +38,13 @@ public:
SkDevice(const SkBitmap& bitmap);
/**
+ * 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(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties);
+
+ /**
* 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.
@@ -51,6 +59,23 @@ public:
*/
SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false);
+ /**
+ * 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.
+ * @param deviceProperties Properties which affect compositing.
+ */
+ SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
+ const SkDeviceProperties& deviceProperties);
+
virtual ~SkDevice();
/**
@@ -84,6 +109,12 @@ public:
*/
virtual int height() const { return fBitmap.height(); }
+ /** Return the image properties of the device. */
+ virtual const SkDeviceProperties& getDeviceProperties() const {
+ //Currently, all the properties are leaky.
+ return fLeakyProperties;
+ }
+
/**
* Return the bounds of the device in the coordinate space of the root
* canvas. The root device will have its top-left at 0,0, but other devices
@@ -418,6 +449,13 @@ private:
SkBitmap fBitmap;
SkIPoint fOrigin;
SkMetaData* fMetaData;
+ /**
+ * Leaky properties are those which the device should be applying but it isn't.
+ * These properties will be applied by the draw, when and as it can.
+ * If the device does handle a property, that property should be set to the identity value
+ * for that property, effectively making it non-leaky.
+ */
+ SkDeviceProperties fLeakyProperties;
#ifdef SK_DEBUG
bool fAttachedToCanvas;