From cf1b4928abf6583bb4186f56881444ec9293b812 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 16 May 2003 11:10:32 +0000 Subject: [PATCH] replaced a loop that checked for alpha pixels with a call to Image_HasAlpha fixed a memory leak on s->maskpixels (due to memory pools this leak was probably not too bad) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2999 d7cf8633-e32d-0410-b094-e92efae38249 --- image.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/image.c b/image.c index c3430f22..8a46f44f 100644 --- a/image.c +++ b/image.c @@ -1428,10 +1428,7 @@ int image_loadskin(imageskin_t *s, char *name) s->basepixels_height = image_height; bumppixels = NULL;bumppixels_width = 0;bumppixels_height = 0; - for (j = 3;j < s->basepixels_width * s->basepixels_height * 4;j += 4) - if (s->basepixels[j] < 255) - break; - if (j < s->basepixels_width * s->basepixels_height * 4) + if (Image_HasAlpha(s->basepixels, s->basepixels_width * s->basepixels_height, true)) { s->maskpixels = Mem_Alloc(loadmodel->mempool, s->basepixels_width * s->basepixels_height * 4); s->maskpixels_width = s->basepixels_width; @@ -1513,6 +1510,8 @@ void image_freeskin(imageskin_t *s) { if (s->basepixels) Mem_Free(s->basepixels); + if (s->maskpixels) + Mem_Free(s->maskpixels); if (s->nmappixels) Mem_Free(s->nmappixels); if (s->glowpixels) -- 2.39.2