]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix image loading sRGB conversion
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 22 Oct 2011 15:28:56 +0000 (15:28 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 22 Oct 2011 15:28:56 +0000 (15:28 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11460 d7cf8633-e32d-0410-b094-e92efae38249

gl_textures.c
image.h

index aa1d2f12960466b96b4b36d66c28d5fddc9c70f8..2fbc559974ea2245026c178c1fd2b013cfea57af 100644 (file)
@@ -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 c027f641e28362301440a378600c8a8733499a37..915357739ed24048a9dce598f41d34b4681f25ec 100644 (file)
--- 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);