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

Commit

Permalink
re: bug#563. checking in some commented out trace code and a fix so t…
Browse files Browse the repository at this point in the history
…hat 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.
  • Loading branch information
pendletonrc committed Mar 14, 2008
1 parent 520e247 commit 08be576
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 41 deletions.
53 changes: 35 additions & 18 deletions include/SDL_compat.h
Expand Up @@ -209,43 +209,58 @@ struct SDL_SysWMinfo;
#define SDL_AllocSurface SDL_CreateRGBSurface

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_VideoDriverName(char *namebuf, int maxlen);
extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf,
int maxlen);
extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf,
int maxlen);
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);
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format,
Uint32 flags);
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height,
int bpp, Uint32 flags);
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width,
int height,
int bpp,
Uint32 flags);
extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
int numrects, SDL_Rect * rects);
extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen, Sint32 x,
Sint32 y, Uint32 w, Uint32 h);
int numrects,
SDL_Rect * rects);
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_SetAlpha(SDL_Surface * surface, Uint32 flag,
extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface * surface,
Uint32 flag,
Uint8 alpha);
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
surface);
extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface * surface);
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
const char *icon);
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
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_ToggleFullScreen(SDL_Surface * surface);
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,
int firstcolor, int ncolors);
int firstcolor,
int ncolors);
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
const SDL_Color * colors,
int firstcolor, int ncolors);
int firstcolor,
int ncolors);
extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo *info);
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,
int height,
Uint32 format,
Expand All @@ -257,8 +272,10 @@ 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_EnableKeyRepeat(int delay, int interval);
extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
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);

/* Ends C function definitions when using C++ */
Expand Down
17 changes: 8 additions & 9 deletions src/SDL_compat.c
Expand Up @@ -29,15 +29,14 @@
#include "video/SDL_sysvideo.h"
#include "video/SDL_pixels_c.h"


static SDL_WindowID SDL_VideoWindow;
static SDL_WindowID SDL_VideoWindow = 0;
static SDL_RendererInfo SDL_VideoRendererInfo;
static SDL_TextureID SDL_VideoTexture;
static SDL_Surface *SDL_VideoSurface;
static SDL_Surface *SDL_ShadowSurface;
static SDL_Surface *SDL_PublicSurface;
static SDL_GLContext *SDL_VideoContext;
static char *wm_title;
static SDL_TextureID SDL_VideoTexture = 0;
static SDL_Surface *SDL_VideoSurface = NULL;
static SDL_Surface *SDL_ShadowSurface = NULL;
static SDL_Surface *SDL_PublicSurface = NULL;
static SDL_GLContext *SDL_VideoContext = NULL;
static char *wm_title = NULL;

char *
SDL_AudioDriverName(char *namebuf, int maxlen)
Expand Down Expand Up @@ -391,7 +390,7 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
SDL_VideoSurface = NULL;
}
if (SDL_VideoContext) {
SDL_GL_MakeCurrent(0, NULL);
/* SDL_GL_MakeCurrent(0, NULL); *//* Doesn't do anything */
SDL_GL_DeleteContext(SDL_VideoContext);
SDL_VideoContext = NULL;
}
Expand Down
1 change: 1 addition & 0 deletions src/video/SDL_RLEaccel.c
Expand Up @@ -1973,6 +1973,7 @@ SDL_UnRLESurface(SDL_Surface * surface, int recode)
}
surface->map->info.flags &=
(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY);
surface->map->info.flags |= SDL_COPY_RLE_DESIRED;

if (surface->map->data) {
SDL_free(surface->map->data);
Expand Down
3 changes: 2 additions & 1 deletion src/video/SDL_blit.c
Expand Up @@ -260,7 +260,8 @@ SDL_CalculateBlit(SDL_Surface * surface)
surface->format->Amask);
Uint32 dst_format =
SDL_MasksToPixelFormatEnum(dst->format->BitsPerPixel,
dst->format->Rmask, dst->format->Gmask,
dst->format->Rmask,
dst->format->Gmask,
dst->format->Bmask,
dst->format->Amask);

Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_renderer_gl.c
Expand Up @@ -947,7 +947,7 @@ GL_DestroyRenderer(SDL_Renderer * renderer)

if (data) {
if (data->context) {
SDL_GL_MakeCurrent(0, NULL);
/* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
SDL_GL_DeleteContext(data->context);
}
SDL_free(data);
Expand Down
5 changes: 5 additions & 0 deletions src/video/SDL_surface.c
Expand Up @@ -542,6 +542,11 @@ SDL_LowerBlit(SDL_Surface * src, SDL_Rect * srcrect,
if (SDL_MapSurface(src, dst) < 0) {
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));
}
Expand Down
15 changes: 9 additions & 6 deletions src/video/SDL_video.c
Expand Up @@ -1329,15 +1329,17 @@ SDL_DestroyWindow(SDL_WindowID windowID)
if (window->id != windowID) {
continue;
}
if (window->title) {
SDL_free(window->title);
window->title = NULL;
}
if (window->renderer) {
SDL_DestroyRenderer(window->id);
window->renderer = NULL;
}
if (_this->DestroyWindow) {
_this->DestroyWindow(_this, window);
}
if (window->title) {
SDL_free(window->title);
}
if (j != display->num_windows - 1) {
SDL_memcpy(&display->windows[i],
&display->windows[i + 1],
Expand Down Expand Up @@ -1439,9 +1441,8 @@ SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags)
SDL_DestroyRenderer(windowID);

/* Create a new renderer instance */
window->renderer =
SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window,
flags);
window->renderer = SDL_CurrentDisplay.render_drivers[index]
.CreateRenderer(window, flags);
SDL_SelectRenderer(window->id);

return 0;
Expand Down Expand Up @@ -2220,9 +2221,11 @@ SDL_VideoQuit(void)
}
if (display->gamma) {
SDL_free(display->gamma);
display->gamma = NULL;
}
if (display->driverdata) {
SDL_free(display->driverdata);
display->driverdata = NULL;
}
}
if (_this->displays) {
Expand Down
9 changes: 4 additions & 5 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -44,8 +44,8 @@ X11_DispatchEvent(_THIS)
handler */
if (XFilterEvent(&xevent, None) == True) {
#if 0
printf("Filtered event type = %d display = %d window = %d\n",
xevent.type, xevent.xany.display, xevent.xany.window);
printf("Filtered event type = %d display = %d window = %d\n",
xevent.type, xevent.xany.display, xevent.xany.window);
#endif
return;
}
Expand Down Expand Up @@ -73,10 +73,9 @@ X11_DispatchEvent(_THIS)
if (!data) {
return;
}

#if 0
printf("type = %d display = %d window = %d\n",
xevent.type, xevent.xany.display, xevent.xany.window);
printf("type = %d display = %d window = %d\n",
xevent.type, xevent.xany.display, xevent.xany.window);
#endif
switch (xevent.type) {

Expand Down
2 changes: 1 addition & 1 deletion test/testgl2.c
Expand Up @@ -24,7 +24,7 @@ static void
quit(int rc)
{
if (context) {
SDL_GL_MakeCurrent(0, NULL);
/* SDL_GL_MakeCurrent(0, NULL); *//* doesn't do anything */
SDL_GL_DeleteContext(context);
}
CommonQuit(state);
Expand Down

0 comments on commit 08be576

Please sign in to comment.