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
This commit is contained in:
Bob Pendleton 2008-03-14 18:17:49 +00:00
parent d8da8f7c27
commit 71656d10c7
9 changed files with 66 additions and 41 deletions

View File

@ -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,
@ -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++ */

View File

@ -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)
@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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));
}

View File

@ -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],
@ -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;
@ -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) {

View File

@ -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;
}
@ -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) {

View File

@ -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);