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

Side by Side Diff: src/gpu/GrProgramDesc.h

Issue 1436973003: Switch uses of SkChecksum::Compute to Murmur3. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « src/core/SkPictureFlat.h ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrProgramDesc_DEFINED 8 #ifndef GrProgramDesc_DEFINED
9 #define GrProgramDesc_DEFINED 9 #define GrProgramDesc_DEFINED
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 template<typename T, size_t OFFSET> const T* atOffset() const { 100 template<typename T, size_t OFFSET> const T* atOffset() const {
101 return reinterpret_cast<const T*>(reinterpret_cast<intptr_t>(fKey.begin( )) + OFFSET); 101 return reinterpret_cast<const T*>(reinterpret_cast<intptr_t>(fKey.begin( )) + OFFSET);
102 } 102 }
103 103
104 void finalize() { 104 void finalize() {
105 int keyLength = fKey.count(); 105 int keyLength = fKey.count();
106 SkASSERT(0 == (keyLength % 4)); 106 SkASSERT(0 == (keyLength % 4));
107 *(this->atOffset<uint32_t, GrProgramDesc::kLengthOffset>()) = SkToU32(ke yLength); 107 *(this->atOffset<uint32_t, GrProgramDesc::kLengthOffset>()) = SkToU32(ke yLength);
108 108
109 uint32_t* checksum = this->atOffset<uint32_t, GrProgramDesc::kChecksumOf fset>(); 109 uint32_t* checksum = this->atOffset<uint32_t, GrProgramDesc::kChecksumOf fset>();
110 *checksum = 0; 110 *checksum = 0; // We'll hash through these bytes, so make sure they're initialized.
111 *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin() ), keyLength); 111 *checksum = SkChecksum::Murmur3(fKey.begin(), keyLength);
112 } 112 }
113 113
114 // The key, stored in fKey, is composed of four parts: 114 // The key, stored in fKey, is composed of four parts:
115 // 1. uint32_t for total key length. 115 // 1. uint32_t for total key length.
116 // 2. uint32_t for a checksum. 116 // 2. uint32_t for a checksum.
117 // 3. Header struct defined above. Also room for extensions to the header 117 // 3. Header struct defined above. Also room for extensions to the header
118 // 4. A Backend specific payload. Room is preallocated for this 118 // 4. A Backend specific payload. Room is preallocated for this
119 enum KeyOffsets { 119 enum KeyOffsets {
120 // Part 1. 120 // Part 1.
121 kLengthOffset = 0, 121 kLengthOffset = 0,
(...skipping 12 matching lines...) Expand all
134 }; 134 };
135 135
136 SkSTArray<kPreAllocSize, uint8_t, true>& key() { return fKey; } 136 SkSTArray<kPreAllocSize, uint8_t, true>& key() { return fKey; }
137 const SkSTArray<kPreAllocSize, uint8_t, true>& key() const { return fKey; } 137 const SkSTArray<kPreAllocSize, uint8_t, true>& key() const { return fKey; }
138 138
139 private: 139 private:
140 SkSTArray<kPreAllocSize, uint8_t, true> fKey; 140 SkSTArray<kPreAllocSize, uint8_t, true> fKey;
141 }; 141 };
142 142
143 #endif 143 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureFlat.h ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698