translate image after error checking

This commit is contained in:
Roman Fomin 2024-08-23 17:08:47 +07:00
parent a34a846ce7
commit d61a8eb6e0

View File

@ -576,11 +576,6 @@ void *V_CacheFlatNum(int lump, pu_tag tag)
image = malloc(image_size); image = malloc(image_size);
ret = spng_decode_image(ctx, image, image_size, SPNG_FMT_PNG, 0); ret = spng_decode_image(ctx, image, image_size, SPNG_FMT_PNG, 0);
for (int i = 0; i < image_size; ++i)
{
image[i] = translate[image[i]];
}
if (ret) if (ret)
{ {
I_Printf(VB_ERROR, "V_CacheFlatNum: spng_decode_image %s", I_Printf(VB_ERROR, "V_CacheFlatNum: spng_decode_image %s",
@ -588,6 +583,11 @@ void *V_CacheFlatNum(int lump, pu_tag tag)
goto error; goto error;
} }
for (int i = 0; i < image_size; ++i)
{
image[i] = translate[image[i]];
}
spng_ctx_free(ctx); spng_ctx_free(ctx);
Z_Free(buffer); Z_Free(buffer);