mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-20 20:04:19 +08:00
Merge pull request #127 from xTibor/sdl-resize-caption
sdl: Implement SDL_RESIZABLE and SDL_WM_SetCaption
This commit is contained in:
commit
ccbd3f4c4d
@ -1,6 +1,6 @@
|
||||
diff -rupN source_original/build-scripts/config.sub source/build-scripts/config.sub
|
||||
--- source_original/build-scripts/config.sub 2012-01-19 07:30:05.000000000 +0100
|
||||
+++ source/build-scripts/config.sub 2018-02-21 09:33:42.970275299 +0100
|
||||
diff -rupN source-original/build-scripts/config.sub source/build-scripts/config.sub
|
||||
--- source-original/build-scripts/config.sub 2012-01-19 07:30:05.000000000 +0100
|
||||
+++ source/build-scripts/config.sub 2018-02-26 11:41:15.584206480 +0100
|
||||
@@ -1276,7 +1276,7 @@ case $os in
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
@ -10,9 +10,9 @@ diff -rupN source_original/build-scripts/config.sub source/build-scripts/config.
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
diff -rupN source_original/configure.in source/configure.in
|
||||
--- source_original/configure.in 2012-01-19 07:30:05.000000000 +0100
|
||||
+++ source/configure.in 2018-02-21 09:33:42.970275299 +0100
|
||||
diff -rupN source-original/configure.in source/configure.in
|
||||
--- source-original/configure.in 2012-01-19 07:30:05.000000000 +0100
|
||||
+++ source/configure.in 2018-02-26 11:41:15.596206742 +0100
|
||||
@@ -1646,6 +1646,19 @@ AC_HELP_STRING([--enable-video-dummy], [
|
||||
fi
|
||||
}
|
||||
@ -54,9 +54,9 @@ diff -rupN source_original/configure.in source/configure.in
|
||||
CheckDiskAudio
|
||||
CheckDummyAudio
|
||||
CheckDLOPEN
|
||||
diff -rupN source_original/include/SDL_config.h.in source/include/SDL_config.h.in
|
||||
--- source_original/include/SDL_config.h.in 2012-01-19 07:30:05.000000000 +0100
|
||||
+++ source/include/SDL_config.h.in 2018-02-21 09:33:43.110276438 +0100
|
||||
diff -rupN source-original/include/SDL_config.h.in source/include/SDL_config.h.in
|
||||
--- source-original/include/SDL_config.h.in 2012-01-19 07:30:05.000000000 +0100
|
||||
+++ source/include/SDL_config.h.in 2018-02-26 11:41:15.596206742 +0100
|
||||
@@ -268,6 +268,7 @@
|
||||
#undef SDL_VIDEO_DRIVER_GGI
|
||||
#undef SDL_VIDEO_DRIVER_IPOD
|
||||
@ -65,10 +65,10 @@ diff -rupN source_original/include/SDL_config.h.in source/include/SDL_config.h.i
|
||||
#undef SDL_VIDEO_DRIVER_OS2FS
|
||||
#undef SDL_VIDEO_DRIVER_PHOTON
|
||||
#undef SDL_VIDEO_DRIVER_PICOGUI
|
||||
diff -rupN source_original/src/video/orbital/SDL_orbitalevents.c source/src/video/orbital/SDL_orbitalevents.c
|
||||
--- source_original/src/video/orbital/SDL_orbitalevents.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalevents.c 2018-02-22 15:03:58.808696217 +0100
|
||||
@@ -0,0 +1,188 @@
|
||||
diff -rupN source-original/src/video/orbital/SDL_orbitalevents.c source/src/video/orbital/SDL_orbitalevents.c
|
||||
--- source-original/src/video/orbital/SDL_orbitalevents.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalevents.c 2018-02-26 11:45:59.446509075 +0100
|
||||
@@ -0,0 +1,190 @@
|
||||
+/*
|
||||
+ SDL - Simple DirectMedia Layer
|
||||
+ Copyright (C) 1997-2012 Sam Lantinga
|
||||
@ -163,6 +163,8 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalevents.c source/src/vide
|
||||
+ SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0);
|
||||
+ SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
|
||||
+ }
|
||||
+ } else if ( event.code == EVENT_RESIZE ) {
|
||||
+ SDL_PrivateResize(event.a, event.b);
|
||||
+ } else if ( event.code == EVENT_QUIT ) {
|
||||
+ SDL_PrivateQuit();
|
||||
+ }
|
||||
@ -257,9 +259,9 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalevents.c source/src/vide
|
||||
+}
|
||||
+
|
||||
+/* end of SDL_orbitalevents.c ... */
|
||||
diff -rupN source_original/src/video/orbital/SDL_orbitalevents_c.h source/src/video/orbital/SDL_orbitalevents_c.h
|
||||
--- source_original/src/video/orbital/SDL_orbitalevents_c.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalevents_c.h 2018-02-21 09:33:43.238277480 +0100
|
||||
diff -rupN source-original/src/video/orbital/SDL_orbitalevents_c.h source/src/video/orbital/SDL_orbitalevents_c.h
|
||||
--- source-original/src/video/orbital/SDL_orbitalevents_c.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalevents_c.h 2018-02-26 11:41:15.600206830 +0100
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ SDL - Simple DirectMedia Layer
|
||||
@ -293,9 +295,9 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalevents_c.h source/src/vi
|
||||
+extern void ORBITAL_PumpEvents(_THIS);
|
||||
+
|
||||
+/* end of SDL_orbitalevents_c.h ... */
|
||||
diff -rupN source_original/src/video/orbital/SDL_orbitalmouse.c source/src/video/orbital/SDL_orbitalmouse.c
|
||||
--- source_original/src/video/orbital/SDL_orbitalmouse.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalmouse.c 2018-02-21 09:33:43.238277480 +0100
|
||||
diff -rupN source-original/src/video/orbital/SDL_orbitalmouse.c source/src/video/orbital/SDL_orbitalmouse.c
|
||||
--- source-original/src/video/orbital/SDL_orbitalmouse.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalmouse.c 2018-02-26 11:41:15.600206830 +0100
|
||||
@@ -0,0 +1,33 @@
|
||||
+/*
|
||||
+ SDL - Simple DirectMedia Layer
|
||||
@ -330,9 +332,9 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalmouse.c source/src/video
|
||||
+struct WMcursor {
|
||||
+ int unused;
|
||||
+};
|
||||
diff -rupN source_original/src/video/orbital/SDL_orbitalmouse_c.h source/src/video/orbital/SDL_orbitalmouse_c.h
|
||||
--- source_original/src/video/orbital/SDL_orbitalmouse_c.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalmouse_c.h 2018-02-21 09:33:43.238277480 +0100
|
||||
diff -rupN source-original/src/video/orbital/SDL_orbitalmouse_c.h source/src/video/orbital/SDL_orbitalmouse_c.h
|
||||
--- source-original/src/video/orbital/SDL_orbitalmouse_c.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalmouse_c.h 2018-02-26 11:41:15.600206830 +0100
|
||||
@@ -0,0 +1,26 @@
|
||||
+/*
|
||||
+ SDL - Simple DirectMedia Layer
|
||||
@ -360,9 +362,9 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalmouse_c.h source/src/vid
|
||||
+#include "SDL_orbitalvideo.h"
|
||||
+
|
||||
+/* Functions to be exported */
|
||||
diff -rupN source_original/src/video/orbital/SDL_orbitalscancode.h source/src/video/orbital/SDL_orbitalscancode.h
|
||||
--- source_original/src/video/orbital/SDL_orbitalscancode.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalscancode.h 2018-02-21 09:33:43.238277480 +0100
|
||||
diff -rupN source-original/src/video/orbital/SDL_orbitalscancode.h source/src/video/orbital/SDL_orbitalscancode.h
|
||||
--- source-original/src/video/orbital/SDL_orbitalscancode.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalscancode.h 2018-02-26 11:41:15.600206830 +0100
|
||||
@@ -0,0 +1,80 @@
|
||||
+#define SCANCODE_A 0x1E
|
||||
+#define SCANCODE_B 0x30
|
||||
@ -444,10 +446,10 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalscancode.h source/src/vi
|
||||
+#define SCANCODE_COMMA 0x33
|
||||
+#define SCANCODE_PERIOD 0x34
|
||||
+#define SCANCODE_SLASH 0x35
|
||||
diff -rupN source_original/src/video/orbital/SDL_orbitalvideo.c source/src/video/orbital/SDL_orbitalvideo.c
|
||||
--- source_original/src/video/orbital/SDL_orbitalvideo.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalvideo.c 2018-02-21 09:33:43.266277708 +0100
|
||||
@@ -0,0 +1,266 @@
|
||||
diff -rupN source-original/src/video/orbital/SDL_orbitalvideo.c source/src/video/orbital/SDL_orbitalvideo.c
|
||||
--- source-original/src/video/orbital/SDL_orbitalvideo.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalvideo.c 2018-02-26 11:50:02.769667936 +0100
|
||||
@@ -0,0 +1,287 @@
|
||||
+/*
|
||||
+ SDL - Simple DirectMedia Layer
|
||||
+ Copyright (C) 1997-2012 Sam Lantinga
|
||||
@ -503,6 +505,7 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalvideo.c source/src/video
|
||||
+static SDL_Surface *ORBITAL_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
|
||||
+static int ORBITAL_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
|
||||
+static void ORBITAL_VideoQuit(_THIS);
|
||||
+static void ORBITAL_SetCaption(_THIS, const char *title, const char *icon);
|
||||
+
|
||||
+/* Hardware surface functions */
|
||||
+static int ORBITAL_AllocHWSurface(_THIS, SDL_Surface *surface);
|
||||
@ -563,7 +566,7 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalvideo.c source/src/video
|
||||
+ device->UnlockHWSurface = ORBITAL_UnlockHWSurface;
|
||||
+ device->FlipHWSurface = NULL;
|
||||
+ device->FreeHWSurface = ORBITAL_FreeHWSurface;
|
||||
+ device->SetCaption = NULL;
|
||||
+ device->SetCaption = ORBITAL_SetCaption;
|
||||
+ device->SetIcon = NULL;
|
||||
+ device->IconifyWindow = NULL;
|
||||
+ device->GrabInput = NULL;
|
||||
@ -608,50 +611,58 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalvideo.c source/src/video
|
||||
+ return(NULL);
|
||||
+ }
|
||||
+
|
||||
+ if ( this->hidden->fd ) {
|
||||
+ close( this->hidden->fd );
|
||||
+ this->hidden->fd = 0;
|
||||
+ }
|
||||
+
|
||||
+ if ( this->hidden->buffer ) {
|
||||
+ redox_funmap( this->hidden->buffer );
|
||||
+ this->hidden->buffer = NULL;
|
||||
+ }
|
||||
+
|
||||
+ char path[4096];
|
||||
+ snprintf(path, 4096, "orbital:a/-1/-1/%d/%d/SDL", width, height);
|
||||
+ this->hidden->fd = open(path, O_RDWR);
|
||||
+ if ( this->hidden->fd <= 0 ) {
|
||||
+ this->hidden->fd = 0;
|
||||
+ SDL_SetError("Couldn't create window for requested mode");
|
||||
+ return(NULL);
|
||||
+ if ( this->hidden->fd > 0 ) {
|
||||
+ /* If the window already exists send a resize message to the display server */
|
||||
+ char msg[4096];
|
||||
+ int msg_len = snprintf(msg, 4096, "S,%d,%d", width, height);
|
||||
+ int res = write(this->hidden->fd, msg, msg_len);
|
||||
+ if ( res != msg_len ) {
|
||||
+ close(this->hidden->fd);
|
||||
+ this->hidden->fd = 0;
|
||||
+ SDL_SetError("Couldn't write resize event");
|
||||
+ return(NULL);
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* Otherwise create a new window */
|
||||
+ char path[4096];
|
||||
+ snprintf(path, 4096, "orbital:a%s/-1/-1/%d/%d/SDL", (flags & SDL_RESIZABLE) ? "r" : "", width, height);
|
||||
+ this->hidden->fd = open(path, O_RDWR);
|
||||
+ if ( this->hidden->fd <= 0 ) {
|
||||
+ this->hidden->fd = 0;
|
||||
+ SDL_SetError("Couldn't create window for requested mode");
|
||||
+ return(NULL);
|
||||
+ }
|
||||
+ printf("%s at %d\n", path, this->hidden->fd);
|
||||
+ }
|
||||
+ printf("%s at %d\n", path, this->hidden->fd);
|
||||
+
|
||||
+ this->hidden->buffer = redox_fmap(this->hidden->fd, 0, width * height * (bpp / 8));
|
||||
+ if ( ! this->hidden->buffer ) {
|
||||
+ close(this->hidden->fd);
|
||||
+ this->hidden->fd = 0;
|
||||
+ this->hidden->fd = 0;
|
||||
+ SDL_SetError("Couldn't map window for requested mode");
|
||||
+ return(NULL);
|
||||
+ }
|
||||
+
|
||||
+ printf("Setting mode %dx%d@%d\n", width, height, bpp);
|
||||
+
|
||||
+ SDL_memset(this->hidden->buffer, 0, width * height * (bpp / 8));
|
||||
+ fprintf(stderr, "Setting mode %dx%d@%d\n", width, height, bpp);
|
||||
+
|
||||
+ /* Allocate the new pixel format for the screen */
|
||||
+
|
||||
+ if ( ! SDL_ReallocFormat(current, bpp, 0, 0, 0, 0) ) {
|
||||
+ redox_funmap(this->hidden->buffer);
|
||||
+ this->hidden->buffer = NULL;
|
||||
+ close(this->hidden->fd);
|
||||
+ this->hidden->fd = 0;
|
||||
+ this->hidden->fd = 0;
|
||||
+ SDL_SetError("Couldn't allocate new pixel format for requested mode");
|
||||
+ return(NULL);
|
||||
+ }
|
||||
+
|
||||
+ /* Set up the new mode framebuffer */
|
||||
+ current->flags = flags & SDL_FULLSCREEN;
|
||||
+ current->flags = flags /*& SDL_FULLSCREEN*/;
|
||||
+ this->hidden->w = current->w = width;
|
||||
+ this->hidden->h = current->h = height;
|
||||
+ current->pitch = current->w * (bpp / 8);
|
||||
@ -661,6 +672,18 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalvideo.c source/src/video
|
||||
+ return(current);
|
||||
+}
|
||||
+
|
||||
+static void ORBITAL_SetCaption(_THIS, const char *title, const char *icon)
|
||||
+{
|
||||
+ if ( this->hidden->fd > 0 ) {
|
||||
+ char msg[4096];
|
||||
+ int msg_len = snprintf(msg, 4096, "T,%s", title);
|
||||
+ int res = write(this->hidden->fd, msg, msg_len);
|
||||
+ if ( res != msg_len ) {
|
||||
+ SDL_SetError("Couldn't set window caption (write error)");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* We don't actually allow hardware surfaces other than the main one */
|
||||
+static int ORBITAL_AllocHWSurface(_THIS, SDL_Surface *surface)
|
||||
+{
|
||||
@ -714,9 +737,9 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalvideo.c source/src/video
|
||||
+ this->screen->pixels = NULL;
|
||||
+ }
|
||||
+}
|
||||
diff -rupN source_original/src/video/orbital/SDL_orbitalvideo.h source/src/video/orbital/SDL_orbitalvideo.h
|
||||
--- source_original/src/video/orbital/SDL_orbitalvideo.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalvideo.h 2018-02-21 09:33:43.266277708 +0100
|
||||
diff -rupN source-original/src/video/orbital/SDL_orbitalvideo.h source/src/video/orbital/SDL_orbitalvideo.h
|
||||
--- source-original/src/video/orbital/SDL_orbitalvideo.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ source/src/video/orbital/SDL_orbitalvideo.h 2018-02-26 11:41:15.600206830 +0100
|
||||
@@ -0,0 +1,41 @@
|
||||
+/*
|
||||
+ SDL - Simple DirectMedia Layer
|
||||
@ -759,9 +782,9 @@ diff -rupN source_original/src/video/orbital/SDL_orbitalvideo.h source/src/video
|
||||
+};
|
||||
+
|
||||
+#endif /* _SDL_orbitalvideo_h */
|
||||
diff -rupN source_original/src/video/SDL_gamma.c source/src/video/SDL_gamma.c
|
||||
--- source_original/src/video/SDL_gamma.c 2012-01-19 07:30:06.000000000 +0100
|
||||
+++ source/src/video/SDL_gamma.c 2018-02-20 20:51:31.151824659 +0100
|
||||
diff -rupN source-original/src/video/SDL_gamma.c source/src/video/SDL_gamma.c
|
||||
--- source-original/src/video/SDL_gamma.c 2012-01-19 07:30:06.000000000 +0100
|
||||
+++ source/src/video/SDL_gamma.c 2018-02-26 11:41:15.600206830 +0100
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
/* Gamma correction support */
|
||||
@ -829,9 +852,9 @@ diff -rupN source_original/src/video/SDL_gamma.c source/src/video/SDL_gamma.c
|
||||
|
||||
/* Lazily allocate the gamma table */
|
||||
if ( ! video->gamma ) {
|
||||
diff -rupN source_original/src/video/SDL_sysvideo.h source/src/video/SDL_sysvideo.h
|
||||
--- source_original/src/video/SDL_sysvideo.h 2012-01-19 07:30:06.000000000 +0100
|
||||
+++ source/src/video/SDL_sysvideo.h 2018-02-21 09:33:43.266277708 +0100
|
||||
diff -rupN source-original/src/video/SDL_sysvideo.h source/src/video/SDL_sysvideo.h
|
||||
--- source-original/src/video/SDL_sysvideo.h 2012-01-19 07:30:06.000000000 +0100
|
||||
+++ source/src/video/SDL_sysvideo.h 2018-02-26 11:41:15.604206916 +0100
|
||||
@@ -410,6 +410,9 @@ extern VideoBootStrap AALIB_bootstrap;
|
||||
#if SDL_VIDEO_DRIVER_CACA
|
||||
extern VideoBootStrap CACA_bootstrap;
|
||||
@ -842,9 +865,9 @@ diff -rupN source_original/src/video/SDL_sysvideo.h source/src/video/SDL_sysvide
|
||||
#if SDL_VIDEO_DRIVER_DUMMY
|
||||
extern VideoBootStrap DUMMY_bootstrap;
|
||||
#endif
|
||||
diff -rupN source_original/src/video/SDL_video.c source/src/video/SDL_video.c
|
||||
--- source_original/src/video/SDL_video.c 2012-01-19 07:30:06.000000000 +0100
|
||||
+++ source/src/video/SDL_video.c 2018-02-21 09:33:43.350278392 +0100
|
||||
diff -rupN source-original/src/video/SDL_video.c source/src/video/SDL_video.c
|
||||
--- source-original/src/video/SDL_video.c 2012-01-19 07:30:06.000000000 +0100
|
||||
+++ source/src/video/SDL_video.c 2018-02-26 11:44:58.717146828 +0100
|
||||
@@ -126,6 +126,9 @@ static VideoBootStrap *bootstrap[] = {
|
||||
#if SDL_VIDEO_DRIVER_CACA
|
||||
&CACA_bootstrap,
|
||||
@ -855,3 +878,190 @@ diff -rupN source_original/src/video/SDL_video.c source/src/video/SDL_video.c
|
||||
#if SDL_VIDEO_DRIVER_DUMMY
|
||||
&DUMMY_bootstrap,
|
||||
#endif
|
||||
@@ -217,7 +220,7 @@ int SDL_VideoInit (const char *driver_na
|
||||
video->offset_x = 0;
|
||||
video->offset_y = 0;
|
||||
SDL_memset(&video->info, 0, (sizeof video->info));
|
||||
-
|
||||
+
|
||||
video->displayformatalphapixel = NULL;
|
||||
|
||||
/* Set some very sane GL defaults */
|
||||
@@ -240,7 +243,7 @@ int SDL_VideoInit (const char *driver_na
|
||||
video->gl_config.multisamplesamples = 0;
|
||||
video->gl_config.accelerated = -1; /* not known, don't set */
|
||||
video->gl_config.swap_control = -1; /* not known, don't set */
|
||||
-
|
||||
+
|
||||
/* Initialize the video subsystem */
|
||||
SDL_memset(&vformat, 0, sizeof(vformat));
|
||||
if ( video->VideoInit(video, &vformat) < 0 ) {
|
||||
@@ -397,7 +400,7 @@ int SDL_VideoModeOK (int width, int heig
|
||||
if ( sizes == (SDL_Rect **)0 ) {
|
||||
/* No sizes supported at this bit-depth */
|
||||
continue;
|
||||
- } else
|
||||
+ } else
|
||||
if (sizes == (SDL_Rect **)NEGATIVE_ONE) {
|
||||
/* Any size supported at this bit-depth */
|
||||
supported = 1;
|
||||
@@ -726,7 +729,8 @@ SDL_Surface * SDL_SetVideoMode (int widt
|
||||
video->offset_y = 0;
|
||||
mode->offset = 0;
|
||||
SDL_SetClipRect(mode, NULL);
|
||||
- SDL_ClearSurface(mode);
|
||||
+ // Causes blinking under Orbital
|
||||
+ //SDL_ClearSurface(mode);
|
||||
|
||||
/* Now adjust the offsets to match the desired mode */
|
||||
video->offset_x = (mode->w-width)/2;
|
||||
@@ -788,7 +792,7 @@ SDL_Surface * SDL_SetVideoMode (int widt
|
||||
#endif /* __SDL_NOGETPROCADDR__ */
|
||||
|
||||
#include "SDL_glfuncs.h"
|
||||
-#undef SDL_PROC
|
||||
+#undef SDL_PROC
|
||||
}
|
||||
#endif /* SDL_VIDEO_OPENGL */
|
||||
|
||||
@@ -817,9 +821,9 @@ SDL_Surface * SDL_SetVideoMode (int widt
|
||||
) {
|
||||
video->is_32bit = 0;
|
||||
SDL_VideoSurface = SDL_CreateRGBSurface(
|
||||
- flags,
|
||||
- width,
|
||||
- height,
|
||||
+ flags,
|
||||
+ width,
|
||||
+ height,
|
||||
16,
|
||||
31 << 11,
|
||||
63 << 5,
|
||||
@@ -832,10 +836,10 @@ SDL_Surface * SDL_SetVideoMode (int widt
|
||||
{
|
||||
video->is_32bit = 1;
|
||||
SDL_VideoSurface = SDL_CreateRGBSurface(
|
||||
- flags,
|
||||
- width,
|
||||
- height,
|
||||
- 32,
|
||||
+ flags,
|
||||
+ width,
|
||||
+ height,
|
||||
+ 32,
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
0x000000FF,
|
||||
0x0000FF00,
|
||||
@@ -893,7 +897,7 @@ SDL_Surface * SDL_SetVideoMode (int widt
|
||||
(
|
||||
( !(flags&SDL_ANYFORMAT) &&
|
||||
(SDL_VideoSurface->format->BitsPerPixel != bpp)) ||
|
||||
- ( (flags&SDL_HWPALETTE) &&
|
||||
+ ( (flags&SDL_HWPALETTE) &&
|
||||
!(SDL_VideoSurface->flags&SDL_HWPALETTE)) ||
|
||||
/* If the surface is in hardware, video writes are visible
|
||||
as soon as they are performed, so we need to buffer them
|
||||
@@ -921,7 +925,7 @@ SDL_Surface * SDL_SetVideoMode (int widt
|
||||
return(SDL_PublicSurface);
|
||||
}
|
||||
|
||||
-/*
|
||||
+/*
|
||||
* Convert a surface into the video pixel format.
|
||||
*/
|
||||
SDL_Surface * SDL_DisplayFormat (SDL_Surface *surface)
|
||||
@@ -935,7 +939,7 @@ SDL_Surface * SDL_DisplayFormat (SDL_Sur
|
||||
/* Set the flags appropriate for copying to display surface */
|
||||
if (((SDL_PublicSurface->flags&SDL_HWSURFACE) == SDL_HWSURFACE) && current_video->info.blit_hw)
|
||||
flags = SDL_HWSURFACE;
|
||||
- else
|
||||
+ else
|
||||
flags = SDL_SWSURFACE;
|
||||
#ifdef AUTORLE_DISPLAYFORMAT
|
||||
flags |= (surface->flags & (SDL_SRCCOLORKEY|SDL_SRCALPHA));
|
||||
@@ -1063,14 +1067,14 @@ void SDL_UpdateRects (SDL_Surface *scree
|
||||
SDL_LockCursor();
|
||||
SDL_DrawCursor(SDL_ShadowSurface);
|
||||
for ( i=0; i<numrects; ++i ) {
|
||||
- SDL_LowerBlit(SDL_ShadowSurface, &rects[i],
|
||||
+ SDL_LowerBlit(SDL_ShadowSurface, &rects[i],
|
||||
SDL_VideoSurface, &rects[i]);
|
||||
}
|
||||
SDL_EraseCursor(SDL_ShadowSurface);
|
||||
SDL_UnlockCursor();
|
||||
} else {
|
||||
for ( i=0; i<numrects; ++i ) {
|
||||
- SDL_LowerBlit(SDL_ShadowSurface, &rects[i],
|
||||
+ SDL_LowerBlit(SDL_ShadowSurface, &rects[i],
|
||||
SDL_VideoSurface, &rects[i]);
|
||||
}
|
||||
}
|
||||
@@ -1576,42 +1580,42 @@ void SDL_GL_UpdateRects(int numrects, SD
|
||||
|
||||
if ( update.h > 256 )
|
||||
update.h = 256;
|
||||
-
|
||||
+
|
||||
this->glFlush();
|
||||
- this->glTexSubImage2D(
|
||||
- GL_TEXTURE_2D,
|
||||
- 0,
|
||||
- 0,
|
||||
- 0,
|
||||
- update.w,
|
||||
- update.h,
|
||||
+ this->glTexSubImage2D(
|
||||
+ GL_TEXTURE_2D,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ 0,
|
||||
+ update.w,
|
||||
+ update.h,
|
||||
this->is_32bit? GL_RGBA : GL_RGB,
|
||||
#ifdef GL_VERSION_1_2
|
||||
this->is_32bit ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT_5_6_5,
|
||||
#else
|
||||
GL_UNSIGNED_BYTE,
|
||||
#endif
|
||||
- (Uint8 *)this->screen->pixels +
|
||||
- this->screen->format->BytesPerPixel * update.x +
|
||||
+ (Uint8 *)this->screen->pixels +
|
||||
+ this->screen->format->BytesPerPixel * update.x +
|
||||
update.y * this->screen->pitch );
|
||||
-
|
||||
+
|
||||
this->glFlush();
|
||||
/*
|
||||
* Note the parens around the function name:
|
||||
- * This is because some OpenGL implementations define glTexCoord etc
|
||||
+ * This is because some OpenGL implementations define glTexCoord etc
|
||||
* as macros, and we don't want them expanded here.
|
||||
*/
|
||||
this->glBegin(GL_TRIANGLE_STRIP);
|
||||
- (this->glTexCoord2f)( 0.0, 0.0 );
|
||||
+ (this->glTexCoord2f)( 0.0, 0.0 );
|
||||
(this->glVertex2i)( update.x, update.y );
|
||||
- (this->glTexCoord2f)( (float)(update.w / 256.0), 0.0 );
|
||||
+ (this->glTexCoord2f)( (float)(update.w / 256.0), 0.0 );
|
||||
(this->glVertex2i)( update.x + update.w, update.y );
|
||||
(this->glTexCoord2f)( 0.0, (float)(update.h / 256.0) );
|
||||
(this->glVertex2i)( update.x, update.y + update.h );
|
||||
- (this->glTexCoord2f)( (float)(update.w / 256.0), (float)(update.h / 256.0) );
|
||||
+ (this->glTexCoord2f)( (float)(update.w / 256.0), (float)(update.h / 256.0) );
|
||||
(this->glVertex2i)( update.x + update.w , update.y + update.h );
|
||||
- this->glEnd();
|
||||
-
|
||||
+ this->glEnd();
|
||||
+
|
||||
tmp.x += 256;
|
||||
tmp.w -= 256;
|
||||
}
|
||||
@@ -1641,7 +1645,7 @@ void SDL_GL_Lock()
|
||||
this->glDisable(GL_FOG);
|
||||
this->glDisable(GL_ALPHA_TEST);
|
||||
this->glDisable(GL_DEPTH_TEST);
|
||||
- this->glDisable(GL_SCISSOR_TEST);
|
||||
+ this->glDisable(GL_SCISSOR_TEST);
|
||||
this->glDisable(GL_STENCIL_TEST);
|
||||
this->glDisable(GL_CULL_FACE);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user