Commit graph

324 commits

Author SHA1 Message Date
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
Eric Culp
f9569ea2ff SDL: Fix formatting 2021-03-15 16:48:40 +02:00
Eric Culp
ee008a44b1 SDL: Formatting fix 2021-03-15 16:48:40 +02:00
Eric Culp
cbf9072e45 SDL: Fix leaks related to graphics modes
supportedGraphicsModes() now returns to OSystem_SDL a pointer to a deep copy of
surfacesdl's internal graphics mode array. Therefore each can free its
own copy without interfering with the other's.
2021-03-15 16:48:40 +02:00
Eric Culp
ab8dd417a9 SDL: Use enableSource() when scaling to the overlay
This fixes an issue where the screen would have little or no changes
and nothing would be drawn to the overlay.
2021-03-15 16:48:40 +02:00
Eric Culp
853d545284 SDL: Make sure normal scaler plugin is initialized
If a game and graphics mode were chosen from the command line, the normal
plugin might not have been loaded and it would crash upon being used to
scale the cursor. Now the normal plugin is initialized with the first
plugin to be initialized.
2021-03-15 16:48:40 +02:00
Eric Culp
a41cd52bbf SDL: Use a simple blit function instead of normal scaler plugin
For places where a blit is needed and no scaling is required, this
function is used instead.
2021-03-15 16:48:40 +02:00
Eric Culp
4c967c5fbc GRAPHICS,SDL: Revision to scaler API
oldSrcScale() is now unified with scale(). Use enableSource(bool enable)
to switch functionality. Partial screen updates are also posible because
of this.

initialize() had its prototype changes although it is functionally the
same.

setSource() no longer has a type parameter, removing support for
multiple source surfaces. They weren't useful anyway.

useOldSrc() was renamed to useOldSource() to conform to the names of
other functions.
2021-03-15 16:48:40 +02:00
Eric Culp
c5c5662330 GRAPHICS,SDL: Change oldSrcScale api
More bookkeeping is kept in common scaler code instead of the backend.
Plugins inheriting SourceScaler will have this functionality.

TODO: Some new functions may still be able to be combined to simplify
the API.
2021-03-15 16:48:40 +02:00
Eric Culp
8baa92a190 SDL: Fix overlay while using oldSrcScale
The _destbuffer was overwriting _hwscreen even when the overlay was
visible.
2021-03-15 16:48:40 +02:00
Eric Culp
6cfba9d567 SDL: Only update if a change was made when using oldSrcScale 2021-03-15 16:48:40 +02:00
Eric Culp
3b408c2d87 SDL: Use an extra buffer for oldSrcScale so it is not confused by AR
If the two source images match, the scaler assumes there is not update
and does not draw to the surface. However, AR correction depends on a
redraw, so the scaler always writes to _destbuffer which is then copied
to _hwscreen to be AR corrected.
2021-03-15 16:48:40 +02:00
Eric Culp
e2484a0fba SDL: Swap and lock the old screen 2021-03-15 16:48:40 +02:00
Eric Culp
cfbc3e91cf SDL: Use oldSrcScale for scaler plugins that support it 2021-03-15 16:48:40 +02:00
Eric Culp
ff6fe4360d SDL: Change so that the Normal plugin is initialized
The plugin is now initially null so that a change is detected.
2021-03-15 16:48:40 +02:00
Eric Culp
a15689ae38 SDL: Fix formatting 2021-03-15 16:48:40 +02:00
Eric Culp
894e8fb187 SDL: Add comments to explain scaler state changes 2021-03-15 16:48:40 +02:00
Eric Culp
dc29ae5447 SDL: Remove old scaler init and destroy code 2021-03-15 16:48:40 +02:00
Eric Culp
044d8aea63 SDL: Fix signedness of some types 2021-03-15 16:48:40 +02:00
Eric Culp
4b29408fb1 SDL: Remove references to old scaler data 2021-03-15 16:48:40 +02:00
Eric Culp
8030b7879c GRAPHICS/SDL: add ifdefs for disabling scalers 2021-03-15 16:48:40 +02:00
Eric Culp
c8bcb3912f SDL/GRAPHICS: remove disableScaling() hack from scaler plugins 2021-03-15 16:48:40 +02:00
Eric Culp
81ca88676c SDL: remove some debugging output 2021-03-15 16:48:40 +02:00
Eric Culp
fe6fb4b597 SDL: cache the list of scaler plugins 2021-03-15 16:48:40 +02:00
Eric Culp
2809ada459 SDL: legacy names for scalers corrected
Old names are recognized and they will be replaced in the new config
2021-03-15 16:48:40 +02:00
Eric Culp
4bdd8860be SDL: remove statically initialized object 2021-03-15 16:48:40 +02:00
Eric Culp
fa3f6321a2 SDL: remove unused variable 2021-03-15 16:48:40 +02:00
Eric Culp
277c9a3a6b SDL: add const to legacy names table 2021-03-15 16:48:40 +02:00
Eric Culp
9091be08ea SDL: fix formatting 2021-03-15 16:48:40 +02:00
Eric Culp
a55f51d01a SDL: add table for old gfxmode strings 2021-03-15 16:48:40 +02:00
Eric Culp
c65e0146dd SDL: remove unused table for cursor scaling 2021-03-15 16:48:40 +02:00
Eric Culp
e6fac85afe SDL: scaler plugins use graphics modes 2021-03-15 16:48:40 +02:00
Eric Culp
a434253f7f SDL: Generate graphics modes from plugins
This currently does not work since the modes are queried before
plugins are loaded.
2021-03-15 16:48:40 +02:00
Eric Culp
64f3e5191a SDL: add convertSDLPixelFormat 2021-03-15 16:48:40 +02:00
Eric Culp
0fe3419349 SDL: cache value of extraPixels() from scaler 2021-03-15 16:48:40 +02:00
Eric Culp
aff49f3e2e SDL: mouse uses scaler plugins 2021-03-15 16:48:40 +02:00
Eric Culp
d350e2c7a8 SDL: use maxExtraPixels from ScalerMan 2021-03-15 16:48:40 +02:00
Eric Culp
f015c0f835 SDL: use correct x and y for scale function 2021-03-15 16:48:40 +02:00
Eric Culp
76d4a5425c SDL: pass correct PixelFormat to scaler initialize 2021-03-15 16:48:40 +02:00
Eric Culp
8c9cb22734 GRAPHICS/SDL/BASE: fix scaler declarations
mainly adding const and using uint instead of int
2021-03-15 16:48:40 +02:00
Eric Culp
9402e2b43f SDL: clarifies code 2021-03-15 16:48:40 +02:00
Eric Culp
e69ec141aa BACKEND: fixes a bug related to AR correction 2021-03-15 16:48:40 +02:00
Eric Culp
bdb12c8733 SDL: add support for additional scaler plugins
This enables scalers to be switched and uses api calls in a way
compatible with more scalers.
2021-03-15 16:48:40 +02:00
Eric Culp
739c75c869 BACKEND: fixes some errors from changing modes 2021-03-15 16:48:40 +02:00