mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 10:21:04 +00:00
Add support for more chunks per frame
This issue appeared for first time here: https://community.aseprite.org/t/1762/4
This commit is contained in:
parent
d13806ac23
commit
9e65ff9ad8
@ -82,9 +82,14 @@ header of 16 bytes:
|
|||||||
|
|
||||||
DWORD Bytes in this frame
|
DWORD Bytes in this frame
|
||||||
WORD Magic number (always 0xF1FA)
|
WORD Magic number (always 0xF1FA)
|
||||||
WORD Number of "chunks" in this frame
|
WORD Old field which specifies the number of "chunks"
|
||||||
|
in this frame. If this value is 0xFFFF, we might
|
||||||
|
have more chunks to read in this frame
|
||||||
|
(so we have to use the new field)
|
||||||
WORD Frame duration (in milliseconds)
|
WORD Frame duration (in milliseconds)
|
||||||
BYTE[6] For future (set to zero)
|
BYTE[2] For future (set to zero)
|
||||||
|
DWORD New field which specifies the number of "chunks"
|
||||||
|
in this frame (if this is 0, use the old field)
|
||||||
|
|
||||||
Then each chunk format is:
|
Then each chunk format is:
|
||||||
|
|
||||||
|
@ -416,9 +416,10 @@ static void ase_file_write_frame_header(FILE* f, dio::AsepriteFrameHeader* frame
|
|||||||
|
|
||||||
fputl(frame_header->size, f);
|
fputl(frame_header->size, f);
|
||||||
fputw(frame_header->magic, f);
|
fputw(frame_header->magic, f);
|
||||||
fputw(frame_header->chunks, f);
|
fputw(frame_header->chunks < 0xFFFF ? frame_header->chunks: 0xFFFF, f);
|
||||||
fputw(frame_header->duration, f);
|
fputw(frame_header->duration, f);
|
||||||
ase_file_write_padding(f, 6);
|
ase_file_write_padding(f, 2);
|
||||||
|
fputl(frame_header->chunks, f);
|
||||||
|
|
||||||
fseek(f, end, SEEK_SET);
|
fseek(f, end, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ struct AsepriteHeader {
|
|||||||
struct AsepriteFrameHeader {
|
struct AsepriteFrameHeader {
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
uint16_t magic;
|
uint16_t magic;
|
||||||
uint16_t chunks;
|
uint32_t chunks;
|
||||||
uint16_t duration;
|
uint16_t duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -268,7 +268,12 @@ void AsepriteDecoder::readFrameHeader(AsepriteFrameHeader* frame_header)
|
|||||||
frame_header->magic = read16();
|
frame_header->magic = read16();
|
||||||
frame_header->chunks = read16();
|
frame_header->chunks = read16();
|
||||||
frame_header->duration = read16();
|
frame_header->duration = read16();
|
||||||
readPadding(6);
|
readPadding(2);
|
||||||
|
uint32_t nchunks = read32();
|
||||||
|
|
||||||
|
if (frame_header->chunks == 0xFFFF &&
|
||||||
|
frame_header->chunks < nchunks)
|
||||||
|
frame_header->chunks = nchunks;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsepriteDecoder::readPadding(int bytes)
|
void AsepriteDecoder::readPadding(int bytes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user