Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Removed gamma support since it wasn't widely used and not well suppor…
Browse files Browse the repository at this point in the history
…ted.
  • Loading branch information
slouken committed Feb 10, 2011
1 parent 152f59e commit b0d89bd
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 1,137 deletions.
6 changes: 6 additions & 0 deletions include/SDL_compat.h
Expand Up @@ -328,6 +328,12 @@ extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
SDL_Rect * dstrect);
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
const Uint16 * green,
const Uint16 * blue);
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
Uint16 * blue);
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
Expand Down
49 changes: 0 additions & 49 deletions include/SDL_video.h
Expand Up @@ -360,55 +360,6 @@ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window,
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window);

/**
* \brief Set the gamma correction for each of the color channels on the
* currently selected display.
*
* \return 0 on success, or -1 if setting the gamma isn't supported.
*
* \sa SDL_SetGammaRamp()
*/
extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);

/**
* \brief Set the gamma ramp for the currently selected display.
*
* \param red The translation table for the red channel, or NULL.
* \param green The translation table for the green channel, or NULL.
* \param blue The translation table for the blue channel, or NULL.
*
* \return 0 on success, or -1 if gamma ramps are unsupported.
*
* Set the gamma translation table for the red, green, and blue channels
* of the video hardware. Each table is an array of 256 16-bit quantities,
* representing a mapping between the input and output for that channel.
* The input is the index into the array, and the output is the 16-bit
* gamma value at that index, scaled to the output color precision.
*
* \sa SDL_GetGammaRamp()
*/
extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 * red,
const Uint16 * green,
const Uint16 * blue);

/**
* \brief Get the gamma ramp for the currently selected display.
*
* \param red A pointer to a 256 element array of 16-bit quantities to hold
* the translation table for the red channel, or NULL.
* \param green A pointer to a 256 element array of 16-bit quantities to hold
* the translation table for the green channel, or NULL.
* \param blue A pointer to a 256 element array of 16-bit quantities to hold
* the translation table for the blue channel, or NULL.
*
* \return 0 on success, or -1 if gamma ramps are unsupported.
*
* \sa SDL_SetGammaRamp()
*/
extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 * red, Uint16 * green,
Uint16 * blue);


/**
* \brief Create a window with the specified position, dimensions, and flags.
*
Expand Down
20 changes: 20 additions & 0 deletions src/SDL_compat.c
Expand Up @@ -1526,6 +1526,26 @@ SDL_GL_SwapBuffers(void)
SDL_GL_SwapWindow(SDL_VideoWindow);
}

int
SDL_SetGamma(float red, float green, float blue)
{
SDL_Unsupported();
return -1;
}

int
SDL_SetGammaRamp(const Uint16 * red, const Uint16 * green, const Uint16 * blue)
{
SDL_Unsupported();
return -1;
}

int
SDL_GetGammaRamp(Uint16 * red, Uint16 * green, Uint16 * blue)
{
SDL_Unsupported();
return -1;
}

int
SDL_EnableKeyRepeat(int delay, int interval)
Expand Down
236 changes: 0 additions & 236 deletions src/video/SDL_gamma.c

This file was deleted.

14 changes: 0 additions & 14 deletions src/video/SDL_pixels.c
Expand Up @@ -764,20 +764,6 @@ SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format,
}
}

/* Apply gamma to a set of colors - this is easy. :) */
void
SDL_ApplyGamma(Uint16 * gamma, SDL_Color * colors, SDL_Color * output,
int ncolors)
{
int i;

for (i = 0; i < ncolors; ++i) {
output[i].r = gamma[0 * 256 + colors[i].r] >> 8;
output[i].g = gamma[1 * 256 + colors[i].g] >> 8;
output[i].b = gamma[2 * 256 + colors[i].b] >> 8;
}
}

/* Map from Palette to Palette */
static Uint8 *
Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical)
Expand Down
2 changes: 0 additions & 2 deletions src/video/SDL_pixels_c.h
Expand Up @@ -45,7 +45,5 @@ extern void SDL_FreeBlitMap(SDL_BlitMap * map);
extern int SDL_CalculatePitch(SDL_Surface * surface);
extern void SDL_DitherColors(SDL_Color * colors, int bpp);
extern Uint8 SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b);
extern void SDL_ApplyGamma(Uint16 * gamma, SDL_Color * colors,
SDL_Color * output, int ncolors);

/* vi: set ts=4 sw=4 expandtab: */
11 changes: 0 additions & 11 deletions src/video/SDL_sysvideo.h
Expand Up @@ -110,9 +110,6 @@ struct SDL_VideoDisplay
SDL_DisplayMode current_mode;
SDL_bool updating_fullscreen;

Uint16 *gamma;
Uint16 *saved_gamma; /* (just offset into gamma) */

SDL_Window *windows;
SDL_Window *fullscreen_window;

Expand Down Expand Up @@ -169,12 +166,6 @@ struct SDL_VideoDevice
*/
int (*SetDisplayMode) (_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);

/* Set the gamma ramp */
int (*SetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);

/* Get the gamma ramp */
int (*GetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);

/* * * */
/*
* Window functions
Expand Down Expand Up @@ -343,8 +334,6 @@ extern int SDL_GetDesktopDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_D
extern int SDL_GetCurrentDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
extern SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
extern int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode);
extern int SDL_SetGammaRampForDisplay(SDL_VideoDisplay * display, const Uint16 * red, const Uint16 * green, const Uint16 * blue);
extern int SDL_GetGammaRampForDisplay(SDL_VideoDisplay * display, Uint16 * red, Uint16 * green, Uint16 * blue);

extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);

Expand Down

0 comments on commit b0d89bd

Please sign in to comment.