Commit graph

367 commits

Author SHA1 Message Date
Cameron Cawley
b8f2c0b990 GRAPHICS: Split ScalerPluginObject into two classes 2021-12-09 22:00:32 +01:00
Thierry Crozat
39ba63e5e3 SDL: Fix starting high resolution game with default scale factor 2021-09-08 21:33:37 +01:00
Torbjörn Andersson
67dcd72463
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:53 +02:00
Torbjörn Andersson
df0357d3fa
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:52 +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
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
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
Orgad Shaneh
780c4568c1 GUI: Fix compiler warning
../scummvm/gui/options.cpp: In member function 'virtual void GUI::OptionsDialog::apply()':
../scummvm/gui/options.cpp:647:82: warning: comparison of integer expressions of different signedness: 'uint' {aka 'unsigned int'} and 'int' [-Wsign-compare]
  647 |     else if (scalerPlugins[defaultScaler]->get<ScalerPluginObject>().getFactor() != g_system->getDefaultScaleFactor())
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-06-24 11:34:45 +03:00
Cameron Cawley
ac9980a9dd SDL: Fix the default scale factor for high resolution games 2021-06-23 23:31:49 +01:00
Cameron Cawley
da5d773924 BACKENDS: Add getDefaultScaler and getDefaultScaleFactor to OSystem 2021-06-23 21:29:53 +02:00
Cameron Cawley
7ed5984e2f SDL: Add some validation to setScaler() 2021-06-23 21:29:53 +02:00
Cameron Cawley
0e6b9c2bb6 SDL: Begin refactoring the API for selecting scalers 2021-06-23 21:29:53 +02:00
Martin Gerhardy
5af1192580 BACKENDS: fixed segfault in EventRecorder with buffer out of bounds writes
==3124361== Invalid write of size 8
==3124361==    at 0x483F803: memmove (vg_replace_strmem.c:1270)
==3124361==    by 0x4DBF61: SurfaceSdlGraphicsManager::grabOverlay(void*, int) const (surfacesdl-graphics.cpp:1753)
==3124361==    by 0x482051: ModularGraphicsBackend::grabOverlay(void*, int) (modular-backend.cpp:215)
==3124361==    by 0x434EE1: GUI::ThemeEngine::clearAll() (ThemeEngine.cpp:376)
==3124361==    by 0x40128E: GUI::EventRecorder::preDrawOverlayGui() (EventRecorder.cpp:558)
==3124361==    by 0x481DB2: ModularGraphicsBackend::updateScreen() (modular-backend.cpp:173)
==3124361==    by 0x559967: Graphics::Screen::updateScreen() (screen.cpp:62)
==3124361==    by 0x55991C: Graphics::Screen::update() (screen.cpp:56)
==3124361==    by 0x38AFC7: TwinE::TwineScreen::update() (twine.cpp:126)
==3124361==    by 0x3B8759: TwinE::Screens::adjustPalette(unsigned char, unsigned char, unsigned char, unsigned int const*, int) (screens.cpp:150)
==3124361==    by 0x3B8A89: TwinE::Screens::fadeToPal(unsigned int const*) (screens.cpp:207)
==3124361==    by 0x3B8403: TwinE::Screens::loadImage(int, int, bool) (screens.cpp:80)
==3124361==  Address 0x31453050 is 16 bytes after a block of size 512,000 alloc'd
==3124361==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==3124361==    by 0x55B38C: Graphics::Surface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) (surface.cpp:75)
==3124361==    by 0x551111: Graphics::ManagedSurface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) (managed_surface.cpp:153)
==3124361==    by 0x4352D5: GUI::ThemeEngine::setGraphicsMode(GUI::ThemeEngine::GraphicsMode) (ThemeEngine.cpp:453)
==3124361==    by 0x434A52: GUI::ThemeEngine::init() (ThemeEngine.cpp:324)
==3124361==    by 0x43501B: GUI::ThemeEngine::refresh() (ThemeEngine.cpp:394)
==3124361==    by 0x405780: GUI::GuiManager::screenChange() (gui-manager.cpp:603)
==3124361==    by 0x405C6B: GUI::GuiManager::processEvent(Common::Event const&, GUI::Dialog*) (gui-manager.cpp:677)
==3124361==    by 0x404EBA: GUI::GuiManager::runLoop() (gui-manager.cpp:429)
==3124361==    by 0x3FD847: GUI::Dialog::runModal() (dialog.cpp:77)
==3124361==    by 0x36D747: launcherDialog() (main.cpp:106)
==3124361==    by 0x36FF92: scummvm_main (main.cpp:552)

It looks like the _videoMode.overlayHeight in SurfaceSdlGraphicsManager::grabOverlay and ThemeEngine::_backBuffer::h are somehow out of sync after
starting the game in a different resolution as the gui was started with. So the overlayHeight is updated - but the backbuffer (Surface) is not resized.

