Commit graph

435 commits

Author SHA1 Message Date
Filippos Karapetis
ce51fd937f BACKENDS: Use C++ 11 range-based for loops 2025-03-27 13:47:57 +08:00
Le Philousophe
19f735adf7 BACKENDS: SURFACESDL: Fix memory leak
There was a copy paste error.
Also use the new shim instead of an ifdef to destroy the mouse surface.
2025-02-19 22:30:17 +01:00
scemino
8afb2c1f62 BACKENDS: Add SDL3 backend + update imgui 2025-02-18 22:13:56 +01:00
Eugene Sandulenko
ca4b64beeb
BACKENDS: SURFACESDL: Fix image generation for ImGui. Courtesy of lephilosouphe 2024-09-29 17:26:34 +02:00
Le Philousophe
7a69ccc4b8 JANITORIAL: Cleanup whitespaces problems 2024-09-29 17:08:13 +02:00
Le Philousophe
2813582f6b BACKENDS: SDL: Remove superfluous version checks
The code is already guarded by outer checks.
2024-09-29 17:04:03 +02:00
Le Philousophe
f04f248f20 BACKENDS: SDL: Implement ImGui API to load images 2024-09-29 17:04:03 +02:00
Le Philousophe
2eebb5db02 BACKENDS: SDL: Add SDL2 Renderer support for ImGui
Some adaptations will be needed for the the engines.
2024-09-29 17:04:03 +02:00
Vladimir Serbinenko
488353480f SDL, COMMON: Support screen rotation 2024-09-29 02:10:39 +03:00
Sebastien Ronsse
a9a3f0860f BACKENDS: Add ImGui support to SurfaceSdlGraphicsManager 2024-09-26 07:06:50 +02:00
Donovan Watteau
11b25f3fcf SURFACESDL: Fix -Wcalloc-transposed-args warning from GCC 14.1.0 2024-08-11 18:39:11 +02:00
Simon Delamarre
3454d4988c GRAPHICS: Disable colorKey when applying a mask to a RGB cursor in SurfaceSdl
To apply a mask to a RGB (non-paletted) cursor in SurfaceSdl, we use an
intermediary masked_image, where the pixels made transparent by the mask
are replaced by an ARGB color with alpha = 0 (ARGB 0x00000000 in practice).

However the cursor surface still has a key color attached to it by
SDL_SetColorKey (set to 0 currently), which is not sensitive to the alpha
channel, wrongly making opaque black ARGB 0xFF000000 transparent as well.

