#include <SkTDArray.h>
Definition at line 20 of file SkTDArray.h.
◆ SkTDStorage() [1/4]
SkTDStorage::SkTDStorage |
( |
int |
sizeOfT | ) |
|
|
explicit |
◆ SkTDStorage() [2/4]
SkTDStorage::SkTDStorage |
( |
const void * |
src, |
|
|
int |
size, |
|
|
int |
sizeOfT |
|
) |
| |
Definition at line 23 of file SkTDArray.cpp.
24 : fSizeOfT{sizeOfT}
29 size_t storageSize = this->bytes(
size);
31 memcpy(fStorage,
src, storageSize);
32 }
33}
static void * sk_malloc_throw(size_t size)
◆ SkTDStorage() [3/4]
◆ SkTDStorage() [4/4]
Definition at line 52 of file SkTDArray.cpp.
53 : fSizeOfT{that.fSizeOfT}
54 , fStorage(std::exchange(that.fStorage, nullptr))
55 , fCapacity{that.fCapacity}
56 , fSize{that.fSize} {}
◆ ~SkTDStorage()
SkTDStorage::~SkTDStorage |
( |
| ) |
|
Definition at line 66 of file SkTDArray.cpp.
66 {
68}
SK_API void sk_free(void *)
◆ append() [1/3]
void SkTDStorage::append |
( |
| ) |
|
Definition at line 167 of file SkTDArray.cpp.
167 {
168 if (fSize < fCapacity) {
169 fSize++;
170 } else {
172 }
173}
◆ append() [2/3]
void * SkTDStorage::append |
( |
const void * |
src, |
|
|
int |
count |
|
) |
| |
◆ append() [3/3]
void SkTDStorage::append |
( |
int |
count | ) |
|
Definition at line 175 of file SkTDArray.cpp.
175 {
177
178 if (fCapacity - fSize >=
count) {
180 } else {
182 }
183}
◆ capacity()
int SkTDStorage::capacity |
( |
| ) |
const |
|
inline |
◆ clear()
void SkTDStorage::clear |
( |
| ) |
|
|
inline |
◆ data() [1/2]
void * SkTDStorage::data |
( |
| ) |
|
|
inline |
◆ data() [2/2]
const void * SkTDStorage::data |
( |
| ) |
const |
|
inline |
◆ empty()
bool SkTDStorage::empty |
( |
| ) |
const |
|
inline |
◆ erase()
void SkTDStorage::erase |
( |
int |
index, |
|
|
int |
count |
|
) |
| |
Definition at line 141 of file SkTDArray.cpp.
141 {
144 SkASSERT(0 <= index && index <= fSize);
145
147
148 const int newCount = this->calculateSizeOrDie(-
count);
149 this->moveTail(index, index +
count, fSize);
151 }
152}
◆ insert() [1/2]
void * SkTDStorage::insert |
( |
int |
index | ) |
|
◆ insert() [2/2]
void * SkTDStorage::insert |
( |
int |
index, |
|
|
int |
count, |
|
|
const void * |
src |
|
) |
| |
Definition at line 193 of file SkTDArray.cpp.
193 {
194 SkASSERT(0 <= index && index <= fSize);
196
198 const int oldCount = fSize;
199 const int newCount = this->calculateSizeOrDie(
count);
201 this->moveTail(index +
count, index, oldCount);
202
203 if (
src !=
nullptr) {
205 }
206 }
207
208 return this->address(index);
209}
◆ operator=() [1/2]
Definition at line 38 of file SkTDArray.cpp.
38 {
39 if (this != &that) {
40 if (that.fSize <= fCapacity) {
41 fSize = that.fSize;
42 if (fSize > 0) {
44 }
45 } else {
47 }
48 }
49 return *this;
50}
size_t size_bytes() const
◆ operator=() [2/2]
Definition at line 58 of file SkTDArray.cpp.
58 {
59 if (this != &that) {
62 }
63 return *this;
64}
◆ pop_back()
void SkTDStorage::pop_back |
( |
| ) |
|
|
inline |
◆ prepend()
void * SkTDStorage::prepend |
( |
| ) |
|
◆ removeShuffle()
void SkTDStorage::removeShuffle |
( |
int |
index | ) |
|
Definition at line 154 of file SkTDArray.cpp.
154 {
156 SkASSERT(0 <= index && index < fSize);
157
158 const int newCount = this->calculateSizeOrDie(-1);
159 this->moveTail(index, fSize - 1, fSize);
161}
◆ reserve()
void SkTDStorage::reserve |
( |
int |
newCapacity | ) |
|
Definition at line 92 of file SkTDArray.cpp.
92 {
94 if (newCapacity > fCapacity) {
95
96
98
99
102
103
104 int growth = 4 + ((newCapacity + 4) >> 2);
105
106
108 expandedReserve = newCapacity + growth;
109 }
110 }
111
112
113
114
115
116 if (fSizeOfT == 1) {
117
118 expandedReserve = (expandedReserve + 15) & ~15;
119 }
120
121 fCapacity = expandedReserve;
122 size_t newStorageSize = this->bytes(fCapacity);
123 fStorage =
static_cast<std::byte*
>(
sk_realloc_throw(fStorage, newStorageSize));
124 }
125}
SK_API void * sk_realloc_throw(void *buffer, size_t size)
static constexpr size_t kMaxCount
◆ reset()
void SkTDStorage::reset |
( |
| ) |
|
Definition at line 70 of file SkTDArray.cpp.
70 {
71 const int sizeOfT = fSizeOfT;
74}
◆ resize()
void SkTDStorage::resize |
( |
int |
newSize | ) |
|
Definition at line 84 of file SkTDArray.cpp.
84 {
86 if (newSize > fCapacity) {
88 }
89 fSize = newSize;
90}
void reserve(int newCapacity)
◆ shrink_to_fit()
void SkTDStorage::shrink_to_fit |
( |
| ) |
|
Definition at line 127 of file SkTDArray.cpp.
127 {
128 if (fCapacity != fSize) {
129 fCapacity = fSize;
130
131
132 if (fCapacity > 0) {
133 fStorage =
static_cast<std::byte*
>(
sk_realloc_throw(fStorage, this->bytes(fCapacity)));
134 } else {
136 fStorage = nullptr;
137 }
138 }
139}
◆ size()
int SkTDStorage::size |
( |
| ) |
const |
|
inline |
◆ size_bytes()
size_t SkTDStorage::size_bytes |
( |
| ) |
const |
|
inline |
Definition at line 43 of file SkTDArray.h.
43{ return this->bytes(fSize); }
◆ swap()
Definition at line 76 of file SkTDArray.cpp.
76 {
79 swap(fStorage, that.fStorage);
80 swap(fCapacity, that.fCapacity);
81 swap(fSize, that.fSize);
82}
void swap(sk_sp< T > &a, sk_sp< T > &b)
void swap(SkTDStorage &that)
◆ operator!=
◆ operator==
Definition at line 211 of file SkTDArray.cpp.
211 {
212 return a.size() ==
b.size() && (
a.empty() || !memcmp(
a.data(),
b.data(),
a.bytes(
a.size())));
213}
The documentation for this class was generated from the following files: