Add overdraw visualization to the debugger

https://codereview.appspot.com/7267043/



git-svn-id: http://skia.googlecode.com/svn/trunk@7627 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index 6005944..890c607 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -89,6 +89,7 @@
     connect(fSettingsWidget.getVisibilityButton(), SIGNAL(toggled(bool)), this, SLOT(actionCommandFilter()));
     connect(fSettingsWidget.getGLCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionGLWidget(bool)));
     connect(fSettingsWidget.getRasterCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionRasterWidget(bool)));
+    connect(fSettingsWidget.getOverdrawVizCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionOverdrawVizWidget(bool)));
     connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool)));
     connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBreakpoint()));
     connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes()));
@@ -516,6 +517,11 @@
     fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kRaster_8888_WidgetType, !isToggled);
 }
 
+void SkDebuggerGUI::actionOverdrawVizWidget(bool isToggled) {
+    fDebugger.setOverdrawViz(isToggled);
+    fCanvasWidget.update();
+}
+
 void SkDebuggerGUI::actionRewind() {
     fListWidget.setCurrentRow(0);
 }
diff --git a/debugger/QT/SkDebuggerGUI.h b/debugger/QT/SkDebuggerGUI.h
index 6d57a8a..4130e96 100644
--- a/debugger/QT/SkDebuggerGUI.h
+++ b/debugger/QT/SkDebuggerGUI.h
@@ -134,6 +134,11 @@
     void actionRasterWidget(bool isToggled);
 
     /**
+        Toggles the the overdraw visualization on and off
+     */
+    void actionOverdrawVizWidget(bool isToggled);
+
+    /**
         Rewinds from the current step back to the start of the commands.
      */
     void actionRewind();
diff --git a/debugger/QT/SkRasterWidget.cpp b/debugger/QT/SkRasterWidget.cpp
index a8a36a8..db3d00f 100644
--- a/debugger/QT/SkRasterWidget.cpp
+++ b/debugger/QT/SkRasterWidget.cpp
@@ -27,6 +27,7 @@
 void SkRasterWidget::resizeEvent(QResizeEvent* event) {
     fBitmap.setConfig(SkBitmap::kARGB_8888_Config, event->size().width(), event->size().height());
     fBitmap.allocPixels();
+    fBitmap.eraseColor(SK_ColorTRANSPARENT);
     SkSafeUnref(fCanvas);
     SkSafeUnref(fDevice);
     fDevice = new SkDevice(fBitmap);
diff --git a/debugger/QT/SkSettingsWidget.cpp b/debugger/QT/SkSettingsWidget.cpp
index c74be40..09196fb 100644
--- a/debugger/QT/SkSettingsWidget.cpp
+++ b/debugger/QT/SkSettingsWidget.cpp
@@ -59,6 +59,10 @@
 
     fRasterCheckBox.setChecked(true);
 
+    fOverdrawVizLabel.setText("     Overdraw Viz: ");
+    fOverdrawVizLabel.setMinimumWidth(178);
+    fOverdrawVizLabel.setMaximumWidth(178);
+
     fGLLabel.setText("OpenGL: ");
     fGLLabel.setMinimumWidth(178);
     fGLLabel.setMaximumWidth(178);
@@ -66,12 +70,16 @@
     fRasterLayout.addWidget(&fRasterLabel);
     fRasterLayout.addWidget(&fRasterCheckBox);
 
+    fOverdrawVizLayout.addWidget(&fOverdrawVizLabel);
+    fOverdrawVizLayout.addWidget(&fOverdrawVizCheckBox);
+
     fGLLayout.addWidget(&fGLLabel);
     fGLLayout.addWidget(&fGLCheckBox);
 
     fCanvasLayout.setSpacing(6);
     fCanvasLayout.setContentsMargins(11,11,11,11);
     fCanvasLayout.addLayout(&fRasterLayout);
+    fCanvasLayout.addLayout(&fOverdrawVizLayout);
     fCanvasLayout.addLayout(&fGLLayout);
 
     // Command Toggle
diff --git a/debugger/QT/SkSettingsWidget.h b/debugger/QT/SkSettingsWidget.h
index 1f75527..73cd6e1 100644
--- a/debugger/QT/SkSettingsWidget.h
+++ b/debugger/QT/SkSettingsWidget.h
@@ -47,6 +47,10 @@
         return &fRasterCheckBox;
     }
 
+    QCheckBox* getOverdrawVizCheckBox() {
+        return &fOverdrawVizCheckBox;
+    }
+
 private slots:
     void updateCommand(int newCommand);
     void updateHit(int newHit);
@@ -87,6 +91,10 @@
     QLabel fRasterLabel;
     QCheckBox fRasterCheckBox;
 
+    QHBoxLayout fOverdrawVizLayout;
+    QLabel fOverdrawVizLabel;
+    QCheckBox fOverdrawVizCheckBox;
+
     QHBoxLayout fGLLayout;
     QLabel fGLLabel;
     QCheckBox fGLCheckBox;