SDL-1.2.15-x11-Bypass-SetGammaRamp-when-changing-gamma.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From 4b56fa058a45b7c804d1a5fcaf7a70db0bd0581c Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <petr.pisar@atlas.cz>
  3. Date: Tue, 1 Jan 2013 21:25:15 +0100
  4. Subject: [PATCH] x11: Bypass SetGammaRamp when changing gamma
  5. Recent Xorg has broken dynamic colors setting, so calling SDL_SetGamme()
  6. does not have any effect here. Recent means xorg-server >= 1.7, since 2010.
  7. See <https://bugs.freedesktop.org/show_bug.cgi?id=27222>.
  8. ---
  9. src/video/SDL_gamma.c | 15 ++-------------
  10. 1 files changed, 2 insertions(+), 13 deletions(-)
  11. diff --git a/src/video/SDL_gamma.c b/src/video/SDL_gamma.c
  12. index 4fd0370..464ab88 100644
  13. --- a/src/video/SDL_gamma.c
  14. +++ b/src/video/SDL_gamma.c
  15. @@ -92,22 +92,11 @@ static void CalculateGammaFromRamp(float *gamma, Uint16 *ramp)
  16. int SDL_SetGamma(float red, float green, float blue)
  17. {
  18. - int succeeded;
  19. + int succeeded = -1;
  20. SDL_VideoDevice *video = current_video;
  21. SDL_VideoDevice *this = current_video;
  22. - succeeded = -1;
  23. - /* Prefer using SetGammaRamp(), as it's more flexible */
  24. - {
  25. - Uint16 ramp[3][256];
  26. -
  27. - CalculateGammaRamp(red, ramp[0]);
  28. - CalculateGammaRamp(green, ramp[1]);
  29. - CalculateGammaRamp(blue, ramp[2]);
  30. - succeeded = SDL_SetGammaRamp(ramp[0], ramp[1], ramp[2]);
  31. - }
  32. - if ( (succeeded < 0) && video->SetGamma ) {
  33. - SDL_ClearError();
  34. + if ( video->SetGamma ) {
  35. succeeded = video->SetGamma(this, red, green, blue);
  36. }
  37. return succeeded;
  38. --
  39. 1.7.8.6