1722 Commits

Author SHA1 Message Date
Colin Snover
a5bc89102e ALL: Remove obsolete register keyword
The register keyword was deprecated from the C++11 standard,
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4193.html#809>,
and removed from the C++17 standard,
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4340>, so
cannot exist in a well-formed C++17 program.

It has never done anything in GCC
<https://gcc.gnu.org/ml/gcc/2010-05/msg00113.html>
and because of the way it is specified in the standard, it is “as
meaningful as whitespace”
<http://www.drdobbs.com/keywords-that-arent-or-comments-by-anoth/184403859>.

The one remaining use of the register keyword is in the DS backend,
where it is used to create a local register variable using the
non-standard GCC Extended Asm feature.

Closes gh-1079.
2017-12-03 20:27:42 -06:00
Paul Gilbert
4fbf11db90 GRAPHICS: Fix ManagedSurface clear calls when no surface is set 2017-12-03 13:10:41 -05:00
Colin Snover
076667dc00 COMMON: Add limited support for custom deleters to ScopedPtr
Custom deleters of ScopedPtr are not currently fully conforming to
C++11's support for custom deleters in std::unique_ptr for the
sake of simplicity of implementation. Unlike in the standard
library, plain functions and lvalue references are not supported,
nor may custom deleters be passed to the constructor at runtime.
This can be improved in the future, if necessary, by doing what
standard library implementations usually do and creating a Pair
class that uses the Empty Base Optimization idiom to avoid extra
storage overhead of the deleter instance when it is not needed, as
in typical standard library implementations, plus some additional
type traits to support the necessary metaprogramming for the
different type overloads.
2017-11-18 22:35:12 +01:00
Willem Jan Palenstijn
3ac39075c8 GRAPHICS: Fix potentially uninitialized pointers in BDF loader 2017-11-14 09:12:15 +01:00
Bastien Bouclet
65d0984364 GRAPHICS: Fix freeing invalid pointers in the BDF font destructor
Fixes a crash on exit when using a non default GUI font.
Possibly fixes #10318.
2017-11-14 06:41:06 +01:00
Bastien Bouclet
ce3d5ebec1 GRAPHICS: Fix buffer overflow in drawBevelSquareAlgClip
Port of the fix from 0d8afad55.
2017-11-12 10:38:05 +01:00
Colin Snover
0d8afad559 GRAPHICS: Fix buffer overflow in drawBevelSquareAlg
Thanks to garethbp for discovering the issue and providing a fix.

