| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 | 8 |
| 9 #ifndef SkDescriptor_DEFINED | 9 #ifndef SkDescriptor_DEFINED |
| 10 #define SkDescriptor_DEFINED | 10 #define SkDescriptor_DEFINED |
| 11 | 11 |
| 12 #include "SkChecksum.h" | 12 #include "SkOpts.h" |
| 13 #include "SkTypes.h" | 13 #include "SkTypes.h" |
| 14 | 14 |
| 15 class SkDescriptor : SkNoncopyable { | 15 class SkDescriptor : SkNoncopyable { |
| 16 public: | 16 public: |
| 17 static size_t ComputeOverhead(int entryCount) { | 17 static size_t ComputeOverhead(int entryCount) { |
| 18 SkASSERT(entryCount >= 0); | 18 SkASSERT(entryCount >= 0); |
| 19 return sizeof(SkDescriptor) + entryCount * sizeof(Entry); | 19 return sizeof(SkDescriptor) + entryCount * sizeof(Entry); |
| 20 } | 20 } |
| 21 | 21 |
| 22 static SkDescriptor* Alloc(size_t length) { | 22 static SkDescriptor* Alloc(size_t length) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 #endif | 116 #endif |
| 117 | 117 |
| 118 private: | 118 private: |
| 119 uint32_t fChecksum; // must be first | 119 uint32_t fChecksum; // must be first |
| 120 uint32_t fLength; // must be second | 120 uint32_t fLength; // must be second |
| 121 uint32_t fCount; | 121 uint32_t fCount; |
| 122 | 122 |
| 123 static uint32_t ComputeChecksum(const SkDescriptor* desc) { | 123 static uint32_t ComputeChecksum(const SkDescriptor* desc) { |
| 124 const uint32_t* ptr = (const uint32_t*)desc + 1; // skip the checksum fi
eld | 124 const uint32_t* ptr = (const uint32_t*)desc + 1; // skip the checksum fi
eld |
| 125 size_t len = desc->fLength - sizeof(uint32_t); | 125 size_t len = desc->fLength - sizeof(uint32_t); |
| 126 return SkChecksum::Murmur3(ptr, len); | 126 return SkOpts::hash(ptr, len); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // private so no one can create one except our factories | 129 // private so no one can create one except our factories |
| 130 SkDescriptor() {} | 130 SkDescriptor() {} |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 #include "SkScalerContext.h" | 133 #include "SkScalerContext.h" |
| 134 | 134 |
| 135 class SkAutoDescriptor : SkNoncopyable { | 135 class SkAutoDescriptor : SkNoncopyable { |
| 136 public: | 136 public: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 167 + sizeof(SkDescriptor::Entry) + sizeof(void*)
// for typeface | 167 + sizeof(SkDescriptor::Entry) + sizeof(void*)
// for typeface |
| 168 + 32 // slop for occational small extras | 168 + 32 // slop for occational small extras |
| 169 }; | 169 }; |
| 170 SkDescriptor* fDesc; | 170 SkDescriptor* fDesc; |
| 171 uint32_t fStorage[(kStorageSize + 3) >> 2]; | 171 uint32_t fStorage[(kStorageSize + 3) >> 2]; |
| 172 }; | 172 }; |
| 173 #define SkAutoDescriptor(...) SK_REQUIRE_LOCAL_VAR(SkAutoDescriptor) | 173 #define SkAutoDescriptor(...) SK_REQUIRE_LOCAL_VAR(SkAutoDescriptor) |
| 174 | 174 |
| 175 | 175 |
| 176 #endif | 176 #endif |
| OLD | NEW |