diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2017-08-06 19:45:15 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2017-08-06 19:45:15 +0100 |
commit | 2ffd6edea17c1ec8fdb33d1135e27db0eb080625 (patch) | |
tree | 113e09b6386ad4b69ddb00fb8e6e41fe31261320 /src/texture.c | |
parent | cee36733b5db5dcd0b479663000f889788468c80 (diff) | |
parent | 12450f38753699b0e606c3ad542892752da6aca8 (diff) | |
download | imv-2ffd6edea17c1ec8fdb33d1135e27db0eb080625.tar.gz |
Merge v3 changes into master
Diffstat (limited to 'src/texture.c')
-rw-r--r-- | src/texture.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/texture.c b/src/texture.c index 52ec521..bdfe91f 100644 --- a/src/texture.c +++ b/src/texture.c @@ -17,8 +17,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "texture.h" -void imv_init_texture(struct imv_texture *tex, SDL_Renderer *r) +struct imv_texture *imv_texture_create(SDL_Renderer *r) { + struct imv_texture *tex = malloc(sizeof(struct imv_texture)); memset(tex, 0, sizeof(struct imv_texture)); tex->renderer = r; @@ -26,9 +27,10 @@ void imv_init_texture(struct imv_texture *tex, SDL_Renderer *r) SDL_GetRendererInfo(r, &ri); tex->chunk_width = ri.max_texture_width != 0 ? ri.max_texture_width : 4096; tex->chunk_height = ri.max_texture_height != 0 ? ri.max_texture_height : 4096; + return tex; } -void imv_destroy_texture(struct imv_texture *tex) +void imv_texture_free(struct imv_texture *tex) { if(tex->num_chunks > 0) { for(int i = 0; i < tex->num_chunks; ++i) { @@ -39,6 +41,7 @@ void imv_destroy_texture(struct imv_texture *tex) tex->chunks = NULL; tex->renderer = NULL; } + free(tex); } int imv_texture_set_image(struct imv_texture *tex, FIBITMAP *image) |