-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPathStorage.cpp
More file actions
63 lines (53 loc) · 1.76 KB
/
PathStorage.cpp
File metadata and controls
63 lines (53 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// PathStorage.cpp
// OpenRenderBox
#include <OpenRenderBoxCxx/Path/PathStorage.hpp>
#include <OpenRenderBoxCxx/Util/assert.hpp>
namespace ORB {
namespace Path {
atomic_long Storage::_last_identifier;
Storage::Storage(uint32_t capacity, const Storage &storage): Storage(capacity) {
uint32_t originalCapity = flags().capacity();
StorageFlags sourceFlags = storage.flags();
_flags = _flags
.withExternal(false)
.withQuadBezierOrder(sourceFlags.isQuadBezierOrder())
.withCubicBezierOrder(sourceFlags.isCubicBezierOrder())
.withSingleElement(sourceFlags.isSingleElement())
// bit 4 and 5 is from sourceFlags
// bit 6 and bit 7 is zero
.withCapacity(sourceFlags.capacity());
const Storage* sourceStorage = storage.actual_storage();
uint64_t sourceSize = storage.actual_size();
if (originalCapity < sourceSize) {
// reserve_slow(sourceSize);
sourceStorage = external_storage();
if (flags().isExternal()) {
// sourceStorage = external_storage()->0;
}
}
memcpy((void *)external_storage(), (const void *)sourceStorage, sourceSize);
// // Update our capacity info with the size
// if (!(flags() & 0x1)) {
// // Inline storage - update size bits
// _flags = (flags() & ~(0xFFF << 8)) | (sourceSize << 8);
// } else {
// // External storage - store size externally
// *reinterpret_cast<uint64_t*>(this + 0x18) = sourceSize;
// }
}
Storage::~Storage() {
if (_unknonw != nullptr) {
_unknonw = nullptr;
// TODO
}
}
bool Storage::operator==(const Storage &other) const ORB_NOEXCEPT {
// TODO
return false;
}
void Storage::clear() {
// TODO
}
} /* Path */
} /* ORB */