mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[cpp][flutter] Fix formatting.
This commit is contained in:
parent
ba71af746b
commit
e9c68326de
@ -37,7 +37,7 @@ using namespace spine;
|
|||||||
struct Block {
|
struct Block {
|
||||||
int size;
|
int size;
|
||||||
int allocated;
|
int allocated;
|
||||||
uint8_t* memory;
|
uint8_t *memory;
|
||||||
|
|
||||||
int free() {
|
int free() {
|
||||||
return size - allocated;
|
return size - allocated;
|
||||||
@ -47,14 +47,14 @@ struct Block {
|
|||||||
return free() >= numBytes;
|
return free() >= numBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* allocate(int numBytes) {
|
uint8_t *allocate(int numBytes) {
|
||||||
uint8_t *ptr = memory + allocated;
|
uint8_t *ptr = memory + allocated;
|
||||||
allocated += numBytes;
|
allocated += numBytes;
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BlockAllocator : public SpineObject{
|
class BlockAllocator : public SpineObject {
|
||||||
int initialBlockSize;
|
int initialBlockSize;
|
||||||
Vector<Block> blocks;
|
Vector<Block> blocks;
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public:
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T *allocate(size_t num) {
|
T *allocate(size_t num) {
|
||||||
return (T *) _allocate((int)(sizeof(T) * num));
|
return (T *) _allocate((int) (sizeof(T) * num));
|
||||||
}
|
}
|
||||||
|
|
||||||
void compress() {
|
void compress() {
|
||||||
@ -89,6 +89,7 @@ public:
|
|||||||
blocks.clear();
|
blocks.clear();
|
||||||
blocks.add(newBlock(totalSize));
|
blocks.add(newBlock(totalSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void *_allocate(int numBytes) {
|
void *_allocate(int numBytes) {
|
||||||
// 16-byte align allocations
|
// 16-byte align allocations
|
||||||
@ -656,7 +657,7 @@ void spine_skeleton_drawable_dispose(spine_skeleton_drawable drawable) {
|
|||||||
SpineExtension::free(drawable, __FILE__, __LINE__);
|
SpineExtension::free(drawable, __FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
static _spine_render_command *batch_sub_commands(BlockAllocator &allocator, Vector<_spine_render_command*> &commands, int first, int last, int numVertices, int numIndices) {
|
static _spine_render_command *batch_sub_commands(BlockAllocator &allocator, Vector<_spine_render_command *> &commands, int first, int last, int numVertices, int numIndices) {
|
||||||
_spine_render_command *batched = spine_render_command_create(allocator, numVertices, numIndices, commands[first]->blendMode, commands[first]->atlasPage);
|
_spine_render_command *batched = spine_render_command_create(allocator, numVertices, numIndices, commands[first]->blendMode, commands[first]->atlasPage);
|
||||||
float *positions = batched->positions;
|
float *positions = batched->positions;
|
||||||
float *uvs = batched->uvs;
|
float *uvs = batched->uvs;
|
||||||
@ -679,7 +680,7 @@ static _spine_render_command *batch_sub_commands(BlockAllocator &allocator, Vect
|
|||||||
return batched;
|
return batched;
|
||||||
}
|
}
|
||||||
|
|
||||||
static _spine_render_command *batch_commands(BlockAllocator &allocator, Vector<_spine_render_command*> &commands) {
|
static _spine_render_command *batch_commands(BlockAllocator &allocator, Vector<_spine_render_command *> &commands) {
|
||||||
if (commands.size() == 0) return nullptr;
|
if (commands.size() == 0) return nullptr;
|
||||||
|
|
||||||
_spine_render_command *root = nullptr;
|
_spine_render_command *root = nullptr;
|
||||||
@ -1472,7 +1473,7 @@ spine_path_constraint spine_skeleton_find_path_constraint(spine_skeleton skeleto
|
|||||||
}
|
}
|
||||||
|
|
||||||
spine_bounds spine_skeleton_get_bounds(spine_skeleton skeleton) {
|
spine_bounds spine_skeleton_get_bounds(spine_skeleton skeleton) {
|
||||||
_spine_bounds *bounds = (_spine_bounds*)malloc(sizeof(_spine_bounds));
|
_spine_bounds *bounds = (_spine_bounds *) malloc(sizeof(_spine_bounds));
|
||||||
if (skeleton == nullptr) return (spine_bounds) bounds;
|
if (skeleton == nullptr) return (spine_bounds) bounds;
|
||||||
Skeleton *_skeleton = (Skeleton *) skeleton;
|
Skeleton *_skeleton = (Skeleton *) skeleton;
|
||||||
Vector<float> vertices;
|
Vector<float> vertices;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user