Optimized hit testing feature, refactored into seperate function from canvas draw calls
Review URL: https://codereview.appspot.com/6443068
git-svn-id: http://skia.googlecode.com/svn/trunk@4867 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/SkDebugCanvas.h b/debugger/SkDebugCanvas.h
index fa2d757..c13ea10 100644
--- a/debugger/SkDebugCanvas.h
+++ b/debugger/SkDebugCanvas.h
@@ -13,7 +13,6 @@
#include "SkCanvas.h"
#include "SkDrawCommand.h"
#include "SkPicture.h"
-#include "SkHitBox.h"
#include <vector>
class SkDebugCanvas : public SkCanvas {
@@ -43,7 +42,13 @@
@param canvas The canvas being drawn to
@param index The index of the final command being executed
*/
- void drawTo(SkCanvas* canvas, int index, SkBitmap* bitmap);
+ void drawTo(SkCanvas* canvas, int index);
+
+ /**
+ Returns the index of the last draw command to write to the pixel at (x,y)
+ */
+ int getCommandAtPoint(int x, int y, int index,
+ SkIPoint transform, float scale);
/**
Returns the draw command at the given index.
@@ -74,31 +79,12 @@
std::vector<std::string>* getDrawCommandsAsStrings();
/**
- Returns the mapping of all pixels to a layer value.
- */
- int* getHitBox() {
- return fHitBox.getHitBox();
- }
-
- SkHitBox* getBoxClass() {
- return &fHitBox;
- }
-
- int getHitBoxPoint() {
- return fHitBox.getPoint();
- }
-
- /**
Returns length of draw command vector.
*/
int getSize() {
return commandVector.size();
}
- void isCalculatingHits(bool isEnabled) {
- fCalculateHits = isEnabled;
- }
-
/**
Toggles the visibility / execution of the draw command at index i with
the value of toggle.
@@ -194,8 +180,6 @@
int fHeight;
int fWidth;
SkBitmap fBm;
- SkHitBox fHitBox;
- bool fCalculateHits;
bool fFilter;
/**