add getDeviceSize() so callers won't need to call getDevice() so much
... we hope to make devices private in the future



git-svn-id: http://skia.googlecode.com/svn/trunk@2577 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 160b8fb..b2bdafe 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -61,6 +61,13 @@
 
     ///////////////////////////////////////////////////////////////////////////
 
+    /**
+     *  Return the width/height of the underlying device. The current drawable
+     *  area may be small (due to clipping or saveLayer). For a canvas with
+     *  no device, 0,0 will be returned.
+     */
+    SkISize getDeviceSize() const;
+
     /** Return the canvas' device object, which may be null. The device holds
         the bitmap of the pixels that the canvas draws into. The reference count
         of the returned device is not changed by this call.
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 293b10f..3ea9a9c 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -466,6 +466,11 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
+SkISize SkCanvas::getDeviceSize() const {
+    SkDevice* d = this->getDevice();
+    return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
+}
+
 SkDevice* SkCanvas::getDevice() const {
     // return root device
     SkDeque::F2BIter iter(fMCStack);