aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBBoxHierarchy.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-15 15:06:03 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-15 15:06:03 +0000
commit4b32bd53c63b245707822ae83e3215863303bf43 (patch)
tree65b7a903a262019d5f0c4d7d42a2eeffbf253d0f /src/core/SkBBoxHierarchy.h
parent8b5144f366db1dd88ac420b38b6871aea0ae8ca4 (diff)
Fixing SkPicture command pattern optimizations to make them work correctly with bounding box hierarchies
BUG=https://code.google.com/p/chromium/issues/detail?id=180645 TEST=render_pictures -r <skp_dir> --validate --bbh <grid|rtree> --mode tile 256 256 Author: junov@chromium.org Reviewed By: robertphillips@google.com Review URL: https://chromiumcodereview.appspot.com/12817011 git-svn-id: http://skia.googlecode.com/svn/trunk@8171 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkBBoxHierarchy.h')
-rw-r--r--src/core/SkBBoxHierarchy.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/core/SkBBoxHierarchy.h b/src/core/SkBBoxHierarchy.h
index 4c8b2ae256..9de785192a 100644
--- a/src/core/SkBBoxHierarchy.h
+++ b/src/core/SkBBoxHierarchy.h
@@ -14,6 +14,23 @@
#include "SkRefCnt.h"
/**
+ * Interface for a client class that implements utility methods needed
+ * by SkBBoxHierarchy that require intrinsic knowledge of the data
+ * object type that is stored in the bounding box hierarchy.
+ */
+class SkBBoxHierarchyClient {
+public:
+ virtual ~SkBBoxHierarchyClient() {}
+
+ /**
+ * Implements a rewind stop condition used by rewindInserts
+ * Must returns true if 'data' points to an object that should be re-wound
+ * by rewinfInserts.
+ */
+ virtual bool shouldRewind(void* data) = 0;
+};
+
+/**
* Interface for a spatial data structure that associates user data pointers with axis-aligned
* bounding boxes, and allows efficient retrieval of intersections with query rectangles.
*/
@@ -21,6 +38,8 @@ class SkBBoxHierarchy : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkBBoxHierarchy)
+ SkBBoxHierarchy() : fClient(NULL) {}
+
/**
* Insert a data pointer and corresponding bounding box
* @param data The data pointer, may be NULL
@@ -49,6 +68,19 @@ public:
*/
virtual int getCount() const = 0;
+ /**
+ * Rewinds all the most recently inserted data elements until an element
+ * is encountered for which client->shouldRewind(data) returns false. May
+ * not rewind elements that were inserted prior to the last call to
+ * flushDeferredInserts.
+ */
+ virtual void rewindInserts() = 0;
+
+ void setClient(SkBBoxHierarchyClient* client) { fClient = client; }
+
+protected:
+ SkBBoxHierarchyClient* fClient;
+
private:
typedef SkRefCnt INHERITED;
};