Fixed build errors when OpenGL isn't enabled

main
Sam Lantinga 2023-08-05 00:25:12 -07:00
parent 35ad68e126
commit d3bcc3f057
3 changed files with 12 additions and 7 deletions

View File

@ -1151,7 +1151,6 @@ retry:
SDL_LockMutex(Android_ActivityMutex); SDL_LockMutex(Android_ActivityMutex);
if (Android_Window) { if (Android_Window) {
SDL_VideoDevice *_this = SDL_GetVideoDevice();
SDL_WindowData *data = Android_Window->driverdata; SDL_WindowData *data = Android_Window->driverdata;
/* Wait for Main thread being paused and context un-activated to release 'egl_surface' */ /* Wait for Main thread being paused and context un-activated to release 'egl_surface' */
@ -1168,7 +1167,7 @@ retry:
#ifdef SDL_VIDEO_OPENGL_EGL #ifdef SDL_VIDEO_OPENGL_EGL
if (data->egl_surface != EGL_NO_SURFACE) { if (data->egl_surface != EGL_NO_SURFACE) {
SDL_EGL_DestroySurface(_this, data->egl_surface); SDL_EGL_DestroySurface(SDL_GetVideoDevice(), data->egl_surface);
data->egl_surface = EGL_NO_SURFACE; data->egl_surface = EGL_NO_SURFACE;
} }
#endif #endif

View File

@ -155,9 +155,12 @@ class SDL_BWin : public BWindow
void UpdateCurrentView() void UpdateCurrentView()
{ {
#ifdef SDL_VIDEO_OPENGL
if (_SDL_GLView != NULL) { if (_SDL_GLView != NULL) {
SetCurrentView(_SDL_GLView); SetCurrentView(_SDL_GLView);
} else if (_SDL_View != NULL) { } else
#endif
if (_SDL_View != NULL) {
SetCurrentView(_SDL_View); SetCurrentView(_SDL_View);
} else { } else {
SetCurrentView(NULL); SetCurrentView(NULL);
@ -454,10 +457,13 @@ class SDL_BWin : public BWindow
delete pendingMessage; delete pendingMessage;
} }
if (_bitmap != NULL) { if (_bitmap != NULL) {
if (_SDL_View != NULL && _cur_view == _SDL_View) #ifdef SDL_VIDEO_OPENGL
_SDL_View->Draw(Bounds()); if (_SDL_GLView != NULL && _cur_view == _SDL_GLView) {
else if (_SDL_GLView != NULL && _cur_view == _SDL_GLView) {
_SDL_GLView->CopyPixelsIn(_bitmap, B_ORIGIN); _SDL_GLView->CopyPixelsIn(_bitmap, B_ORIGIN);
} else
#endif
if (_SDL_View != NULL && _cur_view == _SDL_View) {
_SDL_View->Draw(Bounds());
} }
} }
break; break;

View File

@ -423,7 +423,6 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_WindowData *windowdata; SDL_WindowData *windowdata;
Display *display = data->display; Display *display = data->display;
int screen = displaydata->screen; int screen = displaydata->screen;
const int transparent = (window->flags & SDL_WINDOW_TRANSPARENT) ? SDL_TRUE : SDL_FALSE;
Visual *visual; Visual *visual;
int depth; int depth;
XSetWindowAttributes xattr; XSetWindowAttributes xattr;
@ -443,6 +442,7 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_bool undefined_position = SDL_FALSE; SDL_bool undefined_position = SDL_FALSE;
#if defined(SDL_VIDEO_OPENGL_GLX) || defined(SDL_VIDEO_OPENGL_EGL) #if defined(SDL_VIDEO_OPENGL_GLX) || defined(SDL_VIDEO_OPENGL_EGL)
const int transparent = (window->flags & SDL_WINDOW_TRANSPARENT) ? SDL_TRUE : SDL_FALSE;
const char *forced_visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_WINDOW_VISUALID); const char *forced_visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_WINDOW_VISUALID);
if (forced_visual_id != NULL && forced_visual_id[0] != '\0') { if (forced_visual_id != NULL && forced_visual_id[0] != '\0') {