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

Unified Diff: src/core/SkPathHeap.h

Issue 190923002: Add deduping capability to SkPathHeap (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 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/SkPathHeap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPathHeap.h
===================================================================
--- src/core/SkPathHeap.h (revision 13690)
+++ src/core/SkPathHeap.h (working copy)
@@ -30,6 +30,11 @@
*/
int append(const SkPath&);
+ /** Add the specified path to the heap using its gen ID to de-duplicate.
+ Returns the path's index in the heap + 1.
+ */
+ int insert(const SkPath&);
+
// called during picture-playback
int count() const { return fPaths.count(); }
const SkPath& operator[](int index) const {
@@ -44,6 +49,27 @@
// we just store ptrs into fHeap here
SkTDArray<SkPath*> fPaths;
+ class LookupEntry {
+ public:
+ LookupEntry(const SkPath& path);
+
+ int storageSlot() const { return fStorageSlot; }
+ void setStorageSlot(int storageSlot) { fStorageSlot = storageSlot; }
+
+ static bool Less(const LookupEntry& a, const LookupEntry& b) {
+ return a.fGenerationID < b.fGenerationID;
+ }
+
+ private:
+ uint32_t fGenerationID; // the SkPath's generation ID
+ // the path's index in the heap + 1. It is 0 if the path is not yet in the heap.
+ int fStorageSlot;
+ };
+
+ SkTDArray<LookupEntry> fLookupTable;
+
+ SkPathHeap::LookupEntry* addIfNotPresent(const SkPath& path);
+
typedef SkRefCnt INHERITED;
};
« no previous file with comments | « no previous file | src/core/SkPathHeap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698