Commit Graph
1203 Commits
Author SHA1 Message Date
Orgad Shaneh b11c5ace90 BACKENDS: JANITORIAL: Remove 'virtual' when override is specified 2021-11-14 14:31:41 +02:00
Paweł Kołodziejski 543e53eaad SURFACESDL: Implemented missing kFeatureVSync for getFeatureState() 2021-11-08 09:07:48 +01:00
Paweł Kołodziejski dfe477e95e SURFACESDL: Implemented fallback in case lack of VSYNC 2021-11-08 09:07:48 +01:00
Alexandre Detiste 6044504762 JANITORIAL: typos
some in the variable names, some in the comments;
no change for the strings that interract with original games assets
2021-10-31 20:46:31 +01:00
Vanfanel 5873dfad7c SDL: Add missing getFeatureState() case for VSYNC. 2021-10-23 20:53:22 +01:00
Vanfanel 58a243842f SDL: Remove redundant #if. 2021-10-23 20:53:22 +01:00
Vanfanel 046b48f90d SDL: Add OSystem::kFeatureVSync to SDL surface and OpenGL graphics. 2021-10-23 20:53:22 +01:00
Vanfanel 3a59c28179 SDL: Generalize VSYNC option so it works for 2D games too, in both SDL surface and opengl graphic modes. 2021-10-23 20:53:22 +01:00
Thierry Crozat 594a81f93c OPENGLSDL: Fix restoring window size when exiting fullscreen
When entering fullscreen it was storing the default window size
in the config, which was overwriting the current window size. As
a result when exiting window size, instead of restoring to the
previous window size it was restoring to the default window size.
2021-10-11 02:59:01 +03:00
Thierry Crozat 45a803c71c OPENGLSDL: Fix always restoring window to maximized size when exiting fullscreen
When loadVideoMode gets called to exit fullscreen, the window is
still fullscreen, which means that the SDL_WINDOW_MAXIMIZED is set
(at least on macOS). As a result the window was resized to the
stored maximized window size instead of the size it had before
entering fullscreen.
2021-10-11 02:59:01 +03:00
Thierry Crozat 1962e543fd JANITORIAL: Rename variable to follow code formatting conventions 2021-10-02 21:50:28 +01:00
Thierry Crozat 8d972b338d OPENGLSDL: Properly check for fullscreen state
The OpenGLSDLGraphicsManager was changed in bb15133a0a to use
SDL_WINDOW_FULLSCREEN_DESKTOP instead of SDL_WINDOW_FULLSCREEN.
But getFeatureState(kFeatureFullscreenMode) was still checking
the SDL_WINDOW_FULLSCREEN flag. This worked because in current
SDL2 versions SDL_WINDOW_FULLSCREEN_DESKTOP is defined as
SDL_WINDOW_FULLSCREEN | 0x00001000, but this is not documented
and could change in future SDL versions.
2021-10-02 18:59:44 +01:00
Filippos Karapetis 8f49df6aca SDL: Fix full screen toggling for 3D games
The previous SdlGraphics3dManager::toggleFullScreen() was not using
beginGFXTransaction / endGFXTransaction in toggleFullScreen().
Restore this logic for 3D games, as using transactions in such games
results in a black screen for 3D games when switching to full screen

A regression from d33487f64
2021-09-29 20:24:03 +02:00
Torbjörn Andersson 8ba69ec278 SDL: Silence signed/unsigned warning 2021-09-09 07:20:04 +02:00
Thierry Crozat b3b3684b46 SDL: Fix starting high resolution game with default scale factor 2021-09-08 21:32:42 +01:00
Torbjörn Andersson 9df10525df SDL: Check if hi-res scaler is available at desired factor
Instead of falling back to the normal scaler if the new scale factor is
1, explicitly check if the desired scaler is available at the new scale
factor. Suggested by criezy, and I'm shamelessly copying his
implementation because this sort of C++ trickery is something I'm not
fluent in.

At the moment, this shouldn't make any difference. But I guess in the
future, there may be a scaler that's available at 3x and 4x, but not 2x,
or something like that.
2021-09-02 13:24:06 +02:00
Torbjörn Andersson b5f27b5950 SDL: Set better default scaler for high-resolution games
Now that we have higher scale factors than 3, it makes sense to try and
figure out a default scaler for high-resolution games that approximate
the window size of a low resolution game.

