Ran GNU indent on file
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403197
This commit is contained in:
parent
fcc9f44538
commit
a2abb3b66b
1 changed files with 1881 additions and 1963 deletions
|
@ -184,12 +184,10 @@ SDL_VideoInit(const char *driver_name, Uint32 flags)
|
||||||
if (SDL_StartEventLoop(flags) < 0) {
|
if (SDL_StartEventLoop(flags) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check to make sure we don't overwrite '_this' */
|
/* Check to make sure we don't overwrite '_this' */
|
||||||
if (_this != NULL) {
|
if (_this != NULL) {
|
||||||
SDL_VideoQuit();
|
SDL_VideoQuit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Select the proper video driver */
|
/* Select the proper video driver */
|
||||||
index = 0;
|
index = 0;
|
||||||
video = NULL;
|
video = NULL;
|
||||||
|
@ -253,14 +251,12 @@ SDL_VideoInit(const char *driver_name, Uint32 flags)
|
||||||
SDL_VideoQuit();
|
SDL_VideoQuit();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure some displays were added */
|
/* Make sure some displays were added */
|
||||||
if (_this->num_displays == 0) {
|
if (_this->num_displays == 0) {
|
||||||
SDL_SetError("The video driver did not add any displays");
|
SDL_SetError("The video driver did not add any displays");
|
||||||
SDL_VideoQuit();
|
SDL_VideoQuit();
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The software renderer is always available */
|
/* The software renderer is always available */
|
||||||
for (i = 0; i < _this->num_displays; ++i) {
|
for (i = 0; i < _this->num_displays; ++i) {
|
||||||
#if SDL_VIDEO_RENDER_OGL
|
#if SDL_VIDEO_RENDER_OGL
|
||||||
|
@ -461,7 +457,6 @@ SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode,
|
||||||
if (!_this || !mode || !closest) {
|
if (!_this || !mode || !closest) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Default to the desktop format */
|
/* Default to the desktop format */
|
||||||
if (mode->format) {
|
if (mode->format) {
|
||||||
target_format = mode->format;
|
target_format = mode->format;
|
||||||
|
@ -527,7 +522,10 @@ SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode,
|
||||||
}
|
}
|
||||||
closest->driverdata = match->driverdata;
|
closest->driverdata = match->driverdata;
|
||||||
|
|
||||||
/* Pick some reasonable defaults if the app and driver don't care */
|
/*
|
||||||
|
* Pick some reasonable defaults if the app and driver don't
|
||||||
|
* care
|
||||||
|
*/
|
||||||
if (!closest->format) {
|
if (!closest->format) {
|
||||||
closest->format = SDL_PIXELFORMAT_RGB888;
|
closest->format = SDL_PIXELFORMAT_RGB888;
|
||||||
}
|
}
|
||||||
|
@ -554,7 +552,6 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
display = &SDL_CurrentDisplay;
|
display = &SDL_CurrentDisplay;
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
mode = &display->desktop_mode;
|
mode = &display->desktop_mode;
|
||||||
|
@ -574,20 +571,17 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode)
|
||||||
if (!display_mode.refresh_rate) {
|
if (!display_mode.refresh_rate) {
|
||||||
display_mode.refresh_rate = display->current_mode.refresh_rate;
|
display_mode.refresh_rate = display->current_mode.refresh_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a good video mode, the closest one possible */
|
/* Get a good video mode, the closest one possible */
|
||||||
if (!SDL_GetClosestDisplayMode(&display_mode, &display_mode)) {
|
if (!SDL_GetClosestDisplayMode(&display_mode, &display_mode)) {
|
||||||
SDL_SetError("No video mode large enough for %dx%d",
|
SDL_SetError("No video mode large enough for %dx%d",
|
||||||
display_mode.w, display_mode.h);
|
display_mode.w, display_mode.h);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if there's anything left to do */
|
/* See if there's anything left to do */
|
||||||
SDL_GetCurrentDisplayMode(¤t_mode);
|
SDL_GetCurrentDisplayMode(¤t_mode);
|
||||||
if (SDL_memcmp(&display_mode, ¤t_mode, sizeof(display_mode)) == 0) {
|
if (SDL_memcmp(&display_mode, ¤t_mode, sizeof(display_mode)) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actually change the display mode */
|
/* Actually change the display mode */
|
||||||
if (_this->SetDisplayMode(_this, &display_mode) < 0) {
|
if (_this->SetDisplayMode(_this, &display_mode) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -615,7 +609,6 @@ SDL_SetDisplayMode(const SDL_DisplayMode * mode)
|
||||||
SDL_BITSPERPIXEL(display_mode.format));
|
SDL_BITSPERPIXEL(display_mode.format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move any fullscreen windows into position */
|
/* Move any fullscreen windows into position */
|
||||||
for (i = 0; i < display->num_windows; ++i) {
|
for (i = 0; i < display->num_windows; ++i) {
|
||||||
SDL_Window *window = &display->windows[i];
|
SDL_Window *window = &display->windows[i];
|
||||||
|
@ -639,12 +632,10 @@ SDL_SetFullscreenDisplayMode(const SDL_DisplayMode * mode)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
display = &SDL_CurrentDisplay;
|
display = &SDL_CurrentDisplay;
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
mode = &display->desktop_mode;
|
mode = &display->desktop_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GetClosestDisplayMode(mode, &fullscreen_mode);
|
SDL_GetClosestDisplayMode(mode, &fullscreen_mode);
|
||||||
if (SDL_memcmp
|
if (SDL_memcmp
|
||||||
(&fullscreen_mode, &display->fullscreen_mode,
|
(&fullscreen_mode, &display->fullscreen_mode,
|
||||||
|
@ -697,7 +688,6 @@ SDL_SetDisplayPalette(const SDL_Color * colors, int firstcolor, int ncolors)
|
||||||
SDL_SetError("Display mode does not have a palette");
|
SDL_SetError("Display mode does not have a palette");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
|
status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
|
||||||
|
|
||||||
if (_this->SetDisplayPalette) {
|
if (_this->SetDisplayPalette) {
|
||||||
|
@ -717,18 +707,15 @@ SDL_GetDisplayPalette(SDL_Color * colors, int firstcolor, int ncolors)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
palette = SDL_CurrentDisplay.palette;
|
palette = SDL_CurrentDisplay.palette;
|
||||||
if (!palette->ncolors) {
|
if (!palette->ncolors) {
|
||||||
SDL_SetError("Display mode does not have a palette");
|
SDL_SetError("Display mode does not have a palette");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstcolor < 0 || (firstcolor + ncolors) > palette->ncolors) {
|
if (firstcolor < 0 || (firstcolor + ncolors) > palette->ncolors) {
|
||||||
SDL_SetError("Palette indices are out of range");
|
SDL_SetError("Palette indices are out of range");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_memcpy(colors, &palette->colors[firstcolor],
|
SDL_memcpy(colors, &palette->colors[firstcolor],
|
||||||
ncolors * sizeof(*colors));
|
ncolors * sizeof(*colors));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -750,18 +737,15 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
|
if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
|
||||||
SDL_SetError("No OpenGL support in video driver");
|
SDL_SetError("No OpenGL support in video driver");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fullscreen windows don't have any window decorations */
|
/* Fullscreen windows don't have any window decorations */
|
||||||
if (flags & SDL_WINDOW_FULLSCREEN) {
|
if (flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
flags |= SDL_WINDOW_BORDERLESS;
|
flags |= SDL_WINDOW_BORDERLESS;
|
||||||
flags &= ~SDL_WINDOW_RESIZABLE;
|
flags &= ~SDL_WINDOW_RESIZABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_zero(window);
|
SDL_zero(window);
|
||||||
window.id = _this->next_object_id++;
|
window.id = _this->next_object_id++;
|
||||||
window.x = x;
|
window.x = x;
|
||||||
|
@ -774,7 +758,6 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
||||||
if (_this->CreateWindow && _this->CreateWindow(_this, &window) < 0) {
|
if (_this->CreateWindow && _this->CreateWindow(_this, &window) < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
display = &SDL_CurrentDisplay;
|
display = &SDL_CurrentDisplay;
|
||||||
num_windows = display->num_windows;
|
num_windows = display->num_windows;
|
||||||
windows =
|
windows =
|
||||||
|
@ -819,7 +802,6 @@ SDL_CreateWindowFrom(const void *data)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_zero(window);
|
SDL_zero(window);
|
||||||
window.id = _this->next_object_id++;
|
window.id = _this->next_object_id++;
|
||||||
window.display = _this->current_display;
|
window.display = _this->current_display;
|
||||||
|
@ -828,7 +810,6 @@ SDL_CreateWindowFrom(const void *data)
|
||||||
_this->CreateWindowFrom(_this, &window, data) < 0) {
|
_this->CreateWindowFrom(_this, &window, data) < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
display = &SDL_CurrentDisplay;
|
display = &SDL_CurrentDisplay;
|
||||||
num_windows = display->num_windows;
|
num_windows = display->num_windows;
|
||||||
windows =
|
windows =
|
||||||
|
@ -858,11 +839,9 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
||||||
SDL_SetError("No OpenGL support in video driver");
|
SDL_SetError("No OpenGL support in video driver");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->DestroyWindow) {
|
if (_this->DestroyWindow) {
|
||||||
_this->DestroyWindow(_this, window);
|
_this->DestroyWindow(_this, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->title = NULL;
|
window->title = NULL;
|
||||||
window->flags =
|
window->flags =
|
||||||
(flags &
|
(flags &
|
||||||
|
@ -872,7 +851,6 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
||||||
if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
|
if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title) {
|
if (title) {
|
||||||
SDL_SetWindowTitle(window->id, title);
|
SDL_SetWindowTitle(window->id, title);
|
||||||
SDL_free(title);
|
SDL_free(title);
|
||||||
|
@ -901,7 +879,6 @@ SDL_GetWindowFromID(SDL_WindowID windowID)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < _this->num_displays; ++i) {
|
for (i = 0; i < _this->num_displays; ++i) {
|
||||||
SDL_VideoDisplay *display = &_this->displays[i];
|
SDL_VideoDisplay *display = &_this->displays[i];
|
||||||
for (j = 0; j < display->num_windows; ++j) {
|
for (j = 0; j < display->num_windows; ++j) {
|
||||||
|
@ -946,7 +923,6 @@ SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
|
||||||
if (!window || title == window->title) {
|
if (!window || title == window->title) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->title) {
|
if (window->title) {
|
||||||
SDL_free(window->title);
|
SDL_free(window->title);
|
||||||
}
|
}
|
||||||
|
@ -1003,7 +979,6 @@ SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x == SDL_WINDOWPOS_CENTERED) {
|
if (x == SDL_WINDOWPOS_CENTERED) {
|
||||||
window->x = (display->current_mode.w - window->w) / 2;
|
window->x = (display->current_mode.w - window->w) / 2;
|
||||||
} else if (x != SDL_WINDOWPOS_UNDEFINED) {
|
} else if (x != SDL_WINDOWPOS_UNDEFINED) {
|
||||||
|
@ -1014,7 +989,6 @@ SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
|
||||||
} else if (y != SDL_WINDOWPOS_UNDEFINED) {
|
} else if (y != SDL_WINDOWPOS_UNDEFINED) {
|
||||||
window->y = y;
|
window->y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->SetWindowPosition) {
|
if (_this->SetWindowPosition) {
|
||||||
_this->SetWindowPosition(_this, window);
|
_this->SetWindowPosition(_this, window);
|
||||||
}
|
}
|
||||||
|
@ -1044,7 +1018,6 @@ SDL_SetWindowSize(SDL_WindowID windowID, int w, int h)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window->w = w;
|
window->w = w;
|
||||||
window->h = h;
|
window->h = h;
|
||||||
|
|
||||||
|
@ -1077,7 +1050,6 @@ SDL_ShowWindow(SDL_WindowID windowID)
|
||||||
if (!window || (window->flags & SDL_WINDOW_SHOWN)) {
|
if (!window || (window->flags & SDL_WINDOW_SHOWN)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_SHOWN, 0, 0);
|
||||||
|
|
||||||
if (_this->ShowWindow) {
|
if (_this->ShowWindow) {
|
||||||
|
@ -1093,7 +1065,6 @@ SDL_HideWindow(SDL_WindowID windowID)
|
||||||
if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
|
if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_HIDDEN, 0, 0);
|
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_HIDDEN, 0, 0);
|
||||||
|
|
||||||
if (_this->HideWindow) {
|
if (_this->HideWindow) {
|
||||||
|
@ -1109,7 +1080,6 @@ SDL_RaiseWindow(SDL_WindowID windowID)
|
||||||
if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
|
if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->RaiseWindow) {
|
if (_this->RaiseWindow) {
|
||||||
_this->RaiseWindow(_this, window);
|
_this->RaiseWindow(_this, window);
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1093,6 @@ SDL_MaximizeWindow(SDL_WindowID windowID)
|
||||||
if (!window || (window->flags & SDL_WINDOW_MAXIMIZED)) {
|
if (!window || (window->flags & SDL_WINDOW_MAXIMIZED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
|
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
|
||||||
|
|
||||||
if (_this->MaximizeWindow) {
|
if (_this->MaximizeWindow) {
|
||||||
|
@ -1139,7 +1108,6 @@ SDL_MinimizeWindow(SDL_WindowID windowID)
|
||||||
if (!window || (window->flags & SDL_WINDOW_MINIMIZED)) {
|
if (!window || (window->flags & SDL_WINDOW_MINIMIZED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
|
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
|
||||||
|
|
||||||
if (_this->MinimizeWindow) {
|
if (_this->MinimizeWindow) {
|
||||||
|
@ -1156,7 +1124,6 @@ SDL_RestoreWindow(SDL_WindowID windowID)
|
||||||
|| (window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
|
|| (window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
||||||
|
|
||||||
if (_this->RestoreWindow) {
|
if (_this->RestoreWindow) {
|
||||||
|
@ -1172,14 +1139,12 @@ SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
fullscreen = SDL_WINDOW_FULLSCREEN;
|
fullscreen = SDL_WINDOW_FULLSCREEN;
|
||||||
}
|
}
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN) == fullscreen) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == fullscreen) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
window->flags |= SDL_WINDOW_FULLSCREEN;
|
window->flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
|
||||||
|
@ -1215,7 +1180,6 @@ SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
|
||||||
if (!window || (!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
|
if (!window || (!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode) {
|
if (mode) {
|
||||||
window->flags |= SDL_WINDOW_INPUT_GRABBED;
|
window->flags |= SDL_WINDOW_INPUT_GRABBED;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1235,7 +1199,6 @@ SDL_GetWindowGrab(SDL_WindowID windowID)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((window->flags & SDL_WINDOW_INPUT_GRABBED) != 0);
|
return ((window->flags & SDL_WINDOW_INPUT_GRABBED) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1301,7 +1264,6 @@ SDL_GetFocusWindow(void)
|
||||||
if (!_this) {
|
if (!_this) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
display = &SDL_CurrentDisplay;
|
display = &SDL_CurrentDisplay;
|
||||||
for (i = 0; i < display->num_windows; ++i) {
|
for (i = 0; i < display->num_windows; ++i) {
|
||||||
SDL_Window *window = &display->windows[i];
|
SDL_Window *window = &display->windows[i];
|
||||||
|
@ -1321,7 +1283,6 @@ SDL_DestroyWindow(SDL_WindowID windowID)
|
||||||
if (!_this) {
|
if (!_this) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore video mode, etc. */
|
/* Restore video mode, etc. */
|
||||||
SDL_SendWindowEvent(windowID, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
|
SDL_SendWindowEvent(windowID, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
|
||||||
|
|
||||||
|
@ -1392,7 +1353,6 @@ SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
|
if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
|
||||||
SDL_SetError("index must be in the range of 0 - %d",
|
SDL_SetError("index must be in the range of 0 - %d",
|
||||||
SDL_GetNumRenderDrivers() - 1);
|
SDL_GetNumRenderDrivers() - 1);
|
||||||
|
@ -1410,7 +1370,6 @@ SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
const char *override = SDL_getenv("SDL_VIDEO_RENDERER");
|
const char *override = SDL_getenv("SDL_VIDEO_RENDERER");
|
||||||
int n = SDL_GetNumRenderDrivers();
|
int n = SDL_GetNumRenderDrivers();
|
||||||
|
@ -1433,13 +1392,11 @@ SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index >= SDL_GetNumRenderDrivers()) {
|
if (index >= SDL_GetNumRenderDrivers()) {
|
||||||
SDL_SetError("index must be -1 or in the range of 0 - %d",
|
SDL_SetError("index must be -1 or in the range of 0 - %d",
|
||||||
SDL_GetNumRenderDrivers() - 1);
|
SDL_GetNumRenderDrivers() - 1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free any existing renderer */
|
/* Free any existing renderer */
|
||||||
SDL_DestroyRenderer(windowID);
|
SDL_DestroyRenderer(windowID);
|
||||||
|
|
||||||
|
@ -1477,7 +1434,6 @@ SDL_GetRendererInfo(SDL_RendererInfo * info)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDL_CurrentDisplay.current_renderer) {
|
if (!SDL_CurrentDisplay.current_renderer) {
|
||||||
SDL_SetError("There is no current renderer");
|
SDL_SetError("There is no current renderer");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1497,18 +1453,15 @@ SDL_CreateTexture(Uint32 format, int access, int w, int h)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CurrentDisplay.current_renderer;
|
renderer = SDL_CurrentDisplay.current_renderer;
|
||||||
if (!renderer || !renderer->CreateTexture) {
|
if (!renderer || !renderer->CreateTexture) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
|
texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
texture->id = _this->next_object_id++;
|
texture->id = _this->next_object_id++;
|
||||||
texture->format = format;
|
texture->format = format;
|
||||||
texture->access = access;
|
texture->access = access;
|
||||||
|
@ -1527,7 +1480,6 @@ SDL_CreateTexture(Uint32 format, int access, int w, int h)
|
||||||
SDL_free(texture);
|
SDL_free(texture);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures));
|
hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures));
|
||||||
texture->next = SDL_CurrentDisplay.textures[hash];
|
texture->next = SDL_CurrentDisplay.textures[hash];
|
||||||
SDL_CurrentDisplay.textures[hash] = texture;
|
SDL_CurrentDisplay.textures[hash] = texture;
|
||||||
|
@ -1585,7 +1537,6 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
|
||||||
if (!textureID) {
|
if (!textureID) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bpp == fmt->BitsPerPixel && Rmask == fmt->Rmask && Gmask == fmt->Gmask
|
if (bpp == fmt->BitsPerPixel && Rmask == fmt->Rmask && Gmask == fmt->Gmask
|
||||||
&& Bmask == fmt->Bmask && Amask == fmt->Amask) {
|
&& Bmask == fmt->Bmask && Amask == fmt->Amask) {
|
||||||
if (SDL_MUSTLOCK(surface)) {
|
if (SDL_MUSTLOCK(surface)) {
|
||||||
|
@ -1611,12 +1562,14 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
|
||||||
dst_fmt->palette =
|
dst_fmt->palette =
|
||||||
SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
|
SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
|
||||||
if (dst_fmt->palette) {
|
if (dst_fmt->palette) {
|
||||||
/* FIXME: Should we try to copy fmt->palette? */
|
/*
|
||||||
|
* FIXME: Should we try to copy
|
||||||
|
* fmt->palette?
|
||||||
|
*/
|
||||||
SDL_DitherColors(dst_fmt->palette->colors,
|
SDL_DitherColors(dst_fmt->palette->colors,
|
||||||
SDL_BITSPERPIXEL(format));
|
SDL_BITSPERPIXEL(format));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dst = SDL_ConvertSurface(surface, dst_fmt, 0);
|
dst = SDL_ConvertSurface(surface, dst_fmt, 0);
|
||||||
if (dst) {
|
if (dst) {
|
||||||
SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
|
SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
|
||||||
|
@ -1637,7 +1590,6 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
|
||||||
SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
|
SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
|
||||||
fmt->palette->ncolors);
|
fmt->palette->ncolors);
|
||||||
}
|
}
|
||||||
|
|
||||||
return textureID;
|
return textureID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1650,7 +1602,6 @@ SDL_GetTextureFromID(SDL_TextureID textureID)
|
||||||
if (!_this) {
|
if (!_this) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
|
hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
|
||||||
for (texture = SDL_CurrentDisplay.textures[hash]; texture;
|
for (texture = SDL_CurrentDisplay.textures[hash]; texture;
|
||||||
texture = texture->next) {
|
texture = texture->next) {
|
||||||
|
@ -1670,7 +1621,6 @@ SDL_QueryTexture(SDL_TextureID textureID, Uint32 * format, int *access,
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format) {
|
if (format) {
|
||||||
*format = texture->format;
|
*format = texture->format;
|
||||||
}
|
}
|
||||||
|
@ -1695,7 +1645,6 @@ SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int *pitch)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->QueryTexturePixels) {
|
if (!renderer->QueryTexturePixels) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1713,7 +1662,6 @@ SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors,
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->SetTexturePalette) {
|
if (!renderer->SetTexturePalette) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1732,7 +1680,6 @@ SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors,
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->GetTexturePalette) {
|
if (!renderer->GetTexturePalette) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1750,7 +1697,6 @@ SDL_SetTextureColorMod(SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->SetTextureColorMod) {
|
if (!renderer->SetTextureColorMod) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1776,7 +1722,6 @@ SDL_GetTextureColorMod(SDL_TextureID textureID, Uint8 * r, Uint8 * g,
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (r) {
|
if (r) {
|
||||||
*r = texture->r;
|
*r = texture->r;
|
||||||
|
@ -1799,7 +1744,6 @@ SDL_SetTextureAlphaMod(SDL_TextureID textureID, Uint8 alpha)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->SetTextureAlphaMod) {
|
if (!renderer->SetTextureAlphaMod) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1821,7 +1765,6 @@ SDL_GetTextureAlphaMod(SDL_TextureID textureID, Uint8 * alpha)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alpha) {
|
if (alpha) {
|
||||||
*alpha = texture->a;
|
*alpha = texture->a;
|
||||||
}
|
}
|
||||||
|
@ -1837,7 +1780,6 @@ SDL_SetTextureBlendMode(SDL_TextureID textureID, int blendMode)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->SetTextureBlendMode) {
|
if (!renderer->SetTextureBlendMode) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1854,7 +1796,6 @@ SDL_GetTextureBlendMode(SDL_TextureID textureID, int *blendMode)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blendMode) {
|
if (blendMode) {
|
||||||
*blendMode = texture->blendMode;
|
*blendMode = texture->blendMode;
|
||||||
}
|
}
|
||||||
|
@ -1870,7 +1811,6 @@ SDL_SetTextureScaleMode(SDL_TextureID textureID, int scaleMode)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->SetTextureScaleMode) {
|
if (!renderer->SetTextureScaleMode) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1887,7 +1827,6 @@ SDL_GetTextureScaleMode(SDL_TextureID textureID, int *scaleMode)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scaleMode) {
|
if (scaleMode) {
|
||||||
*scaleMode = texture->scaleMode;
|
*scaleMode = texture->scaleMode;
|
||||||
}
|
}
|
||||||
|
@ -1905,12 +1844,10 @@ SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect * rect,
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->UpdateTexture) {
|
if (!renderer->UpdateTexture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rect) {
|
if (!rect) {
|
||||||
full_rect.x = 0;
|
full_rect.x = 0;
|
||||||
full_rect.y = 0;
|
full_rect.y = 0;
|
||||||
|
@ -1918,7 +1855,6 @@ SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect * rect,
|
||||||
full_rect.h = texture->h;
|
full_rect.h = texture->h;
|
||||||
rect = &full_rect;
|
rect = &full_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
|
return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1937,12 +1873,10 @@ SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect * rect, int markDirty,
|
||||||
SDL_SetError("SDL_LockTexture(): texture must be streaming");
|
SDL_SetError("SDL_LockTexture(): texture must be streaming");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->LockTexture) {
|
if (!renderer->LockTexture) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rect) {
|
if (!rect) {
|
||||||
full_rect.x = 0;
|
full_rect.x = 0;
|
||||||
full_rect.y = 0;
|
full_rect.y = 0;
|
||||||
|
@ -1950,7 +1884,6 @@ SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect * rect, int markDirty,
|
||||||
full_rect.h = texture->h;
|
full_rect.h = texture->h;
|
||||||
rect = &full_rect;
|
rect = &full_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderer->LockTexture(renderer, texture, rect, markDirty, pixels,
|
return renderer->LockTexture(renderer, texture, rect, markDirty, pixels,
|
||||||
pitch);
|
pitch);
|
||||||
}
|
}
|
||||||
|
@ -1967,7 +1900,6 @@ SDL_UnlockTexture(SDL_TextureID textureID)
|
||||||
if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
|
if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->UnlockTexture) {
|
if (!renderer->UnlockTexture) {
|
||||||
return;
|
return;
|
||||||
|
@ -1988,7 +1920,6 @@ SDL_DirtyTexture(SDL_TextureID textureID, int numrects,
|
||||||
if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
|
if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!renderer->DirtyTexture) {
|
if (!renderer->DirtyTexture) {
|
||||||
return;
|
return;
|
||||||
|
@ -2007,12 +1938,10 @@ SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect * rect)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CurrentDisplay.current_renderer;
|
renderer = SDL_CurrentDisplay.current_renderer;
|
||||||
if (!renderer || !renderer->RenderFill) {
|
if (!renderer || !renderer->RenderFill) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = SDL_GetWindowFromID(renderer->window);
|
window = SDL_GetWindowFromID(renderer->window);
|
||||||
real_rect.x = 0;
|
real_rect.x = 0;
|
||||||
real_rect.y = 0;
|
real_rect.y = 0;
|
||||||
|
@ -2023,7 +1952,6 @@ SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect * rect)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderer->RenderFill(renderer, r, g, b, a, &real_rect);
|
return renderer->RenderFill(renderer, r, g, b, a, &real_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2040,12 +1968,10 @@ SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect,
|
||||||
if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
|
if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CurrentDisplay.current_renderer;
|
renderer = SDL_CurrentDisplay.current_renderer;
|
||||||
if (!renderer || !renderer->RenderCopy) {
|
if (!renderer || !renderer->RenderCopy) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = SDL_GetWindowFromID(renderer->window);
|
window = SDL_GetWindowFromID(renderer->window);
|
||||||
if (srcrect) {
|
if (srcrect) {
|
||||||
real_srcrect = *srcrect;
|
real_srcrect = *srcrect;
|
||||||
|
@ -2077,7 +2003,6 @@ SDL_RenderPresent(void)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = SDL_CurrentDisplay.current_renderer;
|
renderer = SDL_CurrentDisplay.current_renderer;
|
||||||
if (!renderer || !renderer->RenderPresent) {
|
if (!renderer || !renderer->RenderPresent) {
|
||||||
return;
|
return;
|
||||||
|
@ -2096,7 +2021,6 @@ SDL_DestroyTexture(SDL_TextureID textureID)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look up the texture in the hash table */
|
/* Look up the texture in the hash table */
|
||||||
hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
|
hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
|
@ -2109,7 +2033,6 @@ SDL_DestroyTexture(SDL_TextureID textureID)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unlink the texture from the list */
|
/* Unlink the texture from the list */
|
||||||
if (prev) {
|
if (prev) {
|
||||||
prev->next = texture->next;
|
prev->next = texture->next;
|
||||||
|
@ -2133,12 +2056,10 @@ SDL_DestroyRenderer(SDL_WindowID windowID)
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = window->renderer;
|
renderer = window->renderer;
|
||||||
if (!renderer) {
|
if (!renderer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free existing textures for this renderer */
|
/* Free existing textures for this renderer */
|
||||||
for (i = 0; i < SDL_arraysize(SDL_CurrentDisplay.textures); ++i) {
|
for (i = 0; i < SDL_arraysize(SDL_CurrentDisplay.textures); ++i) {
|
||||||
SDL_Texture *texture;
|
SDL_Texture *texture;
|
||||||
|
@ -2179,7 +2100,6 @@ SDL_VideoQuit(void)
|
||||||
if (!_this) {
|
if (!_this) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Halt event processing before doing anything else */
|
/* Halt event processing before doing anything else */
|
||||||
SDL_StopEventLoop();
|
SDL_StopEventLoop();
|
||||||
|
|
||||||
|
@ -2248,7 +2168,6 @@ SDL_GL_LoadLibrary(const char *path)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->GL_LoadLibrary) {
|
if (_this->GL_LoadLibrary) {
|
||||||
retval = _this->GL_LoadLibrary(_this, path);
|
retval = _this->GL_LoadLibrary(_this, path);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2267,7 +2186,6 @@ SDL_GL_GetProcAddress(const char *proc)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
func = NULL;
|
func = NULL;
|
||||||
if (_this->GL_GetProcAddress) {
|
if (_this->GL_GetProcAddress) {
|
||||||
if (_this->gl_config.driver_loaded) {
|
if (_this->gl_config.driver_loaded) {
|
||||||
|
@ -2295,13 +2213,11 @@ SDL_GL_ExtensionSupported(const char *extension)
|
||||||
if (where || *extension == '\0') {
|
if (where || *extension == '\0') {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if there's an environment variable override */
|
/* See if there's an environment variable override */
|
||||||
start = SDL_getenv(extension);
|
start = SDL_getenv(extension);
|
||||||
if (start && *start == '0') {
|
if (start && *start == '0') {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup the available extensions */
|
/* Lookup the available extensions */
|
||||||
glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
|
glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
|
||||||
if (glGetStringFunc) {
|
if (glGetStringFunc) {
|
||||||
|
@ -2312,10 +2228,10 @@ SDL_GL_ExtensionSupported(const char *extension)
|
||||||
if (!extensions) {
|
if (!extensions) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
/* It takes a bit of care to be fool-proof about parsing the
|
* It takes a bit of care to be fool-proof about parsing the OpenGL
|
||||||
* OpenGL extensions string. Don't be fooled by sub-strings,
|
* extensions string. Don't be fooled by sub-strings, etc.
|
||||||
* etc. */
|
*/
|
||||||
|
|
||||||
start = extensions;
|
start = extensions;
|
||||||
|
|
||||||
|
@ -2347,7 +2263,6 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case SDL_GL_RED_SIZE:
|
case SDL_GL_RED_SIZE:
|
||||||
|
@ -2469,7 +2384,10 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
||||||
GLint bits = 0;
|
GLint bits = 0;
|
||||||
GLint component;
|
GLint component;
|
||||||
|
|
||||||
/* there doesn't seem to be a single flag in OpenGL for this! */
|
/*
|
||||||
|
* there doesn't seem to be a single flag in OpenGL
|
||||||
|
* for this!
|
||||||
|
*/
|
||||||
glGetIntegervFunc(GL_RED_BITS, &component);
|
glGetIntegervFunc(GL_RED_BITS, &component);
|
||||||
bits += component;
|
bits += component;
|
||||||
glGetIntegervFunc(GL_GREEN_BITS, &component);
|
glGetIntegervFunc(GL_GREEN_BITS, &component);
|
||||||
|
@ -2538,7 +2456,6 @@ SDL_GL_SetSwapInterval(int interval)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->GL_SetSwapInterval) {
|
if (_this->GL_SetSwapInterval) {
|
||||||
return _this->GL_SetSwapInterval(_this, interval);
|
return _this->GL_SetSwapInterval(_this, interval);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2554,7 +2471,6 @@ SDL_GL_GetSwapInterval(void)
|
||||||
SDL_UninitializedVideo();
|
SDL_UninitializedVideo();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->GL_GetSwapInterval) {
|
if (_this->GL_GetSwapInterval) {
|
||||||
return _this->GL_GetSwapInterval(_this);
|
return _this->GL_GetSwapInterval(_this);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2589,8 +2505,10 @@ SDL_GL_DeleteContext(SDL_GLContext context)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // FIXME
|
#if 0 // FIXME
|
||||||
/* Utility function used by SDL_WM_SetIcon();
|
/*
|
||||||
* flags & 1 for color key, flags & 2 for alpha channel. */
|
* Utility function used by SDL_WM_SetIcon(); flags & 1 for color key, flags
|
||||||
|
* & 2 for alpha channel.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int flags)
|
CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int flags)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue