From dc5f720485e4c2c2a24acb244c57c56f9a5513da Mon Sep 17 00:00:00 2001 From: danij Date: Tue, 10 Jan 2012 13:32:23 +0000 Subject: [PATCH] Refactor: Removed '_' prefix from members of Texture These objects no longer expose their internal state so this naming convention is redundant. --- doomsday/engine/portable/src/texture.c | 86 +++++++++++++------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/doomsday/engine/portable/src/texture.c b/doomsday/engine/portable/src/texture.c index f2dba9a7ee..a5a34e532e 100644 --- a/doomsday/engine/portable/src/texture.c +++ b/doomsday/engine/portable/src/texture.c @@ -40,23 +40,23 @@ typedef struct texture_variantlist_node_s { struct texture_s { /// @see textureFlags - int _flags; + int flags; /// Size in logical pixels (not necessarily the same as pixel dimensions). - Size2* _size; + Size2* size; /// Unique identifier of the primary binding in the owning collection. - textureid_t _primaryBind; + textureid_t primaryBind; /// List of variants (e.g., color translations). - struct texture_variantlist_node_s* _variants; + struct texture_variantlist_node_s* variants; /// Table of analyses object ptrs, used for various purposes depending /// on the variant specification. - void* _analyses[TEXTURE_ANALYSIS_COUNT]; + void* analyses[TEXTURE_ANALYSIS_COUNT]; /// User data associated with this texture. - void* _userData; + void* userData; }; Texture* Texture_New(int flags, textureid_t bindId, void* userData) @@ -66,12 +66,12 @@ Texture* Texture_New(int flags, textureid_t bindId, void* userData) Con_Error("Texture::New: Failed on allocation of %lu bytes for new Texture.", (unsigned long) sizeof *tex); - tex->_flags = flags; - tex->_size = Size2_New(); - tex->_variants = NULL; - tex->_primaryBind = bindId; - tex->_userData = userData; - memset(tex->_analyses, 0, sizeof(tex->_analyses)); + tex->flags = flags; + tex->size = Size2_New(); + tex->variants = NULL; + tex->primaryBind = bindId; + tex->userData = userData; + memset(tex->analyses, 0, sizeof(tex->analyses)); return tex; } @@ -87,10 +87,10 @@ Texture* Texture_NewWithSize(int flags, textureid_t bindId, const Size2Raw* size static void destroyVariants(Texture* tex) { assert(tex); - while(tex->_variants) + while(tex->variants) { - TextureVariant* variant = tex->_variants->variant; - texture_variantlist_node_t* next = tex->_variants->next; + TextureVariant* variant = tex->variants->variant; + texture_variantlist_node_t* next = tex->variants->next; #if _DEBUG DGLuint glName = TextureVariant_GLName(variant); if(glName) @@ -106,8 +106,8 @@ static void destroyVariants(Texture* tex) } #endif TextureVariant_Delete(variant); - free(tex->_variants); - tex->_variants = next; + free(tex->variants); + tex->variants = next; } } @@ -117,7 +117,7 @@ static void destroyAnalyses(Texture* tex) assert(tex); for(i = 0; i < TEXTURE_ANALYSIS_COUNT; ++i) { - if(tex->_analyses[i]) free(tex->_analyses[i]); + if(tex->analyses[i]) free(tex->analyses[i]); } } @@ -126,47 +126,47 @@ void Texture_Delete(Texture* tex) assert(tex); destroyVariants(tex); destroyAnalyses(tex); - Size2_Delete(tex->_size); + Size2_Delete(tex->size); free(tex); } textureid_t Texture_PrimaryBind(const Texture* tex) { assert(tex); - return tex->_primaryBind; + return tex->primaryBind; } void Texture_SetPrimaryBind(Texture* tex, textureid_t bindId) { assert(tex); - tex->_primaryBind = bindId; + tex->primaryBind = bindId; } void Texture_AttachUserData(Texture* tex, void* userData) { assert(tex); #if _DEBUG - if(tex->_userData) + if(tex->userData) { Con_Message("Warning:Texture::AttachUserData: User data is already present for [%p id:%i], it will be replaced.\n", (void*)tex, Textures_Id(tex)); } #endif - tex->_userData = userData; + tex->userData = userData; } void* Texture_DetachUserData(Texture* tex) { void* data; assert(tex); - data = tex->_userData; - tex->_userData = NULL; + data = tex->userData; + tex->userData = NULL; return data; } void* Texture_UserData(const Texture* tex) { assert(tex); - return tex->_userData; + return tex->userData; } void Texture_ClearVariants(Texture* tex) @@ -193,66 +193,66 @@ TextureVariant* Texture_AddVariant(Texture* tex, TextureVariant* variant) Con_Error("Texture::AddVariant: Failed on allocation of %lu bytes for new node.", (unsigned long) sizeof *node); node->variant = variant; - node->next = tex->_variants; - tex->_variants = node; + node->next = tex->variants; + tex->variants = node; return variant; } boolean Texture_IsCustom(const Texture* tex) { assert(tex); - return (tex->_flags & TXF_CUSTOM) != 0; + return (tex->flags & TXF_CUSTOM) != 0; } int Texture_Flags(const Texture* tex) { assert(tex); - return tex->_flags; + return tex->flags; } void Texture_SetFlags(Texture* tex, int flags) { assert(tex); - tex->_flags = flags; + tex->flags = flags; /// \fixme Update any Materials (and thus Surfaces) which reference this. } int Texture_Width(const Texture* tex) { assert(tex); - return Size2_Width(tex->_size); + return Size2_Width(tex->size); } void Texture_SetWidth(Texture* tex, int width) { assert(tex); - Size2_SetWidth(tex->_size, width); + Size2_SetWidth(tex->size, width); /// \fixme Update any Materials (and thus Surfaces) which reference this. } int Texture_Height(const Texture* tex) { assert(tex); - return Size2_Height(tex->_size); + return Size2_Height(tex->size); } void Texture_SetHeight(Texture* tex, int height) { assert(tex); - Size2_SetHeight(tex->_size, height); + Size2_SetHeight(tex->size, height); /// \fixme Update any Materials (and thus Surfaces) which reference this. } const Size2* Texture_Size(const Texture* tex) { assert(tex); - return tex->_size; + return tex->size; } void Texture_SetSize(Texture* tex, const Size2Raw* size) { assert(tex && size); - Size2_SetWidthHeight(tex->_size, size->width, size->height); + Size2_SetWidthHeight(tex->size, size->width, size->height); /// \fixme Update any Materials (and thus Surfaces) which reference this. } @@ -264,7 +264,7 @@ int Texture_IterateVariants(Texture* tex, if(callback) { - texture_variantlist_node_t* node = tex->_variants; + texture_variantlist_node_t* node = tex->variants; while(node) { texture_variantlist_node_t* next = node->next; @@ -279,7 +279,7 @@ int Texture_IterateVariants(Texture* tex, void* Texture_Analysis(const Texture* tex, texture_analysisid_t analysis) { assert(tex && VALID_TEXTURE_ANALYSISID(analysis)); - return tex->_analyses[analysis]; + return tex->analyses[analysis]; } void Texture_AttachAnalysis(Texture* tex, texture_analysisid_t analysis, @@ -287,7 +287,7 @@ void Texture_AttachAnalysis(Texture* tex, texture_analysisid_t analysis, { assert(tex && VALID_TEXTURE_ANALYSISID(analysis)); #if _DEBUG - if(tex->_analyses[analysis]) + if(tex->analyses[analysis]) { Uri* uri = Textures_ComposeUri(Textures_Id(tex)); ddstring_t* path = Uri_ToString(uri); @@ -297,7 +297,7 @@ void Texture_AttachAnalysis(Texture* tex, texture_analysisid_t analysis, Uri_Delete(uri); } #endif - tex->_analyses[analysis] = data; + tex->analyses[analysis] = data; } void* Texture_DetachAnalysis(Texture* tex, texture_analysisid_t analysis) @@ -305,7 +305,7 @@ void* Texture_DetachAnalysis(Texture* tex, texture_analysisid_t analysis) void* data; assert(tex && VALID_TEXTURE_ANALYSISID(analysis)); - data = tex->_analyses[analysis]; - tex->_analyses[analysis] = NULL; + data = tex->analyses[analysis]; + tex->analyses[analysis] = NULL; return data; }