340 Commits

Author SHA1 Message Date
Eugene Sandulenko
1ff6a5538b
GUI: Fix out of bounds access. CID 1519091 2023-09-19 15:46:56 +02:00
Eugene Sandulenko
e555528a42 GUI: Expose theme text colors int ThemeEngine 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
5653eccba4 GUI: Propagate tab vertical flip to the VectorRenderer 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
6d6a7a9b3a GUI: First step to draw tabs on bottom 2023-09-17 00:56:28 +02:00
Eugene Sandulenko
308e2fd340
GUI: Added possibility to disable BDF font scaling
Specify "gui_disable_fixed_font_scaling". The checkbox in the GUI will follow
2023-07-19 15:17:28 +02:00
Eugene Sandulenko
45eb45686a
GUI: Re-enabled BDF font scaling since now the rendering was fixed by elasota 2023-07-08 21:10:19 +02:00
Eugene Sandulenko
0ccbcddb57
GUI: Disable BDF font scaling until it is fixed 2023-07-05 14:00:49 +02:00
Eugene Sandulenko
a18864c646
GUI: Enable scaled BDF fonts 2023-06-26 15:05:51 +02:00
Eugene Sandulenko
96b0274fcc
GUI: Scale fonts for classic theme 2023-06-23 12:08:56 +02:00
Miro Kropacek
09a5e47636 GUI: Add debug outputs for easier profiling 2023-06-10 23:27:57 +02:00
Miro Kropacek
650ccb6ded GUI: Don't assume ManagedSurface's pitch
This caused corruption with small scale's cursor (18px) if
ManagedSurface's inner surface used a different pitch than w *
format.bytesPerPixel.
2023-06-10 23:27:57 +02:00
Miro Kropacek
6fff1690a5 GUI: Don't redraw whole dialog in Widget::setEnabled()
Until now, every (even the tiniest) widget's change of the enabled state
resulted in a redraw of a complete *dialog*. Why this was needed and how
it has been fixed requires a bit of explanation.

There are two buffers to render the widgets in: Backbuffer and Screen
(selected by ThemeEngine::drawToBackbuffer() and
ThemeEngine::drawToScreen() respectively, setting
VectorRenderer::_activeSurface). Then there are two layers/flags:
kDrawLayerBackground and kDrawLayerForeground
(selected in Dialog::drawDialog(), setting ThemeEngine::_layerToDraw).

When asked for a complete dialog rebuild in GuiManager::redraw()
(kRedrawCloseDialog, kRedrawFull) the widgets of every dialog,
regardless of their layer, are drawn into Backbuffer and then copied
into Screen.

When asked for a partial dialog rebuild (kRedrawOpenDialog,
kRedrawTopDialog) the widgets of the topmost dialog marked with
kDrawLayerBackground are drawn into Backbuffer, then copied into Screen
and finally the widgets marked with kDrawLayerForeground are drawn into
Screen *only*.

When redraw() is called just within the GuiManager's event loop the
widgets of the topmost dialog are drawn into Screen *only*. And this is
where the layers become important.

When rebuilding the dialog, it doesn't really matter which layer has
been defined for a widget: Backbuffer contains the ones with
kDrawLayerBackground and Screen will supply the rest with
kDrawLayerForeground, if needed. But which layer is taken into account
when calling Dialog::drawWidgets() ?

It is important to realize that the content of Backbuffer is
defined by the widget's initial state (idle or disabled): so Backbuffer
will contain either "idle color" or "disabled color" after dialog's
creation.

ThemeEngine::drawDD() does two checks:

1. if widget has kDrawLayerBackground set *and* _activeSurface is
  Screen, copy the widget from Backbuffer to Screen

2. if widget's layer is the same as _layerToDraw, draw the widget into
  _activeSurface

This is what happens in redraw(kRedrawDisabled) for kDrawLayerBackground
widgets:

- Backbuffer contains an idle/disabled (depending on its initial state)
  rendition of the widget
- widget is copied from Backbuffer to Screen (1st check in drawDD())
- widget is not drawn into Screen as _layerToDraw is
  kDrawLayerForeground (2nd check in drawDD())

