Commit 71656d10 authored by Bob Pendleton's avatar Bob Pendleton

re: bug#563. checking in some commented out trace code and a fix so that the...

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.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402746
parent d8da8f7c
...@@ -209,43 +209,58 @@ struct SDL_SysWMinfo; ...@@ -209,43 +209,58 @@ struct SDL_SysWMinfo;
#define SDL_AllocSurface SDL_CreateRGBSurface #define SDL_AllocSurface SDL_CreateRGBSurface
extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void); extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen); extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf,
extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); int maxlen);
extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf,
int maxlen);
extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void); extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
int height,
int bpp,
Uint32 flags); Uint32 flags);
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format, extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format,
Uint32 flags); Uint32 flags);
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height, extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width,
int bpp, Uint32 flags); int height,
int bpp,
Uint32 flags);
extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void); extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen, extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
int numrects, SDL_Rect * rects); int numrects,
extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen, Sint32 x, SDL_Rect * rects);
Sint32 y, Uint32 w, Uint32 h); extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen,
Sint32 x,
Sint32 y,
Uint32 w,
Uint32 h);
extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen); extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface,
Uint32 flag,
Uint8 alpha); Uint8 alpha);
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface); extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface * extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface * surface);
surface);
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
const char *icon); const char *icon);
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title, extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
const char **icon); const char **icon);
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask); extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon,
Uint8 * mask);
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface); extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface, int flags, extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface,
int flags,
const SDL_Color * colors, const SDL_Color * colors,
int firstcolor, int ncolors); int firstcolor,
int ncolors);
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface, extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
const SDL_Color * colors, const SDL_Color * colors,
int firstcolor, int ncolors); int firstcolor,
int ncolors);
extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info); extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info);
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y); extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x,
Uint16 y);
extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width, extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
int height, int height,
Uint32 format, Uint32 format,
...@@ -257,8 +272,10 @@ extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay, ...@@ -257,8 +272,10 @@ extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
SDL_Rect * dstrect); SDL_Rect * dstrect);
extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay); extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval); extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay,
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval); int interval);
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay,
int *interval);
extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
......
...@@ -29,15 +29,14 @@ ...@@ -29,15 +29,14 @@
#include "video/SDL_sysvideo.h" #include "video/SDL_sysvideo.h"
#include "video/SDL_pixels_c.h" #include "video/SDL_pixels_c.h"
static SDL_WindowID SDL_VideoWindow = 0;
static SDL_WindowID SDL_VideoWindow;
static SDL_RendererInfo SDL_VideoRendererInfo; static SDL_RendererInfo SDL_VideoRendererInfo;
static SDL_TextureID SDL_VideoTexture; static SDL_TextureID SDL_VideoTexture = 0;
static SDL_Surface *SDL_VideoSurface; static SDL_Surface *SDL_VideoSurface = NULL;
static SDL_Surface *SDL_ShadowSurface; static SDL_Surface *SDL_ShadowSurface = NULL;
static SDL_Surface *SDL_PublicSurface; static SDL_Surface *SDL_PublicSurface = NULL;
static SDL_GLContext *SDL_VideoContext; static SDL_GLContext *SDL_VideoContext = NULL;
static char *wm_title; static char *wm_title = NULL;
char * char *
SDL_AudioDriverName(char *namebuf, int maxlen) SDL_AudioDriverName(char *namebuf, int maxlen)
...@@ -391,7 +390,7 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) ...@@ -391,7 +390,7 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
SDL_VideoSurface = NULL; SDL_VideoSurface = NULL;
} }
if (SDL_VideoContext) { if (SDL_VideoContext) {
SDL_GL_MakeCurrent(0, NULL); /* SDL_GL_MakeCurrent(0, NULL); *//* Doesn't do anything */
SDL_GL_DeleteContext(SDL_VideoContext); SDL_GL_DeleteContext(SDL_VideoContext);
SDL_VideoContext = NULL; SDL_VideoContext = NULL;
} }
......
...@@ -1973,6 +1973,7 @@ SDL_UnRLESurface(SDL_Surface * surface, int recode) ...@@ -1973,6 +1973,7 @@ SDL_UnRLESurface(SDL_Surface * surface, int recode)
} }
surface->map->info.flags &= surface->map->info.flags &=
(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY); (SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY);
surface->map->info.flags |= SDL_COPY_RLE_DESIRED;
if (surface->map->data) { if (surface->map->data) {
SDL_free(surface->map->data); SDL_free(surface->map->data);
......
...@@ -260,7 +260,8 @@ SDL_CalculateBlit(SDL_Surface * surface) ...@@ -260,7 +260,8 @@ SDL_CalculateBlit(SDL_Surface * surface)
surface->format->Amask); surface->format->Amask);
Uint32 dst_format = Uint32 dst_format =
SDL_MasksToPixelFormatEnum(dst->format->BitsPerPixel, SDL_MasksToPixelFormatEnum(dst->format->BitsPerPixel,
dst->format->Rmask, dst->format->Gmask, dst->format->Rmask,
dst->format->Gmask,
dst->format->Bmask, dst->format->Bmask,
dst->format->Amask); dst->format->Amask);
......
...@@ -947,7 +947,7 @@ GL_DestroyRenderer(SDL_Renderer * renderer) ...@@ -947,7 +947,7 @@ GL_DestroyRenderer(SDL_Renderer * renderer)
if (data) { if (data) {
if (data->context) { if (data->context) {
SDL_GL_MakeCurrent(0, NULL); /* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
SDL_GL_DeleteContext(data->context); SDL_GL_DeleteContext(data->context);
} }
SDL_free(data); SDL_free(data);
......
...@@ -542,6 +542,11 @@ SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect, ...@@ -542,6 +542,11 @@ SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect,
if (SDL_MapSurface(src, dst) < 0) { if (SDL_MapSurface(src, dst) < 0) {
return (-1); return (-1);
} }
/* just here for debugging */
/* 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", */
/* src, dst->flags, src->map->info.flags, */
/* dst, dst->flags, dst->map->info.flags, */
/* src->map->blit); */
} }
return (src->map->blit(src, srcrect, dst, dstrect)); return (src->map->blit(src, srcrect, dst, dstrect));
} }
......
...@@ -1329,15 +1329,17 @@ SDL_DestroyWindow(SDL_WindowID windowID) ...@@ -1329,15 +1329,17 @@ SDL_DestroyWindow(SDL_WindowID windowID)
if (window->id != windowID) { if (window->id != windowID) {
continue; continue;
} }
if (window->title) {
SDL_free(window->title);
window->title = NULL;
}
if (window->renderer) { if (window->renderer) {
SDL_DestroyRenderer(window->id); SDL_DestroyRenderer(window->id);
window->renderer = NULL;
} }
if (_this->DestroyWindow) { if (_this->DestroyWindow) {
_this->DestroyWindow(_this, window); _this->DestroyWindow(_this, window);
} }
if (window->title) {
SDL_free(window->title);
}
if (j != display->num_windows - 1) { if (j != display->num_windows - 1) {
SDL_memcpy(&display->windows[i], SDL_memcpy(&display->windows[i],
&display->windows[i + 1], &display->windows[i + 1],
...@@ -1439,9 +1441,8 @@ SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags) ...@@ -1439,9 +1441,8 @@ SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags)
SDL_DestroyRenderer(windowID); SDL_DestroyRenderer(windowID);
/* Create a new renderer instance */ /* Create a new renderer instance */
window->renderer = window->renderer = SDL_CurrentDisplay.render_drivers[index]
SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window, .CreateRenderer(window, flags);
flags);
SDL_SelectRenderer(window->id); SDL_SelectRenderer(window->id);
return 0; return 0;
...@@ -2220,9 +2221,11 @@ SDL_VideoQuit(void) ...@@ -2220,9 +2221,11 @@ SDL_VideoQuit(void)
} }
if (display->gamma) { if (display->gamma) {
SDL_free(display->gamma); SDL_free(display->gamma);
display->gamma = NULL;
} }
if (display->driverdata) { if (display->driverdata) {
SDL_free(display->driverdata); SDL_free(display->driverdata);
display->driverdata = NULL;
} }
} }
if (_this->displays) { if (_this->displays) {
......
...@@ -44,8 +44,8 @@ X11_DispatchEvent(_THIS) ...@@ -44,8 +44,8 @@ X11_DispatchEvent(_THIS)
handler */ handler */
if (XFilterEvent(&xevent, None) == True) { if (XFilterEvent(&xevent, None) == True) {
#if 0 #if 0
printf("Filtered event type = %d display = %d window = %d\n", printf("Filtered event type = %d display = %d window = %d\n",
xevent.type, xevent.xany.display, xevent.xany.window); xevent.type, xevent.xany.display, xevent.xany.window);
#endif #endif
return; return;
} }
...@@ -73,10 +73,9 @@ X11_DispatchEvent(_THIS) ...@@ -73,10 +73,9 @@ X11_DispatchEvent(_THIS)
if (!data) { if (!data) {
return; return;
} }
#if 0 #if 0
printf("type = %d display = %d window = %d\n", printf("type = %d display = %d window = %d\n",
xevent.type, xevent.xany.display, xevent.xany.window); xevent.type, xevent.xany.display, xevent.xany.window);
#endif #endif
switch (xevent.type) { switch (xevent.type) {
......
...@@ -24,7 +24,7 @@ static void ...@@ -24,7 +24,7 @@ static void
quit(int rc) quit(int rc)
{ {
if (context) { if (context) {
SDL_GL_MakeCurrent(0, NULL); /* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
SDL_GL_DeleteContext(context); SDL_GL_DeleteContext(context);
} }
CommonQuit(state); CommonQuit(state);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment