Commit graph

239 commits

Author SHA1 Message Date
Admin
695403ef72 xr otw 2026-03-12 15:51:30 +01:00
Sabin Regmi
0c24c0aec4 Clippy Fixes Only (#939)
* clippy fixes on draw

* more clippy fixes

* more clippy fixes

* more small nits
2026-03-12 14:59:41 +01:00
Sabin Regmi
d0e0c08fe9 Optimize font loading and add SharedBytes (#938)
Introduce selective font loading and a SharedBytes abstraction with mmap support to reduce memory and IO overhead when handling fonts.

Key changes:
- Add SharedBytes (with MappedBytes using memmap2) and stats; switch FontData to SharedBytes and update loader/loader tests.
- Platform: add memmap2 dependency (non-wasm), new platform API helpers get_resource_abs_path and get_resource_font_bytes to prefer mmap'ed files and fall back to owned bytes.
- Font family/load changes: ensure_fonts_loaded_for_text and update_font_definitions now accept optional text to load only needed fallback fonts (CJK/emoji) based on text content and resource basename heuristics.
- Avoid eager loading of heavy bundled fallback fonts (LXGWWenKai*, NotoColorEmoji.ttf) when loading all script resources.
- Add env override MAKEPAD_TEXT_ATLAS_SIZE for text atlas size parsing and tests; add related parsing helpers and tests.
- Minor fixes: safer transmute for font_face data slice and several unit tests to validate behavior.

Overall this reduces unnecessary font resource reads/mmap usage and allows tuning text atlas size via environment.
2026-03-11 16:25:35 +01:00
Sabin Regmi
3905ae4d1c Load script resources per-handle (avoid global loads) (#923)
Replace broad cx.load_all_script_resources() calls with a targeted cx.load_script_resource(handle) to only request the specific resource needed. Refactor script resource loading (platform/src/script/res.rs) by extracting load_script_resource_impl(handle, crate_manifests) and exposing load_script_resource(handle); keep load_all_script_resources() by iterating per-handle. Improve wasm handling: resolve web_url per-resource, set explicit error states when missing, and fire async HTTP requests safely. Remove an early call to load_all_script_resources() from web startup. Additional changes: serve precompressed .br files in the local wasm dev server (with COOP/COEP headers when threaded), add wasm-specific font/theme script entries for widgets, and update various callers (draw shaders, widgets, math_view, gltf/view_splat, image) to use the per-handle loader. These changes reduce unnecessary global loads and limit network/file operations to only required resources.
2026-03-06 16:01:07 +01:00
Admin
7742b2def7 move draw svg with turtle 2026-03-04 10:25:19 +01:00
offline-ant
3098478266 turtle: rename BeginTurtle/EndTurtle to BeginClip/EndClip, add push/pop_clip_rect (#907)
Rename AlignEntry::BeginTurtle/EndTurtle to BeginClip/EndClip — these
entries control GPU clip rect stacking, not turtle lifecycle.

Add push_clip_rect/pop_clip_rect to Cx2d: lightweight API for manual
clip rect control without creating a full turtle. The existing
clip_and_shift_align_list pass intersects nested clip rects and writes
draw_clip into draw call instances.

Co-authored-by: ant <ant@offline.click>
2026-03-03 08:53:50 +01:00
offline-ant
aa5b0a9922 text: add letter/word spacing, RTL, features, y_offset, variations to shaper (#908)
Co-authored-by: ant <ant@offline.click>
2026-03-03 08:53:26 +01:00
Admin
6c5f2728a9 cleanup 2026-03-01 23:15:39 +01:00
Admin
daf440ee80 wasm 2026-03-01 20:22:11 +01:00
offline-ant
a4150871e9 Font loading: defer registration to draw-time, add fast-path completeness check (#901)
Move font family registration out of on_custom_apply (script apply time)
and into ensure_fonts_loaded (draw time). This avoids redundant work when
the same FontFamily is applied to hundreds of widgets during a frame.

ensure_fonts_loaded now has a fast path that checks is_font_family_complete()
and returns immediately when all expected members are already registered.
The slow path calls load_all_script_resources() to progress pending loads
before falling back to update_font_definitions().

Other changes:
- FontFamilyDefinition gains expected_member_count to distinguish partial
  from complete registrations.
- set_font_family_definition skips cache eviction when the definition or
  cached family is already equivalent.
- load_font_family now clones the definition instead of removing it,
  allowing re-loads after cache eviction without losing the definition.
- Loader::font_family_definitions and Layouter::loader are now pub(crate)
  to support the completeness query from Fonts.

---

Review observations (not yet addressed):

1. STALE FAMILY ON RE-APPLY (medium risk): If a FontFamily is re-applied
   with different members but the same object index (same family_id), the
   fast path in ensure_fonts_loaded will see the old definition as
   "complete" and never call update_font_definitions with the new members.
   Fix: compare current member handles against stored definition, or set a
   dirty flag in on_custom_apply that forces one refresh.

2. UNNECESSARY LAYOUT CACHE FLUSH (medium risk): Layouter::set_font_family_definition
   unconditionally clears cached_params and cached_results even when
   Loader::set_font_family_definition short-circuits as unchanged. During
   partial-load states ensure_fonts_loaded may call update repeatedly with
   identical partial definitions, flushing the text layout cache each time.
   Fix: propagate a changed bool from Loader and only clear when true.

3. COMPLETENESS IGNORES CACHE-ONLY STATE (low risk): is_font_family_complete
   only checks font_family_definitions, not font_family_cache. If a family
   was already loaded into cache and its definition consumed, completeness
   returns false. The new early-return in set_font_family_definition for
   cache-match mitigates this in practice but the invariant is fragile.
   Fix: also check font_family_cache in is_font_family_complete, or ensure
   definitions are always retained (which this diff partly does by switching
   from remove to get+clone in load_font_family).

Co-authored-by: ant <ant@offline.click>
2026-02-28 10:29:36 +01:00
Admin
7f9b0451bd centralised resource cache 2026-02-27 16:55:05 +01:00
offline-ant
9740c47689 Font optimization: reduce atlas 64MB→4MB, use static data for builtins (#898)
Co-authored-by: ant <ant@offline.click>
2026-02-27 16:39:38 +01:00
Admin
25a1c8f22b add get_color to draw_glyph 2026-02-27 09:39:21 +01:00
Admin
0d720b033a text layout
\
2026-02-26 10:08:22 +01:00
admin
ddebd64601 api 2026-02-25 17:14:39 +01:00
Kevin Boos
7bd65ad570 FIx Icon, improve to support IconRotated, expose geom in draw_svg (#883)
* Fix draw_svg to support a rotated Icon. Add `IconRotated` widget.

Fix icon resource paths in `splash` example

* Expose geometry in draw_svg to make icon/svg rotation more efficient

simplifies the code too
2026-02-25 13:05:14 +01:00
Admin
c8ab367b14 little glitches in script engine 2026-02-24 23:32:56 +01:00
Admin
0aa3533210 network refactor 2026-02-24 14:04:37 +01:00
Admin
582af4b271 splice out a makepad-network crate 2026-02-23 23:21:31 +01:00
Admin
cc31241d4f dropshadows back 2026-02-23 21:09:52 +01:00
Admin
582c675c38 fix windows 2026-02-23 17:22:39 +01:00
Admin
88baa3eff8 sortable drawcalls 2026-02-21 10:05:07 +01:00
Admin
e5cc73cfe6 splats without sort yet 2026-02-21 08:43:52 +01:00
Admin
9468ba8f53 drawcall fixing 2026-02-21 06:50:39 +01:00
Admin
9d86689d07 drawcall ordering and git ui 2026-02-20 15:47:56 +01:00
Admin
0a18aad5f2 build fixups 2026-02-19 18:15:34 +01:00
Admin
46af8eb28b font change 2026-02-19 15:36:56 +01:00
Admin
0e34cca569 fix selection accross items 2026-02-17 21:49:02 +01:00
Admin
da7f681823 fix svg shadows 2026-02-17 21:09:04 +01:00
Admin
9d9b03b72d terminal work/ webp 2026-02-17 18:11:36 +01:00
Admin
3539389693 rounded boxes 2026-02-17 11:38:21 +01:00
Admin
586c1c2cc4 3d charts otw 2026-02-17 10:21:14 +01:00
Admin
c6dd9ff37c instance pbr 2026-02-17 09:52:04 +01:00
Admin
539010e57d instance pbr 2026-02-17 08:27:27 +01:00
Admin
99f46c36ba cleanup 2026-02-17 08:04:42 +01:00
Admin
cda5b963d2 cleanup 2026-02-17 07:47:00 +01:00
Admin
4f187ce1e0 opengl ok 2026-02-16 23:21:59 +01:00
Admin
eff7230231 windows 2026-02-16 22:00:26 +01:00
Admin
68ba80a1aa openGL 2026-02-16 17:19:02 +01:00
Admin
548506cd9c gltf example! 2026-02-16 15:51:24 +01:00
Admin
612defab66 fix warnings 2026-02-16 11:58:51 +01:00
Admin
8fb6cdff83 vulkan vendoring completed 2026-02-16 09:10:27 +01:00
Admin
71bee4562c headless otw 2026-02-15 09:48:28 +01:00
Admin
61a51278ce web almost there 2026-02-14 22:46:32 +01:00
Admin
a58686a4e9 otw 2026-02-14 22:14:26 +01:00
Admin
663c621203 webGL2 2026-02-14 22:07:26 +01:00
Admin
e04d5289a2 windows runs! 2026-02-14 13:43:44 +01:00
Admin
ba356056f1 draw groups 2026-02-13 17:58:20 +01:00
Admin
1facb0a9cb terminal otw 2026-02-13 09:41:16 +01:00
Admin
7faf22b45d add http resources 2026-02-12 20:20:17 +01:00