scummvm/graphics
Colin Snover de2bbe3b97 BACKENDS: Refactor OpenGL & SDL graphics backends
This patch refactors the OpenGL and SDL graphics backends,
primarily to unify window scaling and mouse handling, and to
fix coordinate mapping between the ScummVM window and the
virtual game screen when they have different aspect ratios.

Unified code for these two backends has been moved to a new
header-only WindowedGraphicsManager class, so named because it
contains code for managing graphics managers that interact with
a windowing system and render virtual screens within a larger
physical content window.

The biggest behavioral change here is with the coordinate
system mapping:

Previously, mouse offsets were converted by mapping the whole
space within the window as input to the virtual game screen
without maintaining aspect ratio. This was done to prevent
'stickiness' when the mouse cursor was within the window but
outside of the virtual game screen, but it caused noticeable
distortion of mouse movement speed on the axis with blank
space.

Instead of introducing mouse speed distortion to prevent
stickiness, this patch changes coordinate transformation to
show the system cursor when the mouse moves outside of the virtual
game screen when mouse grab is off, or by holding the mouse inside
the virtual game screen (instead of the entire window) when mouse
grab is on.

This patch also improves some other properties of the
GraphicsManager/PaletteManager interfaces:

* Nullipotent operations (getWidth, getHeight, etc.) of the
  PaletteManager/GraphicsManager interfaces are now const
* Methods marked `virtual` but not inherited by any subclass have
  been de-virtualized
* Extra unnecessary calculations of hardware height in
  SurfaceSdlGraphicsManager have been removed
* Methods have been renamed where appropriate for clarity
  (setWindowSize -> handleResize, etc.)
* C++11 support improved with `override` specifier added on
  overridden virtual methods in subclasses (primarily to avoid
  myself accidentally creating new methods in the subclasses
  by changing types/names during refactoring)

Additional refactoring can and should be done at some point to
continue to deduplicate code between the OpenGL and SDL backends.
Since the primary goal here was to improve the coordinate mapping,
full refactoring of these backends was not completed here.
2017-10-15 13:24:20 -05:00
..
fonts GRAPHICS: Remove dead code in BDF loadCharacter code 2017-09-10 22:17:17 -05:00
macgui GRAPHICS: MACGUI: Do not crash when nothing was drawn yet 2017-08-28 19:17:45 +02:00
scaler GRAPHICS: Allow saving thumbnails of 32 bits screens 2016-03-27 14:52:34 +02:00
colormasks.h GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
conversion.cpp GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
conversion.h GRAPHICS: Fix some Doxygen comments that seem wrong. 2014-08-29 03:26:48 +02:00
cursor.h GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
cursorman.cpp Revert "COMMON: Change way the Singleton instances are instantiated" 2017-07-10 21:17:41 +02:00
cursorman.h GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
font.cpp GRAPHICS: Added optional initial line width ot text wrapper 2017-01-29 18:41:07 +01:00
font.h GRAPHICS: Added optional initial line width ot text wrapper 2017-01-29 18:41:07 +01:00
fontman.cpp Revert "COMMON: Change way the Singleton instances are instantiated" 2017-07-10 21:17:41 +02:00
fontman.h GRAPHICS: Fix some Doxygen comments that seem wrong. 2014-08-29 03:26:48 +02:00
maccursor.cpp GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
maccursor.h GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
managed_surface.cpp GRAPHICS: Apply eriktorbjorn's fix for non-origin transBlitFrom calls 2017-02-21 20:41:35 -05:00
managed_surface.h JANITORIAL: Remove more trailing spaces 2016-10-09 15:02:02 +02:00
mode.h BACKENDS: Fix window sizing of games that switch between multiple resolutions 2017-10-07 12:30:29 -05:00
module.mk GRAPHICS: Skeleton of MacTextWindow 2017-07-17 23:45:22 +02:00
nine_patch.cpp GRAPHICS: Fix leak in ninepatch destructor 2016-08-26 12:27:16 +02:00
nine_patch.h GRAPHICS: Fix warnings 2016-08-03 14:41:14 +02:00
palette.h BACKENDS: Refactor OpenGL & SDL graphics backends 2017-10-15 13:24:20 -05:00
pixelformat.cpp GRAPHICS: Include bytesPerPixel in toString representation 2017-05-27 09:39:08 +02:00
pixelformat.h GRAPHICS: Compare all fields in a PixelFormat individually instead of using memcmp. 2017-09-11 08:13:09 +02:00
primitives.cpp GRAPHICS: Correcting think line thickness 2016-08-25 12:25:58 +02:00
primitives.h GRAPHICS: Move generic primitives from WAGE engine 2016-02-14 17:13:03 +01:00
scaler.cpp GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
scaler.h GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
screen.cpp GRAPHICS: Set parameterless Screen constructor to use screen format 2016-03-21 20:12:10 -04:00
screen.h JANITORIAL: Remove more trailing spaces 2016-10-09 15:02:02 +02:00
sjis.cpp GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
sjis.h GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
surface.cpp GRAPHICS: Initialize mask in FllodFill when required 2016-06-14 20:45:09 +02:00
surface.h GRAPHICS: Add possibility to specify Fill maskmode in the constructor 2016-06-14 20:30:24 +02:00
thumbnail.cpp JANITORIAL: Typos detected with lintian & grep 2016-02-15 18:27:02 +01:00
thumbnail.h GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
transform_struct.cpp COMMON: Copy TransparentSurface from Wintermute engine to common code 2014-06-15 15:43:06 +03:00
transform_struct.h Graphics:: Add multiply blend mode 2017-08-12 08:31:56 +02:00
transform_tools.cpp COMMON: Copy TransparentSurface from Wintermute engine to common code 2014-06-15 15:43:06 +03:00
transform_tools.h GRAPHICS: Silence an MSVC warning 2014-10-19 17:03:14 +03:00
transparent_surface.cpp Graphics:: Add multiply blend mode 2017-08-12 08:31:56 +02:00
transparent_surface.h GRAPHICS: Allow nearest neighbor scaling of 1Bpp and 2Bpp TransparentSurfaces 2017-07-06 19:12:36 -05:00
VectorRenderer.cpp GUI: Prepare button to be clipped 2016-07-03 12:14:45 +02:00
VectorRenderer.h GUI: Added transparency to PicWidgets 2016-08-24 16:07:55 +06:00
VectorRendererSpec.cpp JANITORIAL: Silence some more GCC 7 fallthrough warnings 2017-08-06 15:26:44 +02:00
VectorRendererSpec.h GUI: Added transparency to PicWidgets 2016-08-24 16:07:55 +06:00
wincursor.cpp GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
wincursor.h GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
yuv_to_rgb.cpp Revert "COMMON: Change way the Singleton instances are instantiated" 2017-07-10 21:17:41 +02:00
yuv_to_rgb.h GRAPHICS: Cleanup the YUV to RGB usage documentation 2013-06-30 17:56:36 -04:00