Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: src/core/SkBBoxHierarchy.h

Issue 12817011: Fixing SkPicture command pattern optimizations to make them work correctly with bounding box hierar… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkBBoxHierarchyRecord.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBBoxHierarchy.h
===================================================================
--- src/core/SkBBoxHierarchy.h (revision 8135)
+++ src/core/SkBBoxHierarchy.h (working copy)
@@ -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 @@
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 @@
*/
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;
};
« no previous file with comments | « no previous file | src/core/SkBBoxHierarchyRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698