Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WinRT: display-information code cleanups
  • Loading branch information
DavidLudwig committed May 10, 2014
1 parent d4f1d22 commit 164e5b8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
6 changes: 1 addition & 5 deletions src/core/winrt/SDL_winrtapp_direct3d.cpp
Expand Up @@ -170,11 +170,7 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n
// for details. Microsoft's "Display orientation sample" also gives an
// outline of how Windows treats device rotation
// (http://code.msdn.microsoft.com/Display-Orientation-Sample-19a58e93).
#if NTDDI_VERSION > NTDDI_WIN8
DisplayInformation::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
#else
DisplayProperties::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
#endif
WINRT_DISPLAY_PROPERTY(AutoRotationPreferences) = (DisplayOrientations) orientationFlags;
}

static void
Expand Down
7 changes: 2 additions & 5 deletions src/render/direct3d11/SDL_render_winrt.cpp
Expand Up @@ -23,6 +23,7 @@
#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED

#include "SDL_syswm.h"
#include "../../video/winrt/SDL_winrtvideo_cpp.h"
extern "C" {
#include "../SDL_sysrender.h"
}
Expand Down Expand Up @@ -79,11 +80,7 @@ D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer)
extern "C" DXGI_MODE_ROTATION
D3D11_GetCurrentRotation()
{
#if NTDDI_VERSION > NTDDI_WIN8
const DisplayOrientations currentOrientation = DisplayInformation::GetForCurrentView()->CurrentOrientation;
#else
const DisplayOrientations currentOrientation = DisplayProperties::CurrentOrientation;
#endif
const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);

switch (currentOrientation) {

Expand Down
2 changes: 1 addition & 1 deletion src/video/winrt/SDL_winrtpointerinput.cpp
Expand Up @@ -87,7 +87,7 @@ WINRT_TransformCursorPosition(SDL_Window * window,
outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width;
outputPosition.Y = rawPosition.Y / nativeWindow->Bounds.Height;
#else
switch (DisplayProperties::CurrentOrientation)
switch (WINRT_DISPLAY_PROPERTY(CurrentOrientation))
{
case DisplayOrientations::Portrait:
outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width;
Expand Down
12 changes: 2 additions & 10 deletions src/video/winrt/SDL_winrtvideo.cpp
Expand Up @@ -185,11 +185,7 @@ WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode)

// Calculate the display size given the window size, taking into account
// the current display's DPI:
#if NTDDI_VERSION > NTDDI_WIN8
const float currentDPI = DisplayInformation::GetForCurrentView()->LogicalDpi;
#else
const float currentDPI = Windows::Graphics::Display::DisplayProperties::LogicalDpi;
#endif
const float currentDPI = WINRT_DISPLAY_PROPERTY(LogicalDpi);
const float dipsPerInch = 96.0f;
const int w = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Width * currentDPI) / dipsPerInch);
const int h = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Height * currentDPI) / dipsPerInch);
Expand All @@ -211,11 +207,7 @@ WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode)
mode->w = w;
mode->h = h;
mode->driverdata = driverdata;
#if NTDDI_VERSION > NTDDI_WIN8
driverdata->currentOrientation = DisplayInformation::GetForCurrentView()->CurrentOrientation;
#else
driverdata->currentOrientation = DisplayProperties::CurrentOrientation;
#endif
driverdata->currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);

#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8)
// On Windows Phone 8.0, the native window's size is always in portrait,
Expand Down

0 comments on commit 164e5b8

Please sign in to comment.