mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 23:12:21 +00:00
[CHG] Doc improvement
This commit is contained in:
parent
c95a8eacb2
commit
848a2c102f
1 changed files with 14 additions and 9 deletions
|
@ -74,11 +74,10 @@ void RawTo4x4RGBA (const u8 *src, void *dst,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a texture from a buffer.
|
* Load a texture from a buffer.
|
||||||
* @param my_img The JPEG or PNG buffer to load.
|
* @param my_img The JPEG, PNG or Bitmap buffer to load.
|
||||||
* @return A GRRLIB_texImg structure filled with image information.
|
* @return A GRRLIB_texImg structure filled with image information.
|
||||||
*/
|
*/
|
||||||
GRRLIB_texImg* GRRLIB_LoadTexture (const u8 my_img[]) {
|
GRRLIB_texImg* GRRLIB_LoadTexture (const u8 my_img[]) {
|
||||||
// Check for jpeg signature
|
|
||||||
if (my_img[0]==0xFF && my_img[1]==0xD8 && my_img[2]==0xFF)
|
if (my_img[0]==0xFF && my_img[1]==0xD8 && my_img[2]==0xFF)
|
||||||
return (GRRLIB_LoadTextureJPG(my_img));
|
return (GRRLIB_LoadTextureJPG(my_img));
|
||||||
else if (my_img[0]=='B' && my_img[1]=='M')
|
else if (my_img[0]=='B' && my_img[1]=='M')
|
||||||
|
@ -102,13 +101,19 @@ GRRLIB_texImg* GRRLIB_LoadTexturePNG (const u8 *my_png) {
|
||||||
PNGU_GetImageProperties(ctx, &imgProp);
|
PNGU_GetImageProperties(ctx, &imgProp);
|
||||||
my_texture->data = memalign(32, imgProp.imgWidth * imgProp.imgHeight * 4);
|
my_texture->data = memalign(32, imgProp.imgWidth * imgProp.imgHeight * 4);
|
||||||
if(my_texture->data != NULL) {
|
if(my_texture->data != NULL) {
|
||||||
PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, my_texture->data, 255);
|
if(PNGU_DecodeTo4x4RGBA8(ctx, imgProp.imgWidth, imgProp.imgHeight, my_texture->data, 255) == PNGU_OK) {
|
||||||
PNGU_ReleaseImageContext(ctx);
|
|
||||||
my_texture->w = imgProp.imgWidth;
|
my_texture->w = imgProp.imgWidth;
|
||||||
my_texture->h = imgProp.imgHeight;
|
my_texture->h = imgProp.imgHeight;
|
||||||
GRRLIB_SetHandle( my_texture, 0, 0 );
|
GRRLIB_SetHandle( my_texture, 0, 0 );
|
||||||
GRRLIB_FlushTex( my_texture );
|
GRRLIB_FlushTex( my_texture );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
free(my_texture->data);
|
||||||
|
my_texture->data = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PNGU_ReleaseImageContext(ctx);
|
||||||
}
|
}
|
||||||
return my_texture;
|
return my_texture;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +139,7 @@ static RGBQUAD* GRRLIB_CreatePalette (const u8 *my_bmp, u32 Size) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a texture from a buffer.
|
* Load a texture from a buffer.
|
||||||
* It only works for the MS-Windows standard format uncompressed (1 bit, 4 bits, 8 bits, 24 bits and 32 bits).
|
* It only works for the MS-Windows standard format uncompressed (1-bit, 4-bit, 8-bit, 24-bit and 32-bit).
|
||||||
* @param my_bmp the Bitmap buffer to load.
|
* @param my_bmp the Bitmap buffer to load.
|
||||||
* @return A GRRLIB_texImg structure filled with image information.
|
* @return A GRRLIB_texImg structure filled with image information.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue