Mercurial > sdl-ios-xcode
diff src/video/SDL_gamma.c @ 1330:450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
using Visual C++ 2005
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 06 Feb 2006 08:28:51 +0000 |
parents | c9b51268668f |
children | 37d43bd654d7 |
line wrap: on
line diff
--- a/src/video/SDL_gamma.c Sat Feb 04 22:01:44 2006 +0000 +++ b/src/video/SDL_gamma.c Mon Feb 06 08:28:51 2006 +0000 @@ -22,18 +22,26 @@ /* Gamma correction support */ -#define USE_MATH_H /* Used for calculating gamma ramps */ +#include "SDL_config.h" -#ifdef USE_MATH_H -#include <math.h> +#ifdef HAVE_MATH_H +#include <math.h> /* Used for calculating gamma ramps */ #endif -#include <stdlib.h> -#include <string.h> #include "SDL_error.h" +#include "SDL_stdlib.h" +#include "SDL_string.h" #include "SDL_sysvideo.h" -#ifdef USE_MATH_H +#ifndef HAVE_MATH_H +#include "math_private.h" +#include "e_sqrt.h" +#include "e_pow.h" +#include "e_log.h" +#define pow(x, y) __ieee754_pow(x, y) +#define log(x) __ieee754_log(x) +#endif + static void CalculateGammaRamp(float gamma, Uint16 *ramp) { int i; @@ -85,7 +93,6 @@ *gamma = 1.0f / (sum / count); } } -#endif /* USE_MATH_H */ int SDL_SetGamma(float red, float green, float blue) { @@ -94,7 +101,6 @@ SDL_VideoDevice *this = current_video; succeeded = -1; -#ifdef USE_MATH_H /* Prefer using SetGammaRamp(), as it's more flexible */ { Uint16 ramp[3][256]; @@ -104,9 +110,6 @@ CalculateGammaRamp(blue, ramp[2]); succeeded = SDL_SetGammaRamp(ramp[0], ramp[1], ramp[2]); } -#else - SDL_SetError("Gamma correction not supported"); -#endif if ( (succeeded < 0) && video->SetGamma ) { SDL_ClearError(); succeeded = video->SetGamma(this, red, green, blue); @@ -124,7 +127,6 @@ SDL_VideoDevice *this = current_video; succeeded = -1; -#ifdef USE_MATH_H /* Prefer using GetGammaRamp(), as it's more flexible */ { Uint16 ramp[3][256]; @@ -136,9 +138,6 @@ CalculateGammaFromRamp(blue, ramp[2]); } } -#else - SDL_SetError("Gamma correction not supported"); -#endif if ( (succeeded < 0) && video->GetGamma ) { SDL_ClearError(); succeeded = video->GetGamma(this, red, green, blue);