Commit Graph
131 Commits
Author SHA1 Message Date
Henrik RydgårdandClaude Fable 5.1 8b829b3097 Android: Share one TextRenderer class ref between TextDrawers
Each TextDrawerAndroid took a global ref to the TextRenderer class and
never released it (the release had been commented out as crashing), plus
leaked the local ref it was made from. A TextDrawer is created every time
graphics come up, so that was one of each per resume.

Look the class up once and keep it. Also initialize the method IDs, which
IsReady() read uninitialized if the class was missing, and don't walk into
a null array if renderText throws.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-08 18:54:46 +02:00
Henrik RydgårdandClaude Fable 5.1 2f6bb8d55e Android: Don't leak the activity on recreate, and hand it over safely
registerCallbacks took a new global ref to the activity on every onCreate
without releasing the previous one, and unregisterCallbacks only runs on a
real shutdown. Since rotation and resizing recreate the activity, each of
those leaked the old one, view hierarchy and all.

Releasing it means other threads can no longer use the raw global ref,
which had been copied into AndroidStorage and TextDrawerAndroid and was
read from the emu thread and IO threads. They now take a local ref under a
mutex (Android_GetActivity, and the equivalent inside AndroidStorage for
the shortcut activity's sake), so a call in flight keeps its activity
alive while the UI thread swaps in the new one.

The "no activity" bail is a null check on that local ref rather than a
separate HasActivity() test beforehand. Between such a test and the call
the UI thread can swap the activity out, and we'd hand null to a Java
method that wants a Context. The one remaining HasActivity() caller never
passes the activity on, so it has nothing to race with.

The ContentUri class ref and method IDs are now only looked up once,
instead of leaking a class ref per activity.

Headless and the unit test executable link Common but not app-android.cpp, so
they get a stub for this the same way they already do for getEnv and findClass.
Without it the Android CI build fails at link time, where a normal gradle build
is perfectly happy.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01152igCdjTNhT29qvphPyPC
2026-10-08 18:54:46 +02:00
Henrik Rydgård abb57c620f Adjust some log levels 2026-08-09 22:10:54 +02:00
Henrik Rydgård 8cd7e1b2c0 Delete all support for Qt
Our Qt backend has long been left behind and doesn't even support Vulkan
currently. There would be a lot of work to make it viable, and I don't
think anyone is really interested.

ImGui on SDL will soon fulfill the need for a more classic user interface
with a menu bar on Linux, and on Mac we already have a native UI.
2026-08-08 18:18:28 +02:00
Henrik Rydgård 487195acd1 Likely buildfix for CLANG64 on Windows
Fixes #21850
2026-06-22 18:55:35 +02:00
Henrik Rydgård d101abd35f Have AI fix its own bugs 2026-06-16 11:39:24 +02:00
Henrik Rydgård 2b821037d7 SDL3_ttf work 2026-06-16 11:39:24 +02:00
Henrik Rydgård 8649fec2a6 Turn off color emoji (D2D text rendering) on Windows 7. See #21834 2026-06-15 08:37:09 +02:00
Kevin Reinholz d6060d4b3b Build fixes for clang on FreeBSD 2026-05-31 13:27:45 -07:00
Eric Warmenhoven 42c32db7f5 fix libretro build 2026-05-20 11:00:51 -04:00
Henrik Rydgård b2faec0533 Windows: Restore the GDI-based text drawer, use it if RenderDoc is attached
The D2D-based text renderer requires a D3D11 context, which confuses
RenderDoc (it doesn't permit multiple 3D APIs in the same process).

So, let's restore the old GDI renderer and use it if RenderDoc is attached.

See #21638
2026-05-20 10:25:29 +02:00
Henrik Rydgård 3aa4714ce0 Merge draw_text_win with draw_text_uwp. 2026-05-18 14:11:22 +02:00
Henrik Rydgård a5b110b47e Fix problem with fallback fonts looking too bold 2026-05-16 10:25:04 +02:00
Henrik Rydgård f551ac2d81 Memory handling fixes in draw_text_uwp 2026-05-04 22:34:44 +02:00
Henrik Rydgård 771f2b3fe0 Avoid creating zero-size fonts (seems to be because of an init order problem during app switching) 2026-04-28 22:18:16 +02:00
Henrik Rydgård b02c184829 Add more error checking, correct caret positioning 2026-04-27 21:08:40 +02:00
Henrik Rydgård a147e1644b Apply paranoid error checks in TextDrawerCocoa::MeasureStringInternal 2026-04-27 20:57:28 +02:00
Henrik Rydgård 2b946094a9 Warning fixes 2026-03-10 12:19:27 +01:00
myzhan af7384e8e4 Fix font rendering after window resizing on SDL(linux) 2026-03-05 13:34:38 +08:00
Henrik Rydgård c77f68d005 Some additional fixes in TextDrawerSDL 2026-01-27 20:10:40 +01:00
Henrik Rydgård 24283d3e7f Fix memory leak in TextDrawerSDL (sigh, variable shadowing) 2026-01-27 20:05:24 +01:00
Henrik Rydgård 3c4adc3e66 Fix a number of Android Studio lint warnings, a bad jni return type and an memory leak 2026-01-21 18:43:47 +01:00
Henrik Rydgård 6478f0dcad SDL: Fix measuring of multi-line strings.
Also, a small related optimization on Windows.
2026-01-21 13:57:51 +01:00
Henrik Rydgård cadbe3a2e0 Speedup text rendering on Android slightly, eliminate possible assert 2026-01-02 14:20:20 +01:00
Henrik Rydgård 8724f40c12 DrawText: Clamp strings to sane sizes. 2026-01-01 14:23:57 +01:00
Henrik Rydgård 1ea93e2913 Small refactor of text rect measurement. Add move/resize icons 2025-11-27 11:50:22 +01:00
Henrik Rydgård acd8cf70d0 SDL: Load font from VFS instead of using a file path.
Hopefully helps #21014
2025-11-24 00:55:12 +01:00
Henrik Rydgård 666808fb8c SDL: Correct font size handling 2025-11-23 22:26:32 +01:00
Henrik Rydgård bc17b7c822 iOS buildfix, SDL buildfix 2025-11-23 11:42:43 +01:00
Henrik Rydgård 1ae6d0f9f6 Installer script fix 2025-11-23 11:11:18 +01:00
Henrik Rydgård 8052c15f61 Fix references to the old font files 2025-11-14 10:10:44 +01:00
Henrik Rydgård bc024da16c More tweaks 2025-11-10 16:02:21 +01:00
Henrik Rydgård bf5e524243 Add multi-font support to the final text-rendering backend (SDL_ttf) 2025-11-09 08:52:21 +01:00
Henrik Rydgård 582c2e28ca Same for Qt 2025-11-09 08:52:21 +01:00
Henrik Rydgård 59ab9e5682 Fix font loading in cocoa as well. 2025-11-09 08:52:21 +01:00
Henrik Rydgård 2fce2da709 Apply the font system rework to Android as well 2025-11-09 08:52:21 +01:00
Henrik Rydgård bf5ded9c02 Fix font loading for the UWP backend, although wacky rendering issues remain 2025-11-09 08:52:21 +01:00
Henrik Rydgård 4283e66a12 Font style rework: Windows part 2025-11-09 08:52:21 +01:00
Henrik Rydgård 6d1973edfb Add banners on the top of settings pages, if editing game-specific settings show the icon. 2025-11-09 08:51:41 +01:00
Henrik Rydgård f44e0505ea Fix SDL font rendering
Fixes #20933
2025-10-30 09:40:48 +01:00
Henrik Rydgård 2b6b951f78 Fix alpha in drawtext for RGBA8888 format.
Should fix #20879
2025-10-17 08:57:12 +02:00
Henrik Rydgård b082e94edb Initial work on using premultiplied alpha in the UI 2025-10-16 11:07:05 +02:00
Henrik Rydgård b472eb8b8b Remove a lot of unnecessary string constructors 2025-08-31 15:49:29 +02:00
Henrik Rydgård 654b11cb39 Rework the UWP Xaudio backend a bit too. 2025-06-17 01:16:09 +02:00
Henrik Rydgård 09e067c6e1 Revert "Get rid of remains of support for non-square screen DPIs"
This reverts commit f206ed95eb.
2025-05-21 21:41:50 +02:00
Henrik Rydgård fb2ac6475a Mac/ios: Use new font name (oops). Improve error checking when loading cocoa fonts 2025-05-21 14:03:04 +02:00
Henrik Rydgård f2d35d204b SDL text renderer: Add some sanity checks. 2025-04-11 10:58:21 +02:00
Henrik Rydgård 531842f577 Add font cache stats to "internals" screen 2025-04-09 12:40:10 +02:00
Henrik Rydgård 580cd954e0 Fix another carriage-return-related bug in the Android code. 2025-03-29 19:12:32 +01:00
Henrik Rydgård 1bd0ebd600 Code cleanup (remove .c_str()) 2025-03-29 18:48:35 +01:00