So we provide an option to disable the key color in such a case.
2024-07-17 10:57:41 +03:00
Hubert Maier
f06976637a JANITORIAL: Fix receive typo in surfacesdl-graphics.cpp 2024-05-18 13:52:31 +02:00
Eugene Sandulenko
9965ee0c3e
SURFACESDL: Fix crash on specifying gfx mode via command line
`./scummvm -g surfacesdl` was crashing since there is no previous
scaler
2024-04-10 00:14:11 +02:00
Torbjörn Andersson
57893f8d3a SURFACESDL: Refresh cursor scaler along whith standard scaler (bug #14872)
Otherwise, the cursor scaler and standard scaler may be different types,
which can lead to scaling the cursor with a scaler that normally doesn't
allow it. In this particular bug report, it caused ScummVM to crash.
2024-02-11 16:34:39 +01:00
Torbjörn Andersson
13996ea3d1 SURFACESDL: Remove redundant _mouseOrigSurface check
It's already checked a few lines above.
2024-01-28 14:07:33 +01:00
Cameron Cawley
5b1b14ad80 COMMON: Mark more symbols as const 2023-12-26 20:23:59 +01:00
Le Philousophe
e689166a2c BACKENDS: Make screenshots use the Path class 2023-12-24 13:19:25 +01:00
Cameron Cawley
bcc9259382 BACKENDS: Report if the backend supports cursors with alpha channels 2023-10-29 02:02:11 +02:00
Cameron Cawley
a899ee5519 RISCOS: Add support for hardware palettes 2023-10-29 02:02:11 +02:00
Simon Delamarre
9785388f8e GRAPHICS: Fix an incorrect bpp in SurfaceSdl when applying cursor mask
Source bpp is wrongly taken instead of destination bpp, the issue is visible only if the source bpp is != 4.
2023-10-14 10:56:31 +03:00
Cameron Cawley
54423ab73d SURFACESDL: Move the AspectRatio class into the graphics manager class 2023-08-26 01:25:51 +02:00
Cameron Cawley
d8cca29783 BACKENDS: Allow filling part of the screen with OSystem::fillScreen 2023-08-06 23:03:46 +02:00
antoniou79
68c293a004 GUI: Ommit aspect ratio checkbox if this feature is missing
Also fix compilation when building for --disable-aspect (buggy end bracket in backends/graphics/surfacesdl/surfacesdl-graphics.cpp)
2023-06-17 20:21:29 +02:00
Le Philousophe
906a957b4a SURFACESDL: Apply the key color in the cursor margins
This avoids artefacts on borders when using scalers like AdvMame.
This fixes bug #14308
2023-06-04 18:24:06 +02:00
Donovan Watteau
18ab6803d6 JANITORIAL: Fix various "an" typos in comments 2023-03-16 14:47:28 +01:00
Thierry Crozat
9f1528e32f SDL: Fix incorrect handling of dirty rect with negative shake offset in SDL1
Instead of shifting the destination to the left, if was moving the source to
the right, which had the effect of shifting the dirty rect. So part of the
surface that should have been copied to the screen was not, and instead it
was copying part of the surface that did not need to be copied.
2023-03-06 22:16:49 +00:00
Scott Percival
dd43a7d2c4 SURFACESDL: Re-add check for _cursorNeedsRedraw
Partially rolls back a change introduced in
2caa338dbddd9429c766a281231c8fb98701d968; Director relies on the notion
of updateScreen() being near-zero cost if there are no changes.
For example, starting director:henachoco05 went from taking a few
milliseconds to taking 11 seconds, and opening the top menu in
director:easternmind only works on 10% of the screens.
2023-03-06 21:26:28 +01:00
Vladimir Serbinenko
263a6bbb82 SDL: Fix shaking with SDL1 and negative offsets
Current code results in a crash
2023-03-06 01:17:16 +01:00
elasota
325674ace7 GRAPHICS: Add masked cursor support to SurfaceSdl, fix tests 2023-02-19 23:51:09 +01:00
elasota
3db67a33ac GRAPHICS: Add support for pixels with masks and inverted pixels 2023-02-19 23:51:09 +01:00
Cameron Cawley
971148c9bd SURFACESDL: Allow vsync support to be implemented in subclasses with SDL 1.2 2023-02-19 21:27:45 +00:00
Le Philousophe
dc4acb8745 SURFACESDL: Really fix mouse dirty rectangle
Hotspot was not correctly taken into account when it changed.
Calculations are simplified and only done in one place.
2023-02-12 18:28:04 +01:00
Cameron Cawley
2caa338dbd SURFACESDL: Fix calculating the mouse dirty rectangle 2023-02-07 23:44:17 +01:00
Cameron Cawley
ce9d324a72 SURFACESDL: Fix crash when saving screenshots in paletted screen modes 2023-02-07 23:42:42 +01:00
Vladimir Serbinenko
42a5aac407 SURFACESDL: Fix overlay background when using hardware palette 2023-01-20 05:45:37 +03:00
Vladimir Serbinenko
576b2be0cb SDL: Workaround for broken SDL on Miyoo Mini 2023-01-18 00:51:38 +03:00
Vladimir Serbinenko
a0cb2fb05e SURFACESDL: Don't pass private flags to SDL_CreateRGBSurface
sdl_video.h names all of SDL_RLEACCEL, SDL_SRCCOLORKEY and SDL_SRCALPHA
as private and read-only. Documentation mentions them in
SDL_CreateRGBSurface but also says they are automatically set on
either SDL_SetColorKey or on non-zero Amask.

Previously passing them created no problem but miyoo mini SDL gets confused,
so let's never pass the private flags.
2023-01-18 00:51:38 +03:00
Vladimir Serbinenko
1bc4fe5279 SDL: Move RS90-specific code to opendingux directory 2023-01-17 13:48:50 +03:00
Vladimir Serbinenko
81fdd308cf SURFACESDL: Extract initing of graphics surface into a separate method. 2023-01-17 13:48:50 +03:00
Vladimir Serbinenko
4a0d9c2665 SDL: Add missing init of _prevCursorNeedsRedraw 2023-01-17 13:48:20 +03:00
Cameron Cawley
138a983d80 COMMON: Refactor VSync handling to match the other options 2023-01-16 18:09:53 +01:00
Christophe Branchereau
2994ab025d OPENDINGUX: force 320x240 for the RG99
The device has a 320x480 screen and aspect of gui is wrong if we use
the full resolution

Signed-off-by: Christophe Branchereau <cbranchereau@gmail.com>
2023-01-16 10:31:14 +01:00
Vladimir Serbinenko
4e4c652433 SDL: Properly restore gfx mode if several parameters have changed
Currently we have bunch of else-if and only one of them triggered. When
e.g. aspect ratio correction and resolution changes only aspect ratio is
covered by restoration. If this fails the code retries the same mode endlessly
2023-01-12 16:39:38 +03:00
Vladimir Serbinenko
74336c5411 SDL: Fix potential buffer overflow
This causes a segmentation error on Miyoo Mini but is not specific to it
2023-01-12 14:01:45 +01:00
Le Philousophe
4f626159a1 SDL: Delete mouse scaler to avoid memory leak 2023-01-12 08:44:38 +01:00
Vladimir Serbinenko
30d9976a1c SDL: Use hardware palette on RS90 and scale 1 2023-01-12 10:27:20 +03:00
Vladimir Serbinenko
70b174bca5 SDL: Disable fullscreen on RS90
Fullscreen flag causes an error in SetVideoMode.
2023-01-12 10:27:20 +03:00
Vladimir Serbinenko
3f6691dc6d RS90: Workaround for unusual SDL_PixelFormat
SDL_PixelFormat returns 0xff/0xff/0xff as pixel format for paletted HWSURFACE.
2023-01-12 10:27:20 +03:00
Vladimir Serbinenko
b91d873df6 SDL: Support auto-detection of GUI resolution. 2023-01-12 10:27:20 +03:00