Commit Graph
1719 Commits
Author SHA1 Message Date
Cameron Cawley 7a437e909c COMMON: Move new_strdup to common/str.cpp 2018-08-18 16:30:05 +02:00
Colin Snover f7e05a6ace GRAPHICS: Fix incorrect maximum length passed to strlcpy 2018-08-18 16:30:05 +02:00
Colin Snover c544d8050c GRAPHICS: Remove use of nonstandard strdup API & fix mismatched malloc/delete 2018-08-18 16:30:05 +02:00
Paul Gilbert 11e33ba3fc JANITORIAL: Removing trailing spaces after int casts 2018-08-17 20:30:20 -07:00
Andrei Prykhodko bb995bc871 GRAPHICS: MACGUI: fixed mem leak in MacText 2018-08-05 23:07:55 +03:00
Bastien Bouclet 7362060c47 GRAPHICS: Improve check to test if text fits in the target surface
When rendering text, especially truetype fonts, we would use the next
character avance metric to check if the character fits in the target
surface. This commit changes it to use the bounding box metric. The
bounding box represents the actual pixels that will be touched when
drawing the character.

This fixes an issue noticed on the main menu of Myst ME where the last
character of the string "OPTIONEN" would not be rendered despite there
being enough room to render it. More precisely, this ensures that
calling Font::getBoundingBox for a string, and then passing a surface
exactly the size of the returned bounding box to the draw function
actually renders all the characters.
2018-08-03 22:35:16 +02:00
David Fioramonti bafe22c782 GRAPHICS: Set thumbnail to nullptr when loading the thumbnail is skipped
Since Graphics::loadThumbnail can return successfully when a thumbnail is skipped
the caller may want to check to the see that the thumbnail is not null before using
it. Setting it to null is just defensive in case the caller didn't do so.

If the user tries to use the thumbnail in setThumbnail then it will just
show a black screen for the thumbnail rather than crashing if they have
not set the thumbnail to null.
2018-08-03 14:51:12 +02:00
Ľubomír Remák d9b3853dec COMMON: Fix kerning issue in wordWrapText. 2018-08-02 18:54:13 +02:00
Andrei Prykhodko ed384a0deb GRAPHICS: MACGUI: fixed memory leaks in MacTextWindow 2018-07-30 07:03:00 +03:00
Andrei Prykhodko 75eceedfa5 GRAPHICS: MACGUI: add additional arg to MacTextWindow's constructor to disable cursor handler 2018-07-29 21:23:04 +03:00
Andrei Prykhodko 841e0c11d8 GRAPHICS: MACGUI: fixed SIGSEGV when ptr to menu in MacTextWindow is NULL 2018-07-29 21:23:04 +03:00
Andrei Prykhodko f447ccb390 GRAPHICS: MACGUI: fixed restoring screen 2018-07-26 05:18:04 +03:00
Andrei Prykhodko 6eee64e8fb GRAPHICS: MACGUI: added field initialization 2018-07-26 04:44:20 +03:00
Andrei Prykhodko a961427373 GRAPHICS: MACGUI: fixed memory leak 2018-07-26 04:37:00 +03:00
Eugene Sandulenko c48489f6d2 GRAPHICS: MACGUI: Restore screen on exiting from menu 2018-07-23 14:47:46 +02:00
Andrei Prykhodko f4eda44186 GRAPHICS: MACGUI: fixes for menu parser from win exe 2018-07-22 21:19:02 +03:00
Andrei Prykhodko 62c66bc67a GRAPHICS: MACGUI: added unicode submenu rendering 2018-07-22 20:37:44 +03:00
Andrei Prykhodko 71e933e778 GRAPHICS: MACGUI: fixed engine unpausing after releasing mouse 2018-07-22 20:12:37 +03:00
Andrei Prykhodko 997694b329 GRAPHICS: MACMENU: added missing field initialization 2018-07-22 12:48:15 +03:00
Eugene Sandulenko f515393a74 GRAPHICS: MACGUI: Fix color searching 2018-07-21 12:52:32 +02:00
Eugene Sandulenko 359609353a GRAPHICS: MACGUI: Fix compilation 2018-07-21 12:20:57 +02:00
Andrei Prykhodko 99f458dafa GRAPHICS: MACMENU: added menu parser from Win32 PE executable 2018-07-21 12:16:54 +03:00
Andrei Prykhodko df63dea4b6 GRAPHICS: MACMENU: added partial unicode support
It misses renderSubmenu impl and accelerator rendering
2018-07-21 12:16:54 +03:00
Andrei Prykhodko da34d0dce2 GRAPHICS: MACGUI: moved engine ptr, pause callback to private section 2018-07-20 22:05:46 +03:00
Andrei Prykhodko 8a27ac879e GRAPHICS: MACGUI: added initialization of engine ptr 2018-07-20 22:05:46 +03:00
Andrei Prykhodko e1460103e1 GRAPHICS: MACGUI: added WMModalMenuMode 2018-07-18 21:47:22 +03:00
Eugene Sandulenko 5684134ef6 GRAPHICS: MACGUI: Do not use hardcoded colors 2018-07-12 00:41:11 +02:00
Eugene Sandulenko f2b61dd814 GRAPHICS: MACGUI: Added isMenuActive() helper method 2018-07-11 22:45:36 +02:00
Eugene Sandulenko a14a1230e3 GRAPHICS: MACMENU: Calculate menu bounds after adding static items 2018-07-11 22:45:36 +02:00
Eugene Sandulenko 04dfa9b0a9 GRAPHICS: MACGUI: Made autohiding menu reentrable 2018-07-11 22:45:36 +02:00
Eugene Sandulenko ddfe6c3bce GRAPHICS: MACGUI: Implemented autohide menus 2018-07-11 22:45:36 +02:00
Eugene Sandulenko 2446810378 GRAPHICS: MACGUI: Added possibility to specify WM behaviour 2018-07-11 22:45:36 +02:00
Andrei Prykhodko 973e1e5667 GRAPHICS: fixed creating cursor group from some old executables 2018-07-08 20:20:54 +03:00
David Fioramonti e00881804f GFX: Use degree conversion common math funcs 2018-07-03 23:08:48 +01:00
Thierry Crozat 19d613ee7d GRAPHICS: Remove BOM at start of larryscale files
Note that larryScale_generated.cpp still contains UTF-8
characters, but they are all in comments, so hopefully
they will not cause problems.
2018-06-03 18:41:54 +01:00
Thierry Crozat 4229e2642e Merge pull request #1141 from DanielSWolf/larryscale
SCI: High-quality "LarryScale" cel scaler for LSL7
2018-06-03 17:41:47 +01:00
Adrian Frühwirth a20f90cbb7 JANITORIAL: Fix formatting 2018-04-22 00:56:21 +02:00
Adrian Frühwirth 9bee9e1ba6 JANITORIAL: Fix whitespace 2018-04-19 12:08:31 +02:00
Adrian Frühwirth 3747d852ee JANITORIAL: Fix whitespace 2018-04-15 16:31:31 +02:00
Adrian Frühwirth 00e59a3122 ALL: Load savegame thumbnail only when necessary
This commit introduces the following changes:

