From: divverent Date: Sat, 22 Oct 2011 15:28:56 +0000 (+0000) Subject: fix image loading sRGB conversion X-Git-Tag: xonotic-v0.6.0~163^2~97 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6a4dd8ae85c621f2d16ede4a0ebb41a3b34bcea9;p=xonotic%2Fdarkplaces.git fix image loading sRGB conversion git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11460 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_textures.c b/gl_textures.c index aa1d2f12..2fbc5599 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -1620,6 +1620,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden { temppixels = (unsigned char *)Mem_Alloc(tempmempool, size); memcpy(temppixels, data, size); + data = temppixels; } Image_MakeLinearColorsFromsRGB(temppixels, temppixels, width*height*depth*sides); } diff --git a/image.h b/image.h index c027f641..91535773 100644 --- a/image.h +++ b/image.h @@ -51,10 +51,8 @@ extern cvar_t r_fixtrans_auto; #define Image_LinearFloatFromsRGBFloat(c) (((c) <= 0.04045f) ? (c) * (1.0f / 12.92f) : (float)pow(((c) + 0.055f)*(1.0f/1.055f), 2.4f)) #define Image_sRGBFloatFromLinearFloat(c) (((c) < 0.0031308f) ? (c) * 12.92f : 1.055f * (float)pow((c), 1.0f/2.4f) - 0.055f) - #define Image_LinearFloatFromsRGB(c) Image_LinearFloatFromsRGBFloat((c) * (1.0f / 255.0f)) #define Image_sRGBFloatFromLinear(c) Image_sRGBFloatFromLinearFloat((c) * (1.0f / 255.0f)) - #define Image_sRGBFloatFromLinear_Lightmap(c) Image_sRGBFloatFromLinearFloat((c) * (2.0f / 255.0f)) * 0.5f void Image_MakeLinearColorsFromsRGB(unsigned char *pout, const unsigned char *pin, int numpixels);