mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-04 17:06:25 +00:00
Remove SDL_CalculateGammaRamp.
This commit is contained in:
@@ -286,7 +286,6 @@
|
||||
#define SDL_MapRGBA SDL_MapRGBA_REAL
|
||||
#define SDL_GetRGB SDL_GetRGB_REAL
|
||||
#define SDL_GetRGBA SDL_GetRGBA_REAL
|
||||
#define SDL_CalculateGammaRamp SDL_CalculateGammaRamp_REAL
|
||||
#define SDL_GetPlatform SDL_GetPlatform_REAL
|
||||
#define SDL_GetPowerInfo SDL_GetPowerInfo_REAL
|
||||
#define SDL_HasIntersection SDL_HasIntersection_REAL
|
||||
|
@@ -313,7 +313,6 @@ SDL_DYNAPI_PROC(Uint32,SDL_MapRGB,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, U
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_MapRGBA,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),)
|
||||
SDL_DYNAPI_PROC(void,SDL_GetRGBA,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),)
|
||||
SDL_DYNAPI_PROC(void,SDL_CalculateGammaRamp,(float a, Uint16 *b),(a,b),)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetPlatform,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_PowerState,SDL_GetPowerInfo,(int *a, int *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasIntersection,(const SDL_Rect *a, const SDL_Rect *b),(a,b),return)
|
||||
|
@@ -1150,44 +1150,4 @@ SDL_FreeBlitMap(SDL_BlitMap * map)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SDL_CalculateGammaRamp(float gamma, Uint16 * ramp)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Input validation */
|
||||
if (gamma < 0.0f ) {
|
||||
SDL_InvalidParamError("gamma");
|
||||
return;
|
||||
}
|
||||
if (ramp == NULL) {
|
||||
SDL_InvalidParamError("ramp");
|
||||
return;
|
||||
}
|
||||
|
||||
/* 0.0 gamma is all black */
|
||||
if (gamma == 0.0f) {
|
||||
SDL_memset(ramp, 0, 256 * sizeof(Uint16));
|
||||
return;
|
||||
} else if (gamma == 1.0f) {
|
||||
/* 1.0 gamma is identity */
|
||||
for (i = 0; i < 256; ++i) {
|
||||
ramp[i] = (i << 8) | i;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
/* Calculate a real gamma ramp */
|
||||
int value;
|
||||
gamma = 1.0f / gamma;
|
||||
for (i = 0; i < 256; ++i) {
|
||||
value =
|
||||
(int) (SDL_pow((double) i / 256.0, gamma) * 65535.0 + 0.5);
|
||||
if (value > 65535) {
|
||||
value = 65535;
|
||||
}
|
||||
ramp[i] = (Uint16) value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
Reference in New Issue
Block a user