From 9d5a12a1f284b15769b27f4f0398cbe78249e523 Mon Sep 17 00:00:00 2001 From: Crayon2000 Date: Tue, 8 Jan 2013 04:49:45 +0000 Subject: [PATCH] [CHG] GRRLIB_CreateEmptyTexture is not inline anymore --- GRRLIB/GRRLIB/GRRLIB_texEdit.c | 24 +++++++++++++++++++++ GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h | 1 - GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h | 1 + GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h | 29 +++----------------------- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/GRRLIB/GRRLIB/GRRLIB_texEdit.c b/GRRLIB/GRRLIB/GRRLIB_texEdit.c index c8b1bc6..239835c 100644 --- a/GRRLIB/GRRLIB/GRRLIB_texEdit.c +++ b/GRRLIB/GRRLIB/GRRLIB_texEdit.c @@ -109,6 +109,30 @@ void RawTo4x4RGBA (const u8 *src, void *dst, } } +/** + * Create an empty texture. + * @param w Width of the new texture to create. + * @param h Height of the new texture to create. + * @return A GRRLIB_texImg structure newly created. + */ +GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h) +{ + GRRLIB_texImg *my_texture = (struct GRRLIB_texImg *)calloc(1, sizeof(GRRLIB_texImg)); + + if(my_texture != NULL) { + my_texture->data = memalign(32, h * w * 4); + my_texture->w = w; + my_texture->h = h; + + // Initialize the texture + memset(my_texture->data, '\0', (h * w) << 2); + + GRRLIB_SetHandle(my_texture, 0, 0); + GRRLIB_FlushTex(my_texture); + } + return my_texture; +} + /** * Load a texture from a buffer. * @param my_img The JPEG, PNG or Bitmap buffer to load. diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h b/GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h index 6424812..f992da4 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB__inline.h @@ -112,7 +112,6 @@ INLINE bool GRRLIB_GetAntiAliasing (void); //------------------------------------------------------------------------------ // GRRLIB_texSetup.h - Create and setup textures -INLINE GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h); INLINE void GRRLIB_ClearTex (GRRLIB_texImg* tex); INLINE void GRRLIB_FlushTex (GRRLIB_texImg *tex); INLINE void GRRLIB_FreeTexture (GRRLIB_texImg *tex); diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h b/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h index 62396a7..6177eb3 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h @@ -133,6 +133,7 @@ void GRRLIB_CompoEnd(int posx, int posy, GRRLIB_texImg *tex); //------------------------------------------------------------------------------ // GRRLIB_texEdit.c - Modifying the content of a texture +GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h); GRRLIB_texImg* GRRLIB_LoadTexture (const u8 *my_img); GRRLIB_texImg* GRRLIB_LoadTexturePNG (const u8 *my_png); GRRLIB_texImg* GRRLIB_LoadTextureJPG (const u8 *my_jpg); diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h b/GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h index f5abe90..125ae85 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB_texSetup.h @@ -29,31 +29,6 @@ THE SOFTWARE. #include #include -/** - * Create an empty texture. - * @param w Width of the new texture to create. - * @param h Height of the new texture to create. - * @return A GRRLIB_texImg structure newly created. - */ -INLINE -GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h) -{ - GRRLIB_texImg *my_texture = (struct GRRLIB_texImg *)calloc(1, sizeof(GRRLIB_texImg)); - - if(my_texture != NULL) { - my_texture->data = memalign(32, h * w * 4); - my_texture->w = w; - my_texture->h = h; - - // Initialize the texture - memset(my_texture->data, '\0', (h * w) << 2); - - GRRLIB_SetHandle(my_texture, 0, 0); - GRRLIB_FlushTex(my_texture); - } - return my_texture; -} - /** * Write the contents of a texture in the data cache down to main memory. * For performance the CPU holds a data cache where modifications are stored before they get written down to main memory. @@ -71,7 +46,9 @@ void GRRLIB_FlushTex (GRRLIB_texImg *tex) { INLINE void GRRLIB_FreeTexture (GRRLIB_texImg *tex) { if(tex != NULL) { - if (tex->data != NULL) free(tex->data); + if (tex->data != NULL) { + free(tex->data); + } free(tex); tex = NULL; }