update srcmode GM to include aa/bw and gradients
add 'G' key to sampleapp, to toggle showing the GM's bounds as an overlay



git-svn-id: http://skia.googlecode.com/svn/trunk@6431 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/GMSampleView.h b/samplecode/GMSampleView.h
index 0b224a5..5c7729a 100644
--- a/samplecode/GMSampleView.h
+++ b/samplecode/GMSampleView.h
@@ -15,16 +15,23 @@
 
 class GMSampleView : public SampleView {
 private:
+    bool fShowSize;
     typedef skiagm::GM GM;
 
 public:
     GMSampleView(GM* gm)
-    : fGM(gm) {}
+    : fGM(gm), fShowSize(false) {}
 
     virtual ~GMSampleView() {
         delete fGM;
     }
 
+    static SkEvent* NewShowSizeEvt(bool doShowSize) {
+        SkEvent* evt = SkNEW_ARGS(SkEvent, ("GMSampleView::showSize"));
+        evt->setFast32(doShowSize);
+        return evt;
+    }
+
 protected:
     virtual bool onQuery(SkEvent* evt) {
         if (SampleCode::TitleQ(*evt)) {
@@ -35,9 +42,28 @@
         }
         return this->INHERITED::onQuery(evt);
     }
+    
+    virtual bool onEvent(const SkEvent& evt) SK_OVERRIDE {
+        if (evt.isType("GMSampleView::showSize")) {
+            fShowSize = SkToBool(evt.getFast32());
+            return true;
+        }
+        return this->INHERITED::onEvent(evt);
+    }
 
     virtual void onDrawContent(SkCanvas* canvas) {
-        fGM->drawContent(canvas);
+        {
+            SkAutoCanvasRestore acr(canvas, fShowSize);
+            fGM->drawContent(canvas);
+        }
+        if (fShowSize) {
+            SkISize size = fGM->getISize();
+            SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()),
+                                      SkIntToScalar(size.height()));
+            SkPaint paint;
+            paint.setColor(0x40FF8833);
+            canvas->drawRect(r, paint);
+        }
     }
 
     virtual void onDrawBackground(SkCanvas* canvas) {