re: bug#563. checking in some commented out trace code and a fix so that the in testalpha.c the background only flashes when alpha == 255. The problem that is being
authorBob Pendleton <bob@pendleton.com>
Fri, 14 Mar 2008 18:17:49 +0000
changeset 232891e601d9df8b
parent 2327 7b53a8401195
child 2329 c1a390f6a819
re: bug#563. checking in some commented out trace code and a fix so that the in testalpha.c the background only flashes when alpha == 255. The problem that is being
fixed is caused by clearing SDL_COPY_RLE_COLORKEY without setting SDL_COPY_RLE_DESIRED in SDL_UnRELSurface.
include/SDL_compat.h
src/SDL_compat.c
src/video/SDL_RLEaccel.c
src/video/SDL_blit.c
src/video/SDL_renderer_gl.c
src/video/SDL_surface.c
src/video/SDL_video.c
src/video/x11/SDL_x11events.c
test/testgl2.c
     1.1 --- a/include/SDL_compat.h	Fri Mar 07 23:57:15 2008 +0000
     1.2 +++ b/include/SDL_compat.h	Fri Mar 14 18:17:49 2008 +0000
     1.3 @@ -209,43 +209,58 @@
     1.4  #define SDL_AllocSurface    SDL_CreateRGBSurface
     1.5  
     1.6  extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
     1.7 -extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
     1.8 -extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
     1.9 +extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf,
    1.10 +                                                  int maxlen);
    1.11 +extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf,
    1.12 +                                                  int maxlen);
    1.13  extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
    1.14 -extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp,
    1.15 +extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
    1.16 +                                            int height,
    1.17 +                                            int bpp,
    1.18                                              Uint32 flags);
    1.19  extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format,
    1.20                                                   Uint32 flags);
    1.21 -extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height,
    1.22 -                                                      int bpp, Uint32 flags);
    1.23 +extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width,
    1.24 +                                                      int height,
    1.25 +                                                      int bpp,
    1.26 +                                                      Uint32 flags);
    1.27  extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
    1.28  extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
    1.29 -                                             int numrects, SDL_Rect * rects);
    1.30 -extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen, Sint32 x,
    1.31 -                                            Sint32 y, Uint32 w, Uint32 h);
    1.32 +                                             int numrects,
    1.33 +                                             SDL_Rect * rects);
    1.34 +extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen,
    1.35 +                                            Sint32 x,
    1.36 +                                            Sint32 y,
    1.37 +                                            Uint32 w,
    1.38 +                                            Uint32 h);
    1.39  extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);
    1.40 -extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface, Uint32 flag,
    1.41 +extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface,
    1.42 +                                         Uint32 flag,
    1.43                                           Uint8 alpha);
    1.44  extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
    1.45 -extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
    1.46 -                                                            surface);
    1.47 +extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface * surface);
    1.48  extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
    1.49                                                 const char *icon);
    1.50  extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
    1.51                                                 const char **icon);
    1.52 -extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
    1.53 +extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon,
    1.54 +                                            Uint8 * mask);
    1.55  extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
    1.56  extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
    1.57  extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
    1.58 -extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface, int flags,
    1.59 +extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface,
    1.60 +                                           int flags,
    1.61                                             const SDL_Color * colors,
    1.62 -                                           int firstcolor, int ncolors);
    1.63 +                                           int firstcolor,
    1.64 +                                           int ncolors);
    1.65  extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
    1.66                                            const SDL_Color * colors,
    1.67 -                                          int firstcolor, int ncolors);
    1.68 +                                          int firstcolor,
    1.69 +                                          int ncolors);
    1.70  extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info);
    1.71  extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
    1.72 -extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
    1.73 +extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x,
    1.74 +                                           Uint16 y);
    1.75  extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
    1.76                                                            int height,
    1.77                                                            Uint32 format,
    1.78 @@ -257,8 +272,10 @@
    1.79                                                    SDL_Rect * dstrect);
    1.80  extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
    1.81  extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
    1.82 -extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
    1.83 -extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
    1.84 +extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay,
    1.85 +int interval);
    1.86 +extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay,
    1.87 +                                              int *interval);
    1.88  extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
    1.89  
    1.90  /* Ends C function definitions when using C++ */
     2.1 --- a/src/SDL_compat.c	Fri Mar 07 23:57:15 2008 +0000
     2.2 +++ b/src/SDL_compat.c	Fri Mar 14 18:17:49 2008 +0000
     2.3 @@ -29,15 +29,14 @@
     2.4  #include "video/SDL_sysvideo.h"
     2.5  #include "video/SDL_pixels_c.h"
     2.6  
     2.7 -
     2.8 -static SDL_WindowID SDL_VideoWindow;
     2.9 +static SDL_WindowID SDL_VideoWindow = 0;
    2.10  static SDL_RendererInfo SDL_VideoRendererInfo;
    2.11 -static SDL_TextureID SDL_VideoTexture;
    2.12 -static SDL_Surface *SDL_VideoSurface;
    2.13 -static SDL_Surface *SDL_ShadowSurface;
    2.14 -static SDL_Surface *SDL_PublicSurface;
    2.15 -static SDL_GLContext *SDL_VideoContext;
    2.16 -static char *wm_title;
    2.17 +static SDL_TextureID SDL_VideoTexture = 0;
    2.18 +static SDL_Surface *SDL_VideoSurface = NULL;
    2.19 +static SDL_Surface *SDL_ShadowSurface = NULL;
    2.20 +static SDL_Surface *SDL_PublicSurface = NULL;
    2.21 +static SDL_GLContext *SDL_VideoContext = NULL;
    2.22 +static char *wm_title = NULL;
    2.23  
    2.24  char *
    2.25  SDL_AudioDriverName(char *namebuf, int maxlen)
    2.26 @@ -391,7 +390,7 @@
    2.27          SDL_VideoSurface = NULL;
    2.28      }
    2.29      if (SDL_VideoContext) {
    2.30 -        SDL_GL_MakeCurrent(0, NULL);
    2.31 +        /* SDL_GL_MakeCurrent(0, NULL); *//* Doesn't do anything */
    2.32          SDL_GL_DeleteContext(SDL_VideoContext);
    2.33          SDL_VideoContext = NULL;
    2.34      }
     3.1 --- a/src/video/SDL_RLEaccel.c	Fri Mar 07 23:57:15 2008 +0000
     3.2 +++ b/src/video/SDL_RLEaccel.c	Fri Mar 14 18:17:49 2008 +0000
     3.3 @@ -1973,6 +1973,7 @@
     3.4          }
     3.5          surface->map->info.flags &=
     3.6              (SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY);
     3.7 +        surface->map->info.flags |= SDL_COPY_RLE_DESIRED;
     3.8  
     3.9          if (surface->map->data) {
    3.10              SDL_free(surface->map->data);
     4.1 --- a/src/video/SDL_blit.c	Fri Mar 07 23:57:15 2008 +0000
     4.2 +++ b/src/video/SDL_blit.c	Fri Mar 14 18:17:49 2008 +0000
     4.3 @@ -260,7 +260,8 @@
     4.4                                         surface->format->Amask);
     4.5          Uint32 dst_format =
     4.6              SDL_MasksToPixelFormatEnum(dst->format->BitsPerPixel,
     4.7 -                                       dst->format->Rmask, dst->format->Gmask,
     4.8 +                                       dst->format->Rmask, 
     4.9 +                                       dst->format->Gmask,
    4.10                                         dst->format->Bmask,
    4.11                                         dst->format->Amask);
    4.12  
     5.1 --- a/src/video/SDL_renderer_gl.c	Fri Mar 07 23:57:15 2008 +0000
     5.2 +++ b/src/video/SDL_renderer_gl.c	Fri Mar 14 18:17:49 2008 +0000
     5.3 @@ -947,7 +947,7 @@
     5.4  
     5.5      if (data) {
     5.6          if (data->context) {
     5.7 -            SDL_GL_MakeCurrent(0, NULL);
     5.8 +            /* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
     5.9              SDL_GL_DeleteContext(data->context);
    5.10          }
    5.11          SDL_free(data);
     6.1 --- a/src/video/SDL_surface.c	Fri Mar 07 23:57:15 2008 +0000
     6.2 +++ b/src/video/SDL_surface.c	Fri Mar 14 18:17:49 2008 +0000
     6.3 @@ -542,6 +542,11 @@
     6.4          if (SDL_MapSurface(src, dst) < 0) {
     6.5              return (-1);
     6.6          }
     6.7 +        /* just here for debugging */
     6.8 +/*         printf("src = 0x%08X src->flags = %08X src->map->info.flags = %08x\ndst = 0x%08X dst->flags = %08X dst->map->info.flags = %08X\nsrc->map->blit = 0x%08x\n",  */
     6.9 +/*                src, dst->flags, src->map->info.flags, */
    6.10 +/*                dst, dst->flags, dst->map->info.flags, */
    6.11 +/*                src->map->blit); */
    6.12      }
    6.13      return (src->map->blit(src, srcrect, dst, dstrect));
    6.14  }
     7.1 --- a/src/video/SDL_video.c	Fri Mar 07 23:57:15 2008 +0000
     7.2 +++ b/src/video/SDL_video.c	Fri Mar 14 18:17:49 2008 +0000
     7.3 @@ -1329,15 +1329,17 @@
     7.4              if (window->id != windowID) {
     7.5                  continue;
     7.6              }
     7.7 +            if (window->title) {
     7.8 +                SDL_free(window->title);
     7.9 +                window->title = NULL;
    7.10 +            }
    7.11              if (window->renderer) {
    7.12                  SDL_DestroyRenderer(window->id);
    7.13 +                window->renderer = NULL;
    7.14              }
    7.15              if (_this->DestroyWindow) {
    7.16                  _this->DestroyWindow(_this, window);
    7.17              }
    7.18 -            if (window->title) {
    7.19 -                SDL_free(window->title);
    7.20 -            }
    7.21              if (j != display->num_windows - 1) {
    7.22                  SDL_memcpy(&display->windows[i],
    7.23                             &display->windows[i + 1],
    7.24 @@ -1439,9 +1441,8 @@
    7.25      SDL_DestroyRenderer(windowID);
    7.26  
    7.27      /* Create a new renderer instance */
    7.28 -    window->renderer =
    7.29 -        SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window,
    7.30 -                                                                flags);
    7.31 +    window->renderer = SDL_CurrentDisplay.render_drivers[index]
    7.32 +        .CreateRenderer(window, flags);
    7.33      SDL_SelectRenderer(window->id);
    7.34  
    7.35      return 0;
    7.36 @@ -2220,9 +2221,11 @@
    7.37          }
    7.38          if (display->gamma) {
    7.39              SDL_free(display->gamma);
    7.40 +            display->gamma = NULL;
    7.41          }
    7.42          if (display->driverdata) {
    7.43              SDL_free(display->driverdata);
    7.44 +            display->driverdata = NULL;
    7.45          }
    7.46      }
    7.47      if (_this->displays) {
     8.1 --- a/src/video/x11/SDL_x11events.c	Fri Mar 07 23:57:15 2008 +0000
     8.2 +++ b/src/video/x11/SDL_x11events.c	Fri Mar 14 18:17:49 2008 +0000
     8.3 @@ -44,8 +44,8 @@
     8.4         handler */
     8.5      if (XFilterEvent(&xevent, None) == True) {
     8.6  #if 0
     8.7 -      printf("Filtered event type = %d display = %d window = %d\n", 
     8.8 -             xevent.type, xevent.xany.display, xevent.xany.window);
     8.9 +        printf("Filtered event type = %d display = %d window = %d\n",
    8.10 +               xevent.type, xevent.xany.display, xevent.xany.window);
    8.11  #endif
    8.12          return;
    8.13      }
    8.14 @@ -73,10 +73,9 @@
    8.15      if (!data) {
    8.16          return;
    8.17      }
    8.18 -
    8.19  #if 0
    8.20 -      printf("type = %d display = %d window = %d\n", 
    8.21 -             xevent.type, xevent.xany.display, xevent.xany.window);
    8.22 +    printf("type = %d display = %d window = %d\n",
    8.23 +           xevent.type, xevent.xany.display, xevent.xany.window);
    8.24  #endif
    8.25      switch (xevent.type) {
    8.26  
     9.1 --- a/test/testgl2.c	Fri Mar 07 23:57:15 2008 +0000
     9.2 +++ b/test/testgl2.c	Fri Mar 14 18:17:49 2008 +0000
     9.3 @@ -24,7 +24,7 @@
     9.4  quit(int rc)
     9.5  {
     9.6      if (context) {
     9.7 -        SDL_GL_MakeCurrent(0, NULL);
     9.8 +        /* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
     9.9          SDL_GL_DeleteContext(context);
    9.10      }
    9.11      CommonQuit(state);