From: divverent Date: Thu, 16 Oct 2014 12:05:04 +0000 (+0000) Subject: Fix _alpha image loading. X-Git-Tag: xonotic-v0.8.1~29^2~58 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6d56b5f88b61a8c3092d56efafabeaa12fdd8294;p=xonotic%2Fdarkplaces.git Fix _alpha image loading. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12102 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/image.c b/image.c index 470ea179..58f7c053 100644 --- a/image.c +++ b/image.c @@ -794,7 +794,6 @@ static unsigned char *LoadWAL_BGRA (const unsigned char *f, int filesize, int *m qboolean LoadWAL_GetMetadata(const unsigned char *f, int filesize, int *retwidth, int *retheight, int *retflags, int *retvalue, int *retcontents, char *retanimname32c) { - unsigned char *image_buffer; const q2wal_t *inwal = (const q2wal_t *)f; if (filesize < (int) sizeof(q2wal_t)) @@ -1005,11 +1004,15 @@ unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qbo if(f) { int mymiplevel2 = miplevel ? *miplevel : 0; + int image_width_save = image_width; + int image_height_save = image_height; data2 = format->loadfunc(f, (int)filesize, &mymiplevel2); - if(data2 && mymiplevel == mymiplevel2) + if(data2 && mymiplevel == mymiplevel2 && image_width == image_width_save && image_height == image_height_save) Image_CopyAlphaFromBlueBGRA(data, data2, image_width, image_height); else Con_Printf("loadimagepixelsrgba: corrupt or invalid alpha image %s_alpha\n", basename); + image_width = image_width_save; + image_height = image_height_save; if(data2) Mem_Free(data2); Mem_Free(f);