Commit Graph
35 Commits
Author SHA1 Message Date
Henrik Rydgård 01508a9f38 Merge pull request #22743 from hrydgard/text-drop-shadow
TextDrawer: Soft drop shadow flag, shared with the UI atlas
2026-10-23 13:54:42 +02:00
Henrik RydgårdandClaude Opus 5.5 dea182f1d8 Use one UI drop shadow for text and atlas images, fix Windows build
Text and the SVG button images are mixed on screen, so they now share
UIDropShadowParams (3 UI units of blur, 0.66 intensity, no offset, the
atlas's existing look) instead of the text having its own.

draw_text.cpp included <windows.h> directly, whose min/max macros broke
the std::max calls added here. Include CommonWindows.h instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 12:32:25 +02:00
Henrik RydgårdandClaude Opus 5.5 fcfac13643 Share the drop shadow code between the UI atlas and the text drawer
CompositeDropShadow in Common/Render/DropShadow.cpp blurs a premultiplied
RGBA image's alpha (with an optional offset) and composites the image
over it. The atlas's AddDropShadow and TextDrawer::AddDropShadow are now
thin wrappers that pick the parameters.

The blur scatters only the non-transparent texels, which makes atlas
shadows 3-7x faster than the old gather-with-clamping version. Atlas
output is unchanged apart from rounding (alpha differs by at most 1).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 11:56:24 +02:00
Henrik RydgårdandClaude Opus 5.5 05273d9da3 UI atlas: Rasterize each SVG image separately, in parallel
nanosvg walks every scanline of the target for each visible shape, so
rasterizing the whole SVG and cropping the images out of it cost
shapes * canvas area. Each image is now rasterized into a buffer the size
of its bounding box, from a list of copies of its own shapes, so the
images can be rasterized on the thread pool.

Atlas generation on a Redmi 9A (32-bit) goes from about 165 ms to about
95 ms, and on a desktop from about 10 ms to 6 ms. Parsing the SVG is now
the largest part. The atlas layout is unchanged; a few edge pixels differ
by at most 2/255 from the different subpixel offsets.

Also copy whole rows in Image::copyfrom, and fix a leak of the SVG file
data when parsing fails.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 10:16:31 +02:00
Henrik Rydgård 68a8ba856f Warning fix, delete unused code 2026-01-24 10:43:48 +01:00
刘皓 5716cbd41d Use the libretro VFS interface in libretro builds 2026-01-01 00:24:01 -05:00
Henrik Rydgård d1f6da81cb Add stb_rect_pack library, use it to pack our atlases way faster 2025-11-15 15:26:06 +01:00
Henrik Rydgård 915a88df60 AtlasGen: Separate pack and resolve steps 2025-11-15 15:26:06 +01:00
Henrik Rydgård 55d53bd29a Handle devices with really extreme DPIs. Fixes #21001
I thought I did this already but apparently not, or it got lost in a
branch.
2025-11-15 15:26:06 +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 56d3dae334 Avoid regenerating the UI Atlas if unnecessary (faster resize) 2025-11-06 23:44:55 +01:00
Henrik Rydgård e37c0cbef3 Introduce SimpleBaseDialogScreen, TabbedBaseDialogScreen's simpler cousin 2025-10-29 08:39:59 +01:00
Henrik Rydgård 2bc2d9c6f9 Minor UIAtlas code cleanup 2025-10-21 14:49:55 +02:00
Henrik Rydgård 3ae0057285 UIAtlas: Fix bug when adding 1px border to images (was a no-op by accident) 2025-10-21 11:08:53 +02:00
Henrik Rydgård e5f52854d8 Atlas SVG: Add 1px transparent border to images without shadows, to ensure consistent filtering 2025-10-16 16:45:59 +02:00
Henrik Rydgård 3736702f93 Use the correct blending operator when compositing the drop shadow 2025-10-16 11:07:05 +02:00
Henrik Rydgård c08e48bf82 Only shadow the UI images that are used for line-art in-game buttons. 2025-10-16 11:07:05 +02:00
Henrik Rydgård f0b5209908 Convert all UI atlas images to premultiplied alpha format 2025-10-16 11:07:05 +02:00
Henrik Rydgård 1efd0b95b8 Improve logging of UI atlas generation, don't generate debug png (oops) 2025-09-23 13:40:39 -06:00
Henrik Rydgård 10b0d94940 Remove some redundant code, minor optimization 2025-09-23 11:10:46 -06:00
Henrik Rydgård 27ed337d99 Move more pngs into the images.svg file 2025-09-22 15:24:10 -06:00
Henrik Rydgård 0bb70de3f0 Correct the drop shadow 2025-09-19 11:23:48 -06:00
Henrik Rydgård e03de7b9da Add some quick and dirty drop shadow code. Now the generated images look good! 2025-09-19 10:57:29 -06:00
Henrik Rydgård 74874bb81e Test a multi-shape image 2025-09-19 10:31:51 -06:00
Henrik Rydgård ca2a7c93a0 Make ToAtlasImage a global function instead of a method on ImageDesc 2025-09-18 11:03:50 -06:00
Henrik Rydgård 95703d2d9c Delete "C++ table" output from atlastool 2025-09-18 10:58:27 -06:00
Henrik Rydgård 641fa40d82 Runtime atlas gen: Reorganize, remove global_id 2025-09-17 10:46:08 -06:00
Henrik Rydgård 52f2475353 Remove the LoadImage method (the two users have quite different needs) 2025-09-17 10:37:42 -06:00
Henrik Rydgård 0298536efa Separate images from data in bucketer 2025-09-17 10:28:08 -06:00
Henrik Rydgård d2512817bd checkpoint 2025-09-17 10:10:59 -06:00
Henrik Rydgård 81819642d8 Minor cleanups 2025-09-17 10:01:00 -06:00
Henrik Rydgård 82cf6d7c17 AtlasGen: Remove Effect support 2025-09-17 09:49:54 -06:00
Henrik Rydgård 52c4c31508 Runtime atlas generation 2025-09-17 09:49:54 -06:00
Henrik Rydgård 947ddf865f Extract some duplicated code into a pngSave function 2025-09-15 11:46:54 -06:00
Henrik Rydgård f856beb157 Move a lot of the atlas logic to Common/Render/AtlasGen.cpp/h, code
cleanup
2025-09-12 12:17:11 -06:00