aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl/opengl-graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/graphics/opengl/opengl-graphics.cpp')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 06a0109476..9d11925613 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -909,7 +909,7 @@ void OpenGLGraphicsManager::grabPalette(byte *colors, uint start, uint num) cons
memcpy(colors, _gamePalette + start * 3, num * 3);
}
-void OpenGLGraphicsManager::handleResizeImpl(const int width, const int height) {
+void OpenGLGraphicsManager::handleResizeImpl(const int width, const int height, const int xdpi, const int ydpi) {
// Setup backbuffer size.
_backBuffer.setDimensions(width, height);
@@ -942,6 +942,10 @@ void OpenGLGraphicsManager::handleResizeImpl(const int width, const int height)
overlayWidth = MAX<uint>(overlayWidth, 256);
overlayHeight = MAX<uint>(overlayHeight, 200);
+ // HACK: Reduce the size of the overlay on high DPI screens.
+ overlayWidth = fracToInt(overlayWidth * (intToFrac(90) / xdpi));
+ overlayHeight = fracToInt(overlayHeight * (intToFrac(90) / ydpi));
+
if (!_overlay || _overlay->getFormat() != _defaultFormatAlpha) {
delete _overlay;
_overlay = nullptr;
@@ -1008,7 +1012,7 @@ void OpenGLGraphicsManager::notifyContextCreate(const Graphics::PixelFormat &def
// Refresh the output screen dimensions if some are set up.
if (_windowWidth != 0 && _windowHeight != 0) {
- handleResize(_windowWidth, _windowHeight);
+ handleResize(_windowWidth, _windowHeight, _xdpi, _ydpi);
}
// TODO: Should we try to convert textures into one of those formats if
@@ -1275,6 +1279,16 @@ void OpenGLGraphicsManager::recalculateCursorScaling() {
_cursorHotspotYScaled = fracToInt(_cursorHotspotYScaled * screenScaleFactorY);
_cursorHeightScaled = fracToInt(_cursorHeightScaled * screenScaleFactorY);
+ } else {
+ const frac_t screenScaleFactorX = intToFrac(90) / _xdpi;
+ const frac_t screenScaleFactorY = intToFrac(90) / _ydpi;
+
+ // FIXME: Replace this with integer maths
+ _cursorHotspotXScaled /= fracToDouble(screenScaleFactorX);
+ _cursorWidthScaled /= fracToDouble(screenScaleFactorX);
+
+ _cursorHotspotYScaled /= fracToDouble(screenScaleFactorY);
+ _cursorHeightScaled /= fracToDouble(screenScaleFactorY);
}
}