mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-21 22:42:20 +00:00
Remove useless loop
This commit is contained in:
parent
b1d7144ad2
commit
b8bf87f9e8
1 changed files with 17 additions and 22 deletions
|
@ -202,19 +202,18 @@ GRRLIB_texImg* GRRLIB_LoadTextureTPL (const u8 *my_tpl, const int size, u32 id)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TPLDescHeader *deschead = (TPLDescHeader*)(my_tpl + TPL_HDR_DESCR_FIELD);
|
|
||||||
|
|
||||||
for(u32 c = 0; c <= id; ++c) {
|
|
||||||
u32 pos = (u32)deschead[c].imghead;
|
|
||||||
const TPLImgHeader *imghead = (TPLImgHeader*)(my_tpl + pos);
|
|
||||||
|
|
||||||
if(c == id) {
|
|
||||||
GRRLIB_texImg *my_texture = calloc(1, sizeof(GRRLIB_texImg));
|
GRRLIB_texImg *my_texture = calloc(1, sizeof(GRRLIB_texImg));
|
||||||
if (my_texture == NULL) {
|
if (my_texture == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TPLDescHeader *deschead = (TPLDescHeader*)(my_tpl + TPL_HDR_DESCR_FIELD);
|
||||||
|
|
||||||
|
u32 pos = (u32)deschead[id].imghead;
|
||||||
|
const TPLImgHeader *imghead = (TPLImgHeader*)(my_tpl + pos);
|
||||||
|
|
||||||
pos = (u32)imghead->data;
|
pos = (u32)imghead->data;
|
||||||
my_texture->data = (char*)(my_tpl + pos);
|
my_texture->data = (u8*)(my_tpl + pos);
|
||||||
my_texture->w = imghead->width;
|
my_texture->w = imghead->width;
|
||||||
my_texture->h = imghead->height;
|
my_texture->h = imghead->height;
|
||||||
my_texture->freedata = true;
|
my_texture->freedata = true;
|
||||||
|
@ -223,10 +222,6 @@ GRRLIB_texImg* GRRLIB_LoadTextureTPL (const u8 *my_tpl, const int size, u32 id)
|
||||||
|
|
||||||
return my_texture;
|
return my_texture;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a texture from a buffer.
|
* Load a texture from a buffer.
|
||||||
|
|
Loading…
Reference in a new issue