That also means that we are not necessarily restricted to the normal
scaler, since AdvMame has both 2x and 4x versions.
2021-09-02 13:24:06 +02:00
Lothar Serra Mari d6f105e906 BACKENDS: OPENGLSDL: Only relocate the window to the center of the screen if truly necessary 2021-08-28 10:43:04 +02:00
Lothar Serra Mari 1b42675e52 BACKENDS: OPENGLSDL: Limit window positioning workaround to Win32
It looks like other platforms are not affected by this, at least I
wasn't able to reproduce the issue on Linux in any way.

Since branching off to the next release is very soon and we are running
out of time, I'm limiting this to Win32 in order to avoid unneccessary
breakage by only fixing _really_ affected platforms.
2021-08-28 10:43:04 +02:00
Lothar Serra Mari 4c7bc5effb BACKENDS: OPENGLSDL: Do not try to center window in fullscreen or maximized mode 2021-08-28 10:43:04 +02:00
Lothar Serra Mari 1b6c4f48aa BACKENDS: OPENGLSDL: Forcefully center the window to prevent off-screen rendering 2021-08-28 10:43:04 +02:00
Lothar Serra Mari cedd57a4ac BACKENDS: OPENGLSDL: Fix wrong check for maximized windows 2021-08-28 10:43:04 +02:00
Lothar Serra Mari 3da65d47cb BACKENDS: OPENGLSDL: Prevent window resizing events in fullscreen mode 2021-08-28 10:43:04 +02:00
Lothar Serra Mari d07c97f3cd BACKENDS: OPENGLSDL: Remember maximized window state 2021-08-28 10:43:04 +02:00
Thierry Crozat 478fbbbe9b SDL: Fix the default scale factor for high resolution games
This fixes bug #12847: HQ filter broken when applied as a global setting
2021-08-26 18:32:21 +01:00
Thierry Crozat dc7a09fdd1 SDL: Cleanup HiDPI macOS hacks
The SDL library handles HiDPI differently depending on the system.
On some systems, such as macOS, the drawable area and the SDL window
have a different size (the window is on low-dpi size) while on
other systems such as Windows they have the same size. Because of
that we sometimes need to scale sizes or coordinates between the
two, and sometimes we don't.

This was handled in two different ways. This commit change the code
to handle it consistently everywhere, and also should be more future
proof should SDL change the way it handles HiDPI in the future (as
we now query the size from SDL itself to find out if the scaling is
needed).
2021-08-20 22:10:26 +02:00
Thierry Crozat feac996b50 SDL: Move code to handle cursor coordinate HiDPI scale to SdlWindow
SDL handles HiDPI scaling differently depending on the system. On
macOS for example the SDL window size and SDL drawable area have a
different size (factor 2 usually) while on Windows they are the
same. When HiDPI is disabled (for the SDL Surface mode for example)
they are always the same.

We need to appl this scaling when converting cursor position between
the drawable area and the SDL window.
2021-08-20 00:12:51 +01:00
Eugene Sandulenko df1341ae6a BACKENDS: Display OSD message on saved screenshots 2021-08-16 14:19:07 +02:00
athrxx 95f1b010f8 SDL: avoid assert with SDL debug builds 2021-08-15 16:18:16 +02:00
Lothar Serra Mari 900d763264 BACKENDS: OPENGLSDL: Enlarge window if stored dimensions are not sufficient 2021-08-15 13:58:48 +01:00
Lothar Serra Mari 1aaab76b44 BACKENDS: OPENGLSDL: Fix aspect ratio on auto-calculated window sizes 2021-08-15 13:58:48 +01:00
Lothar Serra Mari 51cff582b5 BACKENDS: OPENGLSDL: Disable storing and restoring window sizes for SDL1
The previous implementation was already broken, since the values were never stored in the config file
since that part was already guarded by SDL_VERSION_ATLEAST.

Since we have no way to properly determine if a window is maximized or not for
SDL1, I recommend skipping this part in the compilation.

