Dedup SkPaths by gen-ID when going to .skp
We're all set up to serialize and deserialze paths by an integer ID,
but we're just not deduping any paths (every path gets a new ID).
This turns on deduping. This should mean the number of paths in a
deserialized SkPicture are the same as when it was recorded.
No diffs:
https://gold.skia.org/search2?issue=1409373011&unt=true&query=source_type%3Dgm&master=false
BUG=skia:4527
Review URL: https://codereview.chromium.org/1409373011
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index c305f10..7e21fab 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -14,6 +14,7 @@
#include "SkPictureData.h"
#include "SkTArray.h"
#include "SkTDArray.h"
+#include "SkTHash.h"
#include "SkWriter32.h"
// These macros help with packing and unpacking a single byte value and
@@ -226,7 +227,11 @@
SkTArray<SkBitmap> fBitmaps;
SkTArray<SkPaint> fPaints;
- SkTArray<SkPath> fPaths;
+
+ struct PathHash {
+ uint32_t operator()(const SkPath& p) { return p.getGenerationID(); }
+ };
+ SkTHashMap<SkPath, int, PathHash> fPaths;
SkWriter32 fWriter;