| Index: src/gpu/GrRecordReplaceDraw.h
|
| diff --git a/src/gpu/GrRecordReplaceDraw.h b/src/gpu/GrRecordReplaceDraw.h
|
| index 9110ac82f9e09884b355cf7a2ba2b0d472fa61d4..ba6b1c1c514b058fb892ee702f53cafbbb1fdab2 100644
|
| --- a/src/gpu/GrRecordReplaceDraw.h
|
| +++ b/src/gpu/GrRecordReplaceDraw.h
|
| @@ -32,41 +32,41 @@ public:
|
| class ReplacementInfo {
|
| public:
|
| struct Key {
|
| - Key(uint32_t pictureID, unsigned int start, const SkMatrix& ctm)
|
| + Key(uint32_t pictureID, unsigned int start, const int* key, int keySize)
|
| : fPictureID(pictureID)
|
| , fStart(start)
|
| - , fCTM(ctm) {
|
| - fCTM.getType(); // force initialization of type so hashes match
|
| -
|
| - // Key needs to be tightly packed.
|
| - GR_STATIC_ASSERT(sizeof(Key) == sizeof(uint32_t) + // picture ID
|
| - sizeof(int) + // start
|
| - 9 * sizeof(SkScalar) // 3x3 from CTM
|
| - +sizeof(uint32_t)); // matrix's type
|
| + , fKey(key)
|
| + , fKeySize(keySize) {
|
| }
|
|
|
| - bool operator==(const Key& other) const {
|
| - return fPictureID == other.fPictureID &&
|
| - fStart == other.fStart &&
|
| - fCTM.cheapEqualTo(other.fCTM); // TODO: should be fuzzy
|
| + bool operator==(const Key& other) const {
|
| + if (fKeySize != other.fKeySize) {
|
| + return false;
|
| + }
|
| + return !memcmp(fKey, other.fKey, fKeySize * sizeof(int));
|
| }
|
|
|
| uint32_t pictureID() const { return fPictureID; }
|
| unsigned int start() const { return fStart; }
|
|
|
| + const int* key() const { return fKey; }
|
| + int keySize() const { return fKeySize; }
|
| +
|
| private:
|
| const uint32_t fPictureID;
|
| const unsigned int fStart;
|
| - const SkMatrix fCTM;
|
| + const int* fKey;
|
| + const int fKeySize;
|
| };
|
|
|
| static const Key& GetKey(const ReplacementInfo& layer) { return layer.fKey; }
|
| static uint32_t Hash(const Key& key) {
|
| - return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&key), sizeof(Key));
|
| + return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(key.key()),
|
| + key.keySize()*sizeof(int));
|
| }
|
|
|
| - ReplacementInfo(uint32_t pictureID, unsigned int start, const SkMatrix& ctm)
|
| - : fKey(pictureID, start, ctm)
|
| + ReplacementInfo(uint32_t pictureID, unsigned int start, const int* key, int keySize)
|
| + : fKey(pictureID, start, key, keySize)
|
| , fImage(NULL)
|
| , fPaint(NULL) {
|
| }
|
| @@ -86,12 +86,12 @@ public:
|
| ~GrReplacements() { this->freeAll(); }
|
|
|
| // Add a new replacement range.
|
| - ReplacementInfo* newReplacement(uint32_t pictureID, unsigned int start, const SkMatrix& ctm);
|
| + ReplacementInfo* newReplacement(uint32_t pictureID, unsigned int start, const int* key, int keySize);
|
|
|
| // look up a replacement range by its pictureID, start offset and the CTM
|
| // TODO: also need to add clip to lookup
|
| - const ReplacementInfo* lookupByStart(uint32_t pictureID, size_t start,
|
| - const SkMatrix& ctm) const;
|
| + const ReplacementInfo* lookupByStart(uint32_t pictureID, int start,
|
| + const int* key, int keyBytes) const;
|
|
|
| private:
|
| SkTDynamicHash<ReplacementInfo, ReplacementInfo::Key> fReplacementHash;
|
|
|