Wrap the display globals in a struct (#16998)

* Wrap the display globals in a struct

Makes it easier to search/replace these, for future refactorings.

* Some renaming

* Qt buildfix, also fix the Qt build on Mac (got broken with battery changes)

* Attempt at buildfixing ios

* UWP buildfix
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2023-02-25 13:09:44 +01:00
1 parent 3e98d313a8
commit 8b431b39ba
48 files changed
+319 -313

No files matched your search

+14 -12
View File
@@ -1095,8 +1095,8 @@ void NativeRender(GraphicsContext *graphicsContext) {
g_BackgroundAudio.Update();
}
float xres = dp_xres;
float yres = dp_yres;
float xres = g_display.dp_xres;
float yres = g_display.dp_yres;
// Apply the UIContext bounds as a 2D transformation matrix.
// TODO: This should be moved into the draw context...
@@ -1109,7 +1109,9 @@ void NativeRender(GraphicsContext *graphicsContext) {
ortho.setOrthoD3D(0.0f, xres, yres, 0.0f, -1.0f, 1.0f);
Matrix4x4 translation;
// Account for the small window adjustment.
translation.setTranslation(Vec3(-0.5f * g_dpi_scale_x / g_dpi_scale_real_x, -0.5f * g_dpi_scale_y / g_dpi_scale_real_y, 0.0f));
translation.setTranslation(Vec3(
-0.5f * g_display.dpi_scale_x / g_display.dpi_scale_real_x,
-0.5f * g_display.dpi_scale_y / g_display.dpi_scale_real_y, 0.0f));
ortho = translation * ortho;
break;
case GPUBackend::DIRECT3D11:
@@ -1122,8 +1124,8 @@ void NativeRender(GraphicsContext *graphicsContext) {
}
// Compensate for rotated display if needed.
if (g_display_rotation != DisplayRotation::ROTATE_0) {
ortho = ortho * g_display_rot_matrix;
if (g_display.rotation != DisplayRotation::ROTATE_0) {
ortho = ortho * g_display.rot_matrix;
}
ui_draw2d.PushDrawMatrix(ortho);
@@ -1151,13 +1153,13 @@ void NativeRender(GraphicsContext *graphicsContext) {
if (uiContext) {
// Modifying the bounds here can be used to "inset" the whole image to gain borders for TV overscan etc.
// The UI now supports any offset but not the EmuScreen yet.
uiContext->SetBounds(Bounds(0, 0, dp_xres, dp_yres));
uiContext->SetBounds(Bounds(0, 0, g_display.dp_xres, g_display.dp_yres));
// OSX 10.6 and SDL 1.2 bug.
#if defined(__APPLE__) && !defined(USING_QT_UI)
static int dp_xres_old = dp_xres;
if (dp_xres != dp_xres_old) {
dp_xres_old = dp_xres;
static int dp_xres_old = g_display.dp_xres;
if (g_display.dp_xres != dp_xres_old) {
dp_xres_old = g_display.dp_xres;
}
#endif
}
@@ -1167,8 +1169,8 @@ void NativeRender(GraphicsContext *graphicsContext) {
// TODO: Move this to the GraphicsContext objects for each backend.
#if !PPSSPP_PLATFORM(WINDOWS) && !defined(ANDROID)
PSP_CoreParameter().pixelWidth = pixel_xres;
PSP_CoreParameter().pixelHeight = pixel_yres;
PSP_CoreParameter().pixelWidth = g_display.pixel_xres;
PSP_CoreParameter().pixelHeight = g_display.pixel_yres;
NativeMessageReceived("gpu_displayResized", "");
#endif
} else {
@@ -1402,7 +1404,7 @@ void NativeAxis(const AxisInput &axis) {
// sent with respect to the portrait coordinate system, while we
// take all events in landscape.
// see [http://developer.android.com/guide/topics/sensors/sensors_overview.html] for details
bool landscape = dp_yres < dp_xres;
bool landscape = g_display.dp_yres < g_display.dp_xres;
// now transform out current tilt to the calibrated coordinate system
ProcessTilt(landscape, tiltBaseAngleY, tiltX, tiltY, tiltZ,
g_Config.bInvertTiltX, g_Config.bInvertTiltY,