mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Read only PNG header bytes to confirm a sprite is a PNG
Saves about 300 ms for R_InitSkins.
This commit is contained in:
parent
29399f6033
commit
c39edbbf7f
1 changed files with 6 additions and 4 deletions
|
|
@ -286,16 +286,18 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
|
||||||
|
|
||||||
#ifndef NO_PNG_LUMPS
|
#ifndef NO_PNG_LUMPS
|
||||||
{
|
{
|
||||||
softwarepatch_t *png = W_CacheLumpNumPwad(wadnum, l, PU_STATIC);
|
UINT8 header[PNG_HEADER_SIZE];
|
||||||
size_t len = W_LumpLengthPwad(wadnum, l);
|
size_t len = W_LumpLengthPwad(wadnum, l);
|
||||||
|
|
||||||
if (Picture_IsLumpPNG((UINT8 *)png, len))
|
W_ReadLumpHeaderPwad(wadnum, l, header, sizeof header, 0);
|
||||||
|
|
||||||
|
if (Picture_IsLumpPNG(header, len))
|
||||||
{
|
{
|
||||||
|
UINT8 *png = W_CacheLumpNumPwad(wadnum, l, PU_STATIC);
|
||||||
Picture_PNGDimensions((UINT8 *)png, &width, &height, &topoffset, &leftoffset, len);
|
Picture_PNGDimensions((UINT8 *)png, &width, &height, &topoffset, &leftoffset, len);
|
||||||
isPNG = true;
|
isPNG = true;
|
||||||
|
Z_Free(png);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(png);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPNG)
|
if (!isPNG)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue