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/SkDebugCanvas.cpp b/debugger/SkDebugCanvas.cpp
index c1039f1..8586878 100644
--- a/debugger/SkDebugCanvas.cpp
+++ b/debugger/SkDebugCanvas.cpp
@@ -34,12 +34,11 @@
}
}
-
-void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
+void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, SkBitmap* bitmap) {
int counter = 0;
if(!commandVector.empty()) {
for(it = commandVector.begin(); it != commandVector.end(); ++it) {
- if (counter != (index-1)) {
+ if (counter != (index-1)) {
if ((*it)->getVisibility()) {
(*it)->execute(canvas);
}
@@ -56,11 +55,13 @@
canvas->drawRectCoords(SkIntToScalar(0),SkIntToScalar(0),SkIntToScalar(fWidth),SkIntToScalar(fHeight), *p);
canvas->restore();
}
-
if ((*it)->getVisibility()) {
(*it)->execute(canvas);
}
}
+ if (fCalculateHits == true) {
+ fHitBox.updateHitPoint(bitmap, counter);
+ }
/* TODO(chudy): Implement a bitmap wide function that will take
* ~50 out of each R,G,B. This will make everything but the last