re-guard against negative dimensions on no-draw canvas

We used to (incidentally) guard for this when we used bitmapdevice as our backnig.
Now that we have a (faster) nodrawdevice, we need to explicitly guard for it.

BUG=skia:

Change-Id: I9cbbf064cbfced78f0004a2e5aff60aa3ded6215
Reviewed-on: https://skia-review.googlesource.com/9530
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 6140bcc..6ce38ea 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -57,9 +57,12 @@
 public:
     SkNoPixelsDevice(const SkIRect& bounds, const SkSurfaceProps& props)
         : SkBaseDevice(SkImageInfo::MakeUnknown(bounds.width(), bounds.height()), props)
-    {}
+    {
+        SkASSERT(bounds.width() >= 0 && bounds.height() >= 0);
+    }
 
     void resetForNextPicture(const SkIRect& bounds) {
+        SkASSERT(bounds.width() >= 0 && bounds.height() >= 0);
         this->privateResize(bounds.width(), bounds.height());
     }
 
@@ -688,7 +691,7 @@
 {
     inc_canvas();
 
-    this->init(new SkNoPixelsDevice(SkIRect::MakeWH(width, height), fProps),
+    this->init(new SkNoPixelsDevice(SkIRect::MakeWH(SkTMax(width, 0), SkTMax(height, 0)), fProps),
                kDefault_InitFlags)->unref();
 }
 
@@ -698,7 +701,8 @@
 {
     inc_canvas();
 
-    this->init(new SkNoPixelsDevice(bounds, fProps), flags)->unref();
+    SkIRect r = bounds.isEmpty() ? SkIRect::MakeEmpty() : bounds;
+    this->init(new SkNoPixelsDevice(r, fProps), flags)->unref();
 }
 
 SkCanvas::SkCanvas(SkBaseDevice* device)