Summary: when switching between idle/disabled state, widget's color is
not updated.

This is what happens in redraw(kRedrawDisabled) for kDrawLayerForeground
widgets:

- Backbuffer contains an idle/disabled (depending on its initial state)
  rendition of the widget
- widget is not copied from Backbuffer to Screen as widget has
  kDrawLayerForeground set (1st check in drawDD())
- widget is drawn into Screen as _layerToDraw is still
  kDrawLayerForeground from the last redraw() (2nd check in drawDD())

Summary: when switching between idle/disabled state, widget's color is
correctly updated and not restored from Backbuffer.

Initially, I set up "button idle" to be rendered in the foreground
layer, same as "button disabled". However @lephilousophe suggested a
great improvement: render "button idle" still in the background but make
"button disabled" its child (in the foreground). Worked like a charm as
it just mimics the hovering behaviour.

And this is why hovering doesn't require scheduleTopDialogRedraw():

- Backbuffer contains an idle [kDrawLayerBackground] rendition of the
  widget
- when highlighted [kDrawLayerForeground], widget is not copied from
  Backbuffer to Screen
- widget is drawn into Screen

Unhovering:

- Backbuffer contains an idle [kDrawLayerBackground] rendition of the
  widget
- when idle [kDrawLayerBackground], widget is copied from Backbuffer to
  Screen
- widget is not drawn into Screen
2023-05-10 22:52:48 +02:00
Cameron Cawley
fb2503d02e GUI: Only use a transparent colour for BMP images 2023-04-09 12:54:38 +02:00
Miro Kropacek
e00c5581ff GUI: Cache bitmaps again
This reverts commit 04f040af which forced a bitmap reloading to prevent
reusing already up/downscaled images in case that _scaleFactor has
changed.

