#include <SkDescriptor.h>
Definition at line 24 of file SkDescriptor.h.
◆ addEntry()
void * SkDescriptor::addEntry |
( |
uint32_t |
tag, |
|
|
size_t |
length, |
|
|
const void * |
data = nullptr |
|
) |
| |
Definition at line 35 of file SkDescriptor.cpp.
35 {
39
40 Entry* entry = (
Entry*)((
char*)
this + fLength);
41 entry->fTag = tag;
43 if (data) {
44 memcpy(entry + 1, data,
length);
45 }
46
47 fCount += 1;
49 return (entry + 1);
50}
static constexpr T SkAlign4(T x)
constexpr uint32_t SkToU32(S x)
const void * findEntry(uint32_t tag, uint32_t *length) const
◆ Alloc()
std::unique_ptr< SkDescriptor > SkDescriptor::Alloc |
( |
size_t |
length | ) |
|
|
static |
◆ computeChecksum()
void SkDescriptor::computeChecksum |
( |
| ) |
|
Definition at line 52 of file SkDescriptor.cpp.
52 {
53 fChecksum = SkDescriptor::ComputeChecksum(this);
54}
◆ ComputeOverhead()
static size_t SkDescriptor::ComputeOverhead |
( |
int |
entryCount | ) |
|
|
inlinestatic |
◆ copy()
std::unique_ptr< SkDescriptor > SkDescriptor::copy |
( |
| ) |
const |
Definition at line 72 of file SkDescriptor.cpp.
72 {
74 memcpy(
desc.get(),
this, fLength);
76}
static std::unique_ptr< SkDescriptor > Alloc(size_t length)
◆ dumpRec()
SkString SkDescriptor::dumpRec |
( |
| ) |
const |
Definition at line 93 of file SkDescriptor.cpp.
93 {
96
99 if (rec != nullptr) {
101 }
103}
#define kRec_SkDescriptorTag
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
◆ findEntry()
const void * SkDescriptor::findEntry |
( |
uint32_t |
tag, |
|
|
uint32_t * |
length |
|
) |
| const |
Definition at line 56 of file SkDescriptor.cpp.
56 {
59
60 while (--
count >= 0) {
61 if (entry->fTag == tag) {
64 }
65 return entry + 1;
66 }
67 entry = (
const Entry*)((
const char*)(entry + 1) + entry->fLen);
68 }
69 return nullptr;
70}
◆ flatten()
Definition at line 31 of file SkDescriptor.cpp.
31 {
32 buffer.writePad32(
static_cast<const void*
>(
this), this->fLength);
33}
static const uint8_t buffer[]
◆ getChecksum()
uint32_t SkDescriptor::getChecksum |
( |
| ) |
const |
|
inline |
◆ getCount()
uint32_t SkDescriptor::getCount |
( |
| ) |
const |
|
inline |
◆ getLength()
uint32_t SkDescriptor::getLength |
( |
| ) |
const |
|
inline |
◆ isValid()
bool SkDescriptor::isValid |
( |
| ) |
const |
Definition at line 111 of file SkDescriptor.cpp.
111 {
112 uint32_t
count = fCount;
113 size_t lengthRemaining = this->fLength;
115 return false;
116 }
119
120 while (lengthRemaining > 0 &&
count > 0) {
121 if (lengthRemaining < sizeof(Entry)) {
122 return false;
123 }
124 lengthRemaining -=
sizeof(
Entry);
125
126 const Entry* entry = (
const Entry*)(
reinterpret_cast<const char*
>(
this) +
offset);
127
128 if (lengthRemaining < entry->fLen) {
129 return false;
130 }
131 lengthRemaining -= entry->fLen;
132
133
135 return false;
136 }
137
140 }
141 return lengthRemaining == 0 &&
count == 0;
142}
◆ operator delete()
void SkDescriptor::operator delete |
( |
void * |
p | ) |
|
◆ operator new() [1/2]
void * SkDescriptor::operator new |
( |
size_t |
| ) |
|
Definition at line 27 of file SkDescriptor.cpp.
27 {
28 SK_ABORT(
"Descriptors are created with placement new.");
29}
#define SK_ABORT(message,...)
◆ operator new() [2/2]
void * SkDescriptor::operator new |
( |
size_t |
, |
|
|
void * |
p |
|
) |
| |
|
inline |
◆ operator!=()
bool SkDescriptor::operator!= |
( |
const SkDescriptor & |
other | ) |
const |
|
inline |
◆ operator==()
bool SkDescriptor::operator== |
( |
const SkDescriptor & |
other | ) |
const |
Definition at line 78 of file SkDescriptor.cpp.
78 {
79
80
81
82
83 const uint32_t* aa = (const uint32_t*)this;
84 const uint32_t* bb = (const uint32_t*)&other;
85 const uint32_t* stop = (const uint32_t*)((const char*)aa + fLength);
86 do {
87 if (*aa++ != *bb++)
88 return false;
89 } while (aa < stop);
90 return true;
91}
◆ SkAutoDescriptor
◆ SkDescriptorTestHelper
The documentation for this class was generated from the following files: