#include <SkResourceCache.h>
Definition at line 32 of file SkResourceCache.h.
◆ getNamespace()
void * SkResourceCache::Key::getNamespace |
( |
| ) |
const |
|
inline |
◆ getSharedID()
uint64_t SkResourceCache::Key::getSharedID |
( |
| ) |
const |
|
inline |
Definition at line 47 of file SkResourceCache.h.
47{ 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 52 of file SkResourceCache.h.
52 {
53 const uint32_t*
a = this->as32();
54 const uint32_t*
b = other.as32();
55 for (int i = 0; i < fCount32; ++i) {
57 return false;
58 }
59 }
60 return true;
61 }
◆ size()
size_t SkResourceCache::Key::size |
( |
| ) |
const |
|
inline |
Returns the size of this key.
Definition at line 42 of file SkResourceCache.h.
42 {
43 return fCount32 << 2;
44 }
The documentation for this struct was generated from the following files: