add origin to device
used for interpreting the clipstack when a device is a layer
git-svn-id: http://skia.googlecode.com/svn/trunk@894 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index c0d71c3..48b86c2 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -81,6 +81,13 @@
/** Return the height of the device (in pixels).
*/
virtual int height() const { return fBitmap.height(); }
+
+ /**
+ * Return the device's origin: its offset in device coordinates from
+ * the default origin in its canvas' matrix/clip
+ */
+ const SkIPoint& getOrigin() const { return fOrigin; }
+
/** Return the bitmap config of the device's pixels
*/
SkBitmap::Config config() const { return fBitmap.getConfig(); }
@@ -217,9 +224,14 @@
}
private:
+ friend class SkCanvas;
+ // just called by SkCanvas when built as a layer
+ void setOrigin(int x, int y) { fOrigin.set(x, y); }
+
SkCanvas* fCanvas;
SkBitmap fBitmap;
SkRefDict fRefDict;
+ SkIPoint fOrigin;
};
#endif