1. Graphics::loadThumbnail()

   Now returns a boolean and takes a new argument skipThumbnail which
   defaults to false. In case of true, loadThumbnail() reads past the
   thumbnail data in the input stream instead of actually loading the
   thumbnail. This simplifies savegame handling where, up until now,
   many engines always read the whole savegame metadata (including
   the thumbnail) and then threw away the thumbnail when not needed
   (which is in almost all cases, the most common exception being
   MetaEngine::querySaveMetaInfos() which is responsible for loading
   savegame metadata for displaying it in the GUI launcher.

2. readSavegameHeader()

   Engines which already implement such a method (name varies) now take
   a new argument skipThumbnail (default: true) which is passed
   through to loadThumbnail(). This means that the default case for
   readSavegameHeader() is now _not_ loading the thumbnail from a
   savegame and just reading past it. In those cases, e.g.
   querySaveMetaInfos(), where we actually are interested in loading
   the thumbnail readSavegameHeader() needs to explicitely be called
   with skipThumbnail == false.

   Engines whose readSavegameHeader() (name varies) already takes an
   argument loadThumbnail have been adapted to have a similar
   prototype and semantics.
   I.e. readSaveHeader(in, loadThumbnail, header) now is
   readSaveHeader(in, header, skipThumbnail).

3. Error handling

   Engines which previously did not check the return value of
   readSavegameHeader() (name varies) now do so ensuring that possibly
   broken savegames (be it a broken thumbnail or something else) don't
   make it into the GUI launcher list in the first place.
2018-04-07 09:26:20 +02:00
Adrian Frühwirth d36a9ce672 JANITORIAL: Fix formatting 2018-03-23 20:40:30 +01:00
Bastien Bouclet b272701834 GRAPHICS: Dont clip in the non-clip version of drawRoundedSquareAlg
Fixes missing modern theme GUI dialog borders when using the
non-antialiased renderer.
2018-03-17 16:11:41 +01:00
Daniel Wolf af0434cf09 GRAPHICS: Implement LarryScale cel scaling algorithm 2018-03-16 22:33:06 +01:00
Bastien Bouclet 4d0bb753e4 GUI: Remove the ThemeItem draw queues
Drawing nows happens directly when the Dialog or Widget draw methods are
called. This makes it easy to debug why a particular low level draw
method was called, by inspecting the call stack.

This replaces the notion of "buffering" by two independant ways to
control what is drawn and where:
- The active layer is used to select whether the foreground or
  background part of the dialogs are rendered by the draw calls.
- The active surface is used to select if the draw calls affect the back
  buffer or the screen.

The foreground layer of the active dialog is drawn directly to the
screen. Its background layer is drawn to the back buffer. This way
widgets can restore the back buffer in order to update without having to
redraw the dialog's background.

Dialogs lower in the dialog stack are drawn entirely to the back buffer.
2018-03-12 11:46:04 +01:00
Bastien Bouclet d26aa8255d GRAPHICS: Fix drawing clipped key colored bitmaps
The previous implementation was not clipping the bottom part of the
bitmap.
2018-01-27 18:16:08 +01:00
Bastien Bouclet 482c075747 GRAPHICS: Fix incorrect call to blendFill in drawRoundedSquareShadowClip
Was broken in commit 622adff628.
2017-12-30 19:37:56 +01:00
Bastien Bouclet 622adff628 GRAPHICS: Speed up drawing of rounded square soft shadows
When drawing a rounded rectangle, first its shadow is drawn, and then
the rectangle proper is drawn over it. This optimization skips drawing
a shadow rectangle that is entirely occluded by the main rectangle.

A quick benchmark shows large improvements to the modern theme GUI draw
speed. On a 1 GHz ARMv7 CPU with optimizations enabled, drawing the add
game dialog @ 1920x1080 went from 976 ms to 136 ms.
2017-12-30 19:04:18 +01:00
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