+void Image_MakesRGBColorsFromLinear(unsigned char *pout, const unsigned char *pin, int numpixels)
+{
+ int i;
+ // this math from http://www.opengl.org/registry/specs/EXT/texture_sRGB.txt
+ if (!image_srgbfromlinear[255])
+ for (i = 0;i < 256;i++)
+ image_srgbfromlinear[i] = (unsigned char)bound(0, Image_sRGBFloatFromLinear(i*2) * 128.0f, 255);
+ for (i = 0;i < numpixels;i++)
+ {
+ pout[i*4+0] = image_srgbfromlinear[pin[i*4+0]];
+ pout[i*4+1] = image_srgbfromlinear[pin[i*4+1]];
+ pout[i*4+2] = image_srgbfromlinear[pin[i*4+2]];
+ pout[i*4+3] = pin[i*4+3];
+ }
+}
+