This is with event recorder being active - right after starting the game and switching the resolution.
2021-06-19 14:34:52 +02:00
athrxx
ff3d0e83c2 GRAPHICS: fix Edge scaler glitch (bug no. 12553)
Force the creation of a new screen buffer for the scaler after leaving the overlay. The whole "old source" code looks a bit unfinished. Anyway, this fix should only kick in for one particular scaler and one particular situation and one particular backend. So I guess it is safe enough...
2021-05-28 20:26:28 +02:00
Thierry Crozat
bf406f66c0 BACKENDS: SDL: Do not allocate memory in SurfaceSdlGraphicsManager::getSupportedGraphicsModes 2021-05-08 21:58:30 +01:00
Martin Gerhardy
9d82fa51df COMMON: removed USE_TTS check from engines
OSystem now just returns a nullptr if there is no text to speech manager instance
(because none is compiled into the binary, or the system doesn't provide support
for it). This removed the need for the engine authors to add scummvm osystem compile
time options checks into their engine code
2021-05-03 14:13:41 +03:00
SupSuper
60f1fd98aa SDL: Use the window display index when querying display modes 2021-05-01 11:22:22 +03:00
Eugene Sandulenko
5e7fe2dc57
JANITORIAL: Replace spaces in indentation with tabs 2021-04-15 21:20:36 +02:00
Cameron Cawley
24b59ecb4c Revert "OPENGL: Implement high DPI support on Android (#1895)"
This reverts commit 177d709909.
2021-04-12 00:54:12 +01:00
Cameron Cawley
cf511755b0 SDL: Improve graphics mode checks 2021-04-05 20:31:05 +01:00
Thierry Crozat
bcab931115 SDL: Fix crash when switching from OpenGL to another graphics mode
The crash was introduced in commit 12878afc0 and this reverts part
of the changes in that commit.
2021-03-26 00:00:48 +02:00
Cameron Cawley
8aa3e53132 SDL: Replace the use of the normal scaler for the cursor 2021-03-15 16:48:40 +02:00
Cameron Cawley
b596ebf8b8 GRAPHICS: Remove use of gBitFormat from the aspect ratio code 2021-03-15 16:48:40 +02:00
Cameron Cawley
40ee8ae527 SDL: Fix filtering with SDL 1.2 2021-03-15 16:48:40 +02:00
Cameron Cawley
f6c8207684 SDL: Minor cleanup to the aspect ratio code 2021-03-15 16:48:40 +02:00
Cameron Cawley
035f5798c4 SDL: Remove the old graphics mode enum 2021-03-15 16:48:40 +02:00
Cameron Cawley
621c4c2e9e SDL: Fix implementation of getGraphicsModeScale 2021-03-15 16:48:40 +02:00
Cameron Cawley
21c1f0d007 SDL: Restore keyboard shortcuts for switching scalers 2021-03-15 16:48:40 +02:00
Cameron Cawley
4df5e9ed51 SDL: Fix crash with small cursors when using AdvMame4x 2021-03-15 16:48:40 +02:00
Cameron Cawley
99acdb00f9 SDL: Fix crash when switching from OpenGL to Edge3x 2021-03-15 16:48:40 +02:00
Cameron Cawley
e50e010a9e SDL: Fix compilation when building without RGB colour support 2021-03-15 16:48:40 +02:00
Cameron Cawley
12878afc06 SDL: Fix building without scalers 2021-03-15 16:48:40 +02:00
Johannes Schickel
5dc207a386 SDL: Properly handle extra pixels for scalers in showOverlay. 2021-03-15 16:48:40 +02:00
Johannes Schickel
8825c9e3b4 GRAPHICS: Keep destination buffer in SourceScaler instead of SDL backend. 2021-03-15 16:48:40 +02:00
Johannes Schickel
23bee4de30 SDL: Properly look up the normal scaler plugin. 2021-03-15 16:48:40 +02:00
Johannes Schickel
e8d0182cd5 SDL: Take advantage that each ScalerPluginObject can use a scale factor of 1. 2021-03-15 16:48:40 +02:00
Johannes Schickel
b225858e41 GRAPHICS: Let ScalerPluginObject::setFactor return the old factor.
This simplifies things a bit.
2021-03-15 16:48:40 +02:00
Johannes Schickel
ee438bebc2 SDL: Disable more AR related code when USE_ASPECT is not defined. 2021-03-15 16:48:40 +02:00
Cameron Cawley
b78323897d SDL: Fix compilation 2021-03-15 16:48:40 +02:00
Martin T. H. Sandsmark
ab000b6ae3 fix cursor 2021-03-15 16:48:40 +02:00
Martin T. H. Sandsmark
fcff230fe8 fix build 2021-03-15 16:48:40 +02:00
Martin T. H. Sandsmark
f4f9957f85 scalerplugin: port to new plugin api 2021-03-15 16:48:40 +02:00
Eric Culp
39608f391c SDL,GRAPHICS: Add option for AR correction without scalers 2021-03-15 16:48:40 +02:00
Eric Culp
b80c7908fa SDL: Update comments for scaling mouse cursor 2021-03-15 16:48:40 +02:00
Eric Culp
d8240fa734 SDL: Initialize plugins when formats change. 2021-03-15 16:48:40 +02:00
Eric Culp
c7121fae65 SDL: Fix formatting for pointers. 2021-03-15 16:48:40 +02:00
Eric Culp
e35a7c72c0 SDL: Cache default graphics mode upon initialization. 2021-03-15 16:48:40 +02:00
Eric Culp
88363d5d36 SDL: Fix error when USE_SCALERS is undefined 2021-03-15 16:48:40 +02:00