From 6a4dd8ae85c621f2d16ede4a0ebb41a3b34bcea9 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 22 Oct 2011 15:28:56 +0000 Subject: [PATCH] fix image loading sRGB conversion git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11460 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 1 + image.h | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) 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); -- 2.39.2