Correctly return the output patch's size in Picture_PatchConvert

This commit is contained in:
Jaime Passos 2020-10-13 19:16:25 -03:00
parent 0e62cb2ada
commit 63e471d902
1 changed files with 9 additions and 3 deletions

View File

@ -352,20 +352,26 @@ void *Picture_PatchConvert(
img = Z_Malloc(size, PU_STATIC, NULL); img = Z_Malloc(size, PU_STATIC, NULL);
memcpy(img, imgbuf, size); memcpy(img, imgbuf, size);
if (outsize != NULL)
*outsize = size;
if (Picture_IsInternalPatchFormat(outformat)) if (Picture_IsInternalPatchFormat(outformat))
{ {
patch_t *converted = Patch_Create((softwarepatch_t *)img, size, NULL); patch_t *converted = Patch_Create((softwarepatch_t *)img, size, NULL);
#ifdef HWRENDER #ifdef HWRENDER
Patch_CreateGL(converted); Patch_CreateGL(converted);
#endif #endif
Z_Free(img); Z_Free(img);
if (outsize != NULL)
*outsize = sizeof(patch_t);
return converted; return converted;
} }
else else
{
if (outsize != NULL)
*outsize = size;
return img; return img;
}
} }
/** Converts a picture to a flat. /** Converts a picture to a flat.