summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Písař <petr.pisar@atlas.cz>2013-01-01 21:25:15 +0100
committerWim Taymans <wtaymans@redhat.com>2020-02-14 12:50:20 +0100
commita3aef88d23c7fc15a4ce0163dba8c3d91f7cb3de (patch)
tree71126ddd56380170bc082d85630e50e250187750
parent191b796ed521f08d8b20132aa3bd7c1c625d0528 (diff)
x11: Bypass SetGammaRamp when changing gamma
Recent Xorg has broken dynamic colors setting, so calling SDL_SetGamme() does not have any effect here. Recent means xorg-server >= 1.7, since 2010. See <https://bugs.freedesktop.org/show_bug.cgi?id=27222>.
-rw-r--r--src/video/SDL_gamma.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/video/SDL_gamma.c b/src/video/SDL_gamma.c
index 4fd037019f..464ab8827d 100644
--- a/src/video/SDL_gamma.c
+++ b/src/video/SDL_gamma.c
@@ -92,22 +92,11 @@ static void CalculateGammaFromRamp(float *gamma, Uint16 *ramp)
int SDL_SetGamma(float red, float green, float blue)
{
- int succeeded;
+ int succeeded = -1;
SDL_VideoDevice *video = current_video;
SDL_VideoDevice *this = current_video;
- succeeded = -1;
- /* Prefer using SetGammaRamp(), as it's more flexible */
- {
- Uint16 ramp[3][256];
-
- CalculateGammaRamp(red, ramp[0]);
- CalculateGammaRamp(green, ramp[1]);
- CalculateGammaRamp(blue, ramp[2]);
- succeeded = SDL_SetGammaRamp(ramp[0], ramp[1], ramp[2]);
- }
- if ( (succeeded < 0) && video->SetGamma ) {
- SDL_ClearError();
+ if ( video->SetGamma ) {
succeeded = video->SetGamma(this, red, green, blue);
}
return succeeded;