WinRT globals cleanup: Removed WINRT_GlobalSDLVideoDevice
parent
b51a3206c8
commit
823bf72130
|
@ -173,6 +173,8 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n
|
|||
static void
|
||||
WINRT_ProcessWindowSizeChange()
|
||||
{
|
||||
SDL_VideoDevice *_this = SDL_GetVideoDevice();
|
||||
|
||||
// Make the new window size be the one true fullscreen mode.
|
||||
// This change was initially done, in part, to allow the Direct3D 11.1
|
||||
// renderer to receive window-resize events as a device rotates.
|
||||
|
@ -192,31 +194,31 @@ WINRT_ProcessWindowSizeChange()
|
|||
// Make note of the old display mode, and it's old driverdata.
|
||||
SDL_DisplayMode oldDisplayMode;
|
||||
SDL_zero(oldDisplayMode);
|
||||
if (WINRT_GlobalSDLVideoDevice) {
|
||||
oldDisplayMode = WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode;
|
||||
if (_this) {
|
||||
oldDisplayMode = _this->displays[0].desktop_mode;
|
||||
}
|
||||
|
||||
// Setup the new display mode in the appropriate spots.
|
||||
if (WINRT_GlobalSDLVideoDevice) {
|
||||
if (_this) {
|
||||
// Make a full copy of the display mode for display_modes[0],
|
||||
// one with with a separately malloced 'driverdata' field.
|
||||
// SDL_VideoQuit(), if called, will attempt to free the driverdata
|
||||
// fields in 'desktop_mode' and each entry in the 'display_modes'
|
||||
// array.
|
||||
if (WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata) {
|
||||
if (_this->displays[0].display_modes[0].driverdata) {
|
||||
// Free the previous mode's memory
|
||||
SDL_free(WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata);
|
||||
WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0].driverdata = NULL;
|
||||
SDL_free(_this->displays[0].display_modes[0].driverdata);
|
||||
_this->displays[0].display_modes[0].driverdata = NULL;
|
||||
}
|
||||
if (WINRT_DuplicateDisplayMode(&(WINRT_GlobalSDLVideoDevice->displays[0].display_modes[0]), &newDisplayMode) != 0) {
|
||||
if (WINRT_DuplicateDisplayMode(&(_this->displays[0].display_modes[0]), &newDisplayMode) != 0) {
|
||||
// Uh oh, something went wrong. A malloc call probably failed.
|
||||
SDL_free(newDisplayMode.driverdata);
|
||||
return;
|
||||
}
|
||||
|
||||
// Install 'newDisplayMode' into 'current_mode' and 'desktop_mode'.
|
||||
WINRT_GlobalSDLVideoDevice->displays[0].current_mode = newDisplayMode;
|
||||
WINRT_GlobalSDLVideoDevice->displays[0].desktop_mode = newDisplayMode;
|
||||
_this->displays[0].current_mode = newDisplayMode;
|
||||
_this->displays[0].desktop_mode = newDisplayMode;
|
||||
}
|
||||
|
||||
if (WINRT_GlobalSDLWindow) {
|
||||
|
|
|
@ -70,7 +70,6 @@ static SDL_bool WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo
|
|||
|
||||
/* SDL-internal globals: */
|
||||
SDL_Window * WINRT_GlobalSDLWindow = NULL;
|
||||
SDL_VideoDevice * WINRT_GlobalSDLVideoDevice = NULL;
|
||||
|
||||
|
||||
/* WinRT driver bootstrap functions */
|
||||
|
@ -84,10 +83,6 @@ WINRT_Available(void)
|
|||
static void
|
||||
WINRT_DeleteDevice(SDL_VideoDevice * device)
|
||||
{
|
||||
if (device == WINRT_GlobalSDLVideoDevice) {
|
||||
WINRT_GlobalSDLVideoDevice = NULL;
|
||||
}
|
||||
|
||||
if (device->driverdata) {
|
||||
SDL_VideoData * video_data = (SDL_VideoData *)device->driverdata;
|
||||
if (video_data->winrtEglWindow) {
|
||||
|
@ -143,7 +138,6 @@ WINRT_CreateDevice(int devindex)
|
|||
device->GL_DeleteContext = WINRT_GLES_DeleteContext;
|
||||
#endif
|
||||
device->free = WINRT_DeleteDevice;
|
||||
WINRT_GlobalSDLVideoDevice = device;
|
||||
|
||||
return device;
|
||||
}
|
||||
|
|
|
@ -48,9 +48,6 @@ typedef struct SDL_VideoData {
|
|||
*/
|
||||
extern SDL_Window * WINRT_GlobalSDLWindow;
|
||||
|
||||
/* The global, WinRT, video device. */
|
||||
extern SDL_VideoDevice * WINRT_GlobalSDLVideoDevice;
|
||||
|
||||
/* Creates a display mode for Plain Direct3D (non-XAML) apps, using the lone, native window's settings.
|
||||
|
||||
Pass in an allocated SDL_DisplayMode field to store the data in.
|
||||
|
|
Loading…
Reference in New Issue