However after commit ad31dfc this no longer applies as changing the
scale factor in GUI forces a ThemeEngine destroy and recreate. So
_bitmaps[filename] is safe to keep its cached image which is reused e.g.
during initial theme loading.
2023-03-16 19:20:50 +01:00
Miro Kropacek
faeb24f037 GRAPHICS: SVGBitmap now inherits from ManagedSurface
Since the only use case for SVGBitmap is blitting it to a
ManagedSurface, combine both into one to avoid unnecessary allocation
and blitting.
2023-03-16 19:20:50 +01:00
Vladimir Serbinenko
ef3eda01e0 GUI: Fix black rectangle around cursor in modern remastered them without RGB
Modern remastered uses cursor with alpha. It's not correctly converted and
so we get black rectangle around it when using --disable-16bit
2023-02-02 19:36:12 +03:00
Vladimir Serbinenko
0fe52aed23 GUI: Support RGB332 for Theme Engine 2023-01-12 10:27:20 +03:00
Cameron Cawley
7f2d9fd0fd GRAPHICS: Split conversion.cpp into multiple files 2022-12-22 23:45:14 +01:00
Eugene Sandulenko
fb7095f5a4
COMMON: Move all compression-related files to a separate directory 2022-12-01 11:53:02 +01:00
BLooperZ
b67b88e6d9 GUI: Support unicode and BiDi in editable widget 2022-08-02 22:04:54 +02:00
grisenti
7b53202a9e ALL: add support for --config and refactor code 2022-05-29 13:56:21 +02:00
grisenti
819f52a14d ALL: add support for --fullscreen command 2022-05-29 13:56:21 +02:00
grisenti
c0acb85605 ALL: add support for --savepath command 2022-05-29 13:56:21 +02:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Torbjörn Andersson
8fe33fdb55 GUI: Fix memory leak 2021-11-15 09:32:36 +01:00
Eugene Sandulenko
a10e36315c
GUI: Improve Group Selection and bump theme version
- Replace inscription with an icon to save space
- Reduced size of the search box
- Disbled grid for low-res layouts
- Fixed classic theme
- Regenerated built-in theme
2021-11-12 23:02:41 +01:00
Eugene Sandulenko
3011084703 GUI: Improve debug output 2021-11-12 14:46:34 +01:00
av-dx
08b442aa76 GUI: Get rid of placeholder for fold indicator 2021-11-12 14:46:34 +01:00
av-dx
777ae61dfa GUI: Restore placeholder symbols for fold indicator
This will be replaced with triangle drawing when #3178 is merged.
2021-11-12 14:46:34 +01:00
av-dx
0480fe5020 GUI: Use triangle fold indicator in GroupedList 2021-11-12 14:46:34 +01:00
av-dx
b348756503 GUI: Add drawFoldIndicator() 2021-11-12 14:46:34 +01:00
av-dx
b554a1a6bc GUI: Made few get functions const 2021-11-12 14:46:34 +01:00
av-dx
e8bee56f9a JANITORIAL: Formatting fixes 2021-11-12 14:46:34 +01:00
av-dx
4bc9c6165c GUI: Add highlight on hover to grid items 2021-11-12 14:46:34 +01:00
av-dx
50611aa60b GUI: Fix transitive clipping behaviour 2021-11-12 14:46:34 +01:00
av-dx
dc878846ee GUI: Create new widgets for the grid system. 2021-11-12 14:46:34 +01:00
av-dx
999c5d2bc6 GUI: Testing grid view with constraints 2021-11-12 14:46:34 +01:00
trembyle
c740f96f63 COMMON: Normalize and document language maintenance
* Add documentation to add or maintain language values
* Fix and reorder existing entries to match ISO standards
2021-11-11 12:06:15 +01:00
Cameron Cawley
b444f53685 GUI: Specify the spacing for checkboxes and radio buttons in the theme files 2021-10-12 23:27:07 +01:00
Thierry Crozat
f3829243a1 GRAPHICS: Remove obsolete genLocalizedFontFilename FontManager
This function supported loading alternative bdf fonts when we were
using 8 bits encodings for the translations. Now that we are using
unicode for all language, this is no longer needed.
2021-10-02 23:50:21 +01:00
Thierry Crozat
6043a4e40c GUI: Remove query of charset in ThemeEngine
This was only used to be part of the name under which loaded TTF
fonts are stored in the FontMan font map. But since all the
languages now use the same charset (UTF-32), there is no longuer
a need to include the charset in the name. We still need to
differentiate between bdf fonts that can only be used for English
and TTF fonts, but this is is the case due to the font size being
included in the name. And otherwise we could just add a hardcoded
"-ttf" in the name.
2021-10-02 23:50:21 +01:00
SupSuper
c9d67e48a9 BACKENDS: Use FSNode::getName in string operations 2021-08-23 21:22:27 +01:00
Thierry Crozat
cbb627a40b COMMON: Change TransMan builtin language to "en" instead of "C" 2021-08-04 19:28:47 +01:00
Thierry Crozat
fe41c9bd7d GUI: Fix loading fonts when translations are disabled
This fixes bug #12737.
The issue is that ThemeEngine::addFont was skipping every font
when translations are disabled, including those for the English
language. Indeed for those the function is called with language
of "*" (since this is what is specified in the theme) and not
an empty string as the implementation assumed.
2021-07-16 21:23:29 +01:00
Le Philousophe
b47e8c6291 Revert "GUI: Amiga compilation fix"
This reverts commit 07ff61ea8d8f4ad11aa9ae519918f159884d9b81.
2021-07-07 19:10:04 +02:00
Paul Gilbert
0136043f09 COMMON: Revert Change Rect and Point to have int32 fields
This reverts commit 1c3e7fb4e9e761b26840ca7dd785e80dfa639f18.
2021-07-06 20:35:42 -07:00
Paul Gilbert
07ff61ea8d GUI: Amiga compilation fix 2021-07-04 19:34:08 -07:00
Paul Gilbert
1c3e7fb4e9 COMMON: Change Rect and Point to have int32 fields 2021-07-04 18:24:26 -07:00
Le Philousophe
e62e9e84d5 GUI: Don't draw text when the rect planned for it is too small
Rect is not valid anymore and we get assertion failures
2021-06-20 11:48:19 +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