WinRT globals cleanup: Removed WINRT_GlobalSDLVideoDevice
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp
index 2fd20a8..02c1890 100644
--- a/src/core/winrt/SDL_winrtapp_direct3d.cpp
+++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp
@@ -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) {
diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp
index f54e985..f8ebee0 100644
--- a/src/video/winrt/SDL_winrtvideo.cpp
+++ b/src/video/winrt/SDL_winrtvideo.cpp
@@ -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;
}
diff --git a/src/video/winrt/SDL_winrtvideo_cpp.h b/src/video/winrt/SDL_winrtvideo_cpp.h
index 119f5b8..a90f043 100644
--- a/src/video/winrt/SDL_winrtvideo_cpp.h
+++ b/src/video/winrt/SDL_winrtvideo_cpp.h
@@ -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.