#include <SkResourceCache.h>
Definition at line 33 of file SkResourceCache.h.
◆ getNamespace()
void * SkResourceCache::Key::getNamespace |
( |
| ) |
const |
|
inline |
◆ getSharedID()
uint64_t SkResourceCache::Key::getSharedID |
( |
| ) |
const |
|
inline |
Definition at line 48 of file SkResourceCache.h.
48{ return ((uint64_t)fSharedID_hi << 32) | fSharedID_lo; }
◆ hash()
uint32_t SkResourceCache::Key::hash |
( |
| ) |
const |
|
inline |
◆ init()
void SkResourceCache::Key::init |
( |
void * |
nameSpace, |
|
|
uint64_t |
sharedID, |
|
|
size_t |
dataSize |
|
) |
| |
Key subclasses must call this after their own fields and data are initialized. All fields and data must be tightly packed.
- Parameters
-
nameSpace | must be unique per Key subclass. |
sharedID | == 0 means ignore this field, does not support group purging. |
dataSize | is size of fields and data of the subclass, must be a multiple of 4. |
Definition at line 55 of file SkResourceCache.cpp.
55 {
57
58
59 static const int kUnhashedLocal32s = 2;
60 static const int kSharedIDLocal32s = 2;
61 static const int kHashedLocal32s = kSharedIDLocal32s + (sizeof(fNamespace) >> 2);
62 static const int kLocal32s = kUnhashedLocal32s + kHashedLocal32s;
63
64 static_assert(
sizeof(
Key) == (kLocal32s << 2),
"unaccounted_key_locals");
65 static_assert(
sizeof(
Key) == offsetof(
Key, fNamespace) +
sizeof(fNamespace),
66 "namespace_field_must_be_last");
67
68 fCount32 =
SkToS32(kLocal32s + (dataSize >> 2));
69 fSharedID_lo = (uint32_t)(sharedID & 0xFFFFFFFF);
70 fSharedID_hi = (uint32_t)(sharedID >> 32);
71 fNamespace = nameSpace;
72
74 (fCount32 - kUnhashedLocal32s) << 2);
75}
static constexpr T SkAlign4(T x)
constexpr int32_t SkToS32(S x)
uint32_t Hash32(const void *data, size_t bytes, uint32_t seed)
◆ operator==()
bool SkResourceCache::Key::operator== |
( |
const Key & |
other | ) |
const |
|
inline |
Definition at line 53 of file SkResourceCache.h.
53 {
54 const uint32_t*
a = this->as32();
55 const uint32_t*
b = other.as32();
56 for (
int i = 0;
i < fCount32; ++
i) {
58 return false;
59 }
60 }
61 return true;
62 }
◆ size()
size_t SkResourceCache::Key::size |
( |
| ) |
const |
|
inline |
Returns the size of this key.
Definition at line 43 of file SkResourceCache.h.
43 {
44 return fCount32 << 2;
45 }
The documentation for this struct was generated from the following files: