SkHitBox added.

SkHitBox is a class that determines which draw command is associated with the pixel located at x,y. By calculating a single point instead of the entire bitmap at once there is no visible performance slowdown.

Review URL: https://codereview.appspot.com/6350098

git-svn-id: http://skia.googlecode.com/svn/trunk@4565 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/QT/SkCanvasWidget.cpp b/debugger/QT/SkCanvasWidget.cpp
index 39fb1f5..8c660a4 100644
--- a/debugger/QT/SkCanvasWidget.cpp
+++ b/debugger/QT/SkCanvasWidget.cpp
@@ -11,7 +11,6 @@
 #include "SkStream.h"
 #include "SkCanvasWidget.h"
 #include "SkColor.h"
-#include <iostream>
 
 SkCanvasWidget::SkCanvasWidget(QWidget *parent) :
     QWidget(parent) {
@@ -56,7 +55,7 @@
     fDevice = new SkDevice(fBitmap);
     fCanvas = new SkCanvas(fDevice);
     fDebugCanvas->setBounds(event->size().width(), event->size().height());
-    fDebugCanvas->drawTo(fCanvas, fIndex);
+    fDebugCanvas->drawTo(fCanvas, fIndex+1, &fBitmap);
     this->update();
 }
 
@@ -72,7 +71,7 @@
     }
 
     emit commandChanged(fIndex);
-    fDebugCanvas->drawTo(fCanvas, fIndex+1);
+    fDebugCanvas->drawTo(fCanvas, fIndex+1, &fBitmap);
     this->update();
     this->fIndex = fIndex;
 }
@@ -128,6 +127,11 @@
 
 void SkCanvasWidget::mousePressEvent(QMouseEvent* event) {
     fPreviousPoint.set(event->globalX(), event->globalY());
+    fDebugCanvas->getBoxClass()->setHitPoint(event->x(), event->y());
+    fDebugCanvas->isCalculatingHits(true);
+    drawTo(fIndex);
+    emit hitChanged(fDebugCanvas->getHitBoxPoint());
+    fDebugCanvas->isCalculatingHits(false);
 }
 
 void SkCanvasWidget::mouseDoubleClickEvent(QMouseEvent* event) {