Fixes Trac#6468.
2017-11-11 20:49:19 -06:00
Colin Snover
51329c0dc6 ALL: Fix misuse of comma operator 2017-11-10 09:57:03 -06:00
Colin Snover
9e9972a55b GRAPHICS: Send blank cursors to graphics backends
Blank cursors don't mean to continue drawing the previous cursor,
they mean that the cursor in the backend needs to be blank.
2017-10-15 13:24:20 -05:00
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
Colin Snover
6e157429b7 BACKENDS: Fix window sizing of games that switch between multiple resolutions 2017-10-07 12:30:29 -05:00
Cameron Cawley
e9aa47f55c GRAPHICS: Compare all fields in a PixelFormat individually instead of using memcmp. 2017-09-11 08:13:09 +02:00
Colin Snover
4706a8486e GRAPHICS: Remove dead code in BDF loadCharacter code 2017-09-10 22:17:17 -05:00
Eugene Sandulenko
4a1a7f965f GRAPHICS: MACGUI: Do not crash when nothing was drawn yet 2017-08-28 19:17:45 +02:00
Eugene Sandulenko
f8284623c4 GRAPHICS: MACGUI: Clear whole surface when resizing
This removes black artifacts when previous text was narrower
2017-08-26 21:34:16 +02:00
Eugene Sandulenko
4783541529 GRAPHICS: MACGUI: Now MacWindowManager processes most of the events, remove filter 2017-08-22 10:26:53 +02:00
Eugene Sandulenko
8458630e50 GRAPHICS: MACGUI: Added support for scrolling with mouse wheel 2017-08-22 10:25:00 +02:00
Eugene Sandulenko
a7dbacb5c3 GRAPHICS: MACGUI: Ignore keys with modifiers in MacTextWindow 2017-08-22 10:25:00 +02:00
Eugene Sandulenko
e13d567eb9 GRAPHICS: MACGUI: Improved debug output in MacFontManager 2017-08-22 10:25:00 +02:00
Eugene Sandulenko
97ed6a2af7 GRAPHICS: MACGUI: Pass command id when creating menu to avoid namespace clashes
This fixes Command menu in WAGE.
2017-08-21 19:40:05 +02:00
Eugene Sandulenko
2689373049 JANITORIAL: Fix spelling error in comment 2017-08-21 10:47:10 +02:00
Eugene Sandulenko
bedbe39087 GRAPHICS: MACGUI: Fix MacTextWindow dragging and resizing 2017-08-18 19:04:37 +02:00
Eugene Sandulenko
bc8b952d71 GRAPHICS: MACGUI: Perform sanity checks before blitting 2017-08-18 10:17:52 +02:00
Eugene Sandulenko
df7bd3033e GRAPHICS: MACGUI: Syncronise internal state when selection is cut 2017-08-15 19:50:07 +02:00
Eugene Sandulenko
b9a7f2c800 GRAPHICS: MACGUI: Fix crash in selection when there is no text found 2017-08-15 19:49:15 +02:00
Eugene Sandulenko
0f0dd88b61 GRAPHICS: MACGUI: Fix MacText::getTextChunk() for multiline selections 2017-08-15 19:48:16 +02:00
Eugene Sandulenko
615af937df GRAPHICS: MACGUI: Initial code for MacTextWindow::cutSelection() 2017-08-14 09:19:41 +02:00
Simei Yin
7ec2fcc7f6 Graphics:: Add multiply blend mode 2017-08-12 08:31:56 +02:00
Simei Yin
7d60ccc463 GRAPHICS: Consider flip mode when handling off-screen clipping 2017-08-12 00:48:47 +02:00
D G Turner
fbd1e87824 GRAPHICS: MACGUI: Fix GCC Compiler Warnings. 2017-08-11 00:56:28 +01:00
Eugene Sandulenko
0e2d14ac41 GRAPHICS: MACGUI: Initial code for Cutting/Paste multiline input texts 2017-08-08 11:25:55 +02:00
Eugene Sandulenko
c5b28a171b GRAPHICS: MACGUI: Do not resize MacTextWindow when not necessary 2017-08-07 13:05:35 +02:00
Eugene Sandulenko
65265d87d7 GRAPHICS: MACGUI: Fix selection visual feedback 2017-08-07 12:28:43 +02:00
Eugene Sandulenko
7896e9572f GRAPHICS: MACGUI: Correctly process revere oneliner selections 2017-08-07 12:18:20 +02:00
Eugene Sandulenko
d51a87a83b GRAPHICS: MACGUI: Correctly expand selection beyond last line 2017-08-07 12:18:20 +02:00
Eugene Sandulenko
abf6abdb65 GRAPHICS: MACGUI: Correctly display last selection line 2017-08-07 12:18:20 +02:00
Eugene Sandulenko
6e690dbca9 GRAPHICS: MACGUI: Do not draw selection in the initial state 2017-08-07 12:18:20 +02:00
Eugene Sandulenko
8b81bb2faa GRAPHICS: MACGUI: Better handling for displaying selection end 2017-08-06 22:43:09 +02:00
Torbjörn Andersson
5602ca3d64 JANITORIAL: Silence some more GCC 7 fallthrough warnings
These weren't explicitly flagged as deliberate, but I recognize
Duff's Device when I see it.
2017-08-06 15:26:44 +02:00
Eugene Sandulenko
86d1b1b050 GRAPHICS: MACGUI: Fix cursor position when MacTextWindow is scrolled 2017-08-06 11:23:23 +02:00
Eugene Sandulenko
9d2ca34ae4 GRAPHICS: MACGUI: Enforce surface cleanup on MacText clearing 2017-08-05 23:55:44 +02:00
Eugene Sandulenko
5091968f4c GRAPHICS: MACGUI: More work on clearing MacTextWindow content 2017-08-05 23:50:45 +02:00
Eugene Sandulenko
75491291f9 GRAPHICS: MACGUI: Made CLIP statemements more useful 2017-08-05 08:12:43 +02:00
D G Turner
81a236ee8f GRAPHICS: MACGUI: Fix GCC Compiler Warnings. 2017-08-05 06:16:22 +01:00
Eugene Sandulenko
58a30b9146 GRAPHICS: MACGUI: Do not crash when window callback is null 2017-08-05 00:24:28 +02:00
Eugene Sandulenko
4fea533dfd GRAPHICS: MACGUI: Added more selection manipulation methods to MacTextWindow 2017-08-05 00:05:44 +02:00
Eugene Sandulenko
dfaadb1763 GRAPHICS: MACGUI: Fix compilation 2017-08-04 21:55:08 +02:00
Eugene Sandulenko
2aac665a2b GRAPHICS: MACGUI: Fix displaying two line text selections 2017-08-04 21:54:20 +02:00
Eugene Sandulenko
1241ada63a GRAPHICS: MACGUI: Fixed bug with column detection in text selection 2017-08-04 21:54:20 +02:00
Eugene Sandulenko
c7f83cd435 GRAPHICS: MACGUI: Fix end line text selection hihglight 2017-08-04 21:54:20 +02:00