mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-09 09:24:24 +02:00
Fixed data alignment for PNG cursors (thanks @Kontrabant!)
This commit is contained in:
@@ -196,7 +196,18 @@ static bool FillIconEntry(CURSORICONFILEDIRENTRY *entry, SDL_Surface *surface, i
|
||||
|
||||
static bool WriteIconSurface(SDL_IOStream *dst, SDL_Surface *surface)
|
||||
{
|
||||
return SDL_SavePNG_IO(surface, dst, false);
|
||||
if (!SDL_SavePNG_IO(surface, dst, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Image data offsets must be WORD aligned
|
||||
Sint64 offset = SDL_TellIO(dst);
|
||||
if (offset & 1) {
|
||||
if (!SDL_WriteU8(dst, 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user