Now, the function at least works properly for SDL2 - it was broken on _both_ versions before.
2021-08-15 13:58:48 +01:00
Lothar Serra Mari 8a8557e94d BACKENDS: OPENGLSDL: Fix logic errors in window size management 2021-08-15 13:58:48 +01:00
Thierry Crozat 6fcfdb0514 SDL: Fix handling of cursor position on Windows HiDPI 2021-08-14 19:11:11 +01:00
Cameron Cawley c4699cb280 SDL: Move getDisplayDpiFromSdl and getDpiScalingFactor into the SdlWindow class 2021-08-14 19:09:33 +01:00
Thierry Crozat 4d59d40f32 OPENGLSDL: Fix compilation with SDL1 2021-08-14 03:25:43 +01:00
Thierry Crozat c9682dfbcf OPENGLSDL: Fix changing scaler with hotkey in games
Also improve decreasing the scaler when using a custom window size.
2021-08-13 23:58:34 +01:00
Thierry Crozat 5caacb763b SDL: Change signature of getDpiScalingFactor to return the result 2021-08-13 21:41:33 +01:00
Thierry Crozat abf782c670 COMMON: Remove kFeatureHiDPI from OSystem and use getHiDPIScreenFactor instead 2021-08-13 21:41:33 +01:00
Thierry Crozat 4ad54446f8 SDL: Get accurate HiDPI scaling on macOS
This fixes incorrect scaling on some non-retina screens that were
detected as HiDPI.
2021-08-13 21:41:33 +01:00
Thierry Crozat 63dd44a81d SDL: Implement getHiDPIScreenFactor 2021-08-13 21:41:33 +01:00
Thierry Crozat 6d8462674f COMMON: Add getHiDPIScreenFactor to OSystem 2021-08-13 21:41:33 +01:00
Le Philousophe 68a327ecb1 BACKENDS: Harden grabOverlay in all platforms
Use specific copy code where applicable and replace duplicated code by
calls to copyBlit which optimizes blitting
2021-08-04 13:27:07 +02:00
Thierry Crozat ec06d940a2 BACKENDS: Explicitly use ellipsis for OSD text if needed
This is the default, so this commit does not change the behaviour.
But this will allow to change the default at a later stage.
2021-08-01 17:22:13 +02:00
Lothar Serra Mari aae99da842 BACKENDS: OPENGLSDL: Save detected window dimensions to the config file
This prevents undefined behavior if no window dimensions are present in
the ScummVM config file from previous runs.
2021-07-30 20:47:53 +02:00
Thierry Crozat 23ca3604b8 SDL: Fix crash when switching to a 3D graphics manager
The OpenGLSdlGraphics3dManager::getSupportedFormats() implementation
returns an empty list. This caused a crash when trying to get the
first element of the list in SdlGraphicsManager::setState().

This fixes bug #12762: The longest Journey crashes
2021-07-26 23:18:17 +01:00
Thierry Crozat 2a410768ad OPENGLSDL: Fix increasing/decreasing the window size on macOS 2021-07-16 13:20:38 +01:00
Thierry Crozat c1a2d5ba1b OPENGLSDL: Remove getting the supported screen resolutions for SDL2
Since we use the SDL_WINDOW_FULLSCREEN_DESKTOP with SDL2, we always
use the desktop resolution in fullscreen mode anyway. Cycling
through other resolutions did nothing and was confusing.
2021-07-16 13:20:38 +01:00
Paul Gilbert baccbedf50 GRAPHICS: Changed surface classes sizes from uint16 to int16 2021-07-04 18:24:27 -07:00
Torbjörn Andersson 5c8bd3b687 SURFACESDL: Fix grabOverlay() regression
The grabOverlay() function would only copy half the width of the
overlay. This was probably more or less visible in any game that could
show a ScummVM dialog (e.g. the pause dialog in SCUMM games, or any
message box in the Hugo games).

Is crossBlit() overkill here? Probably, but it should fall back on
copyBlit() if the source and destination formats are the same.

Besides, this way perhaps I will finally get some more feedback on how
to fix the regression.
2021-06-30 19:15:51 +02:00