Files
photocraft/perf
Khawar Zamman WaniandFredApps fba5d43a02 Use native Pen cursors to avoid canvas-frame delay (#10860)
* feat(ui-egui): native Pen cursor bitmaps with bounded cache (#9122)

- Render standard Pen cursors (Pen, Freeform Pen, Curvature Pen, Add
  Anchor, Delete Anchor, Convert Point) as OS cursor bitmaps to eliminate
  presentation/canvas frame dependency and tracking latency.
- Preserve exact 8-offset dark outline and white foreground composition,
  native platform scaling, and tool hotspots.
- Implement bounded caching (up to 16 entries) keyed on shape and scale to
  ensure zero re-rasterization on warm pointer movement and rapid tool toggling.
- Preserve precise/crosshair mode, vector close-path cursor state, and painted
  tooltip fallback for unsupported platforms/viewports.
- Add comprehensive regression tests for rasterization, alpha/color fidelity,
  hotspots, lifecycle, and cache bounding.
- Add release benchmark example (cursor_bench) measuring cold rasterization
  and warm movement/cache performance with optional PNG artifact export.
- Retain Pencil painted outline: documented that rigid OS cursor hardware
  planes cannot preserve document pixel grid snapping across fractional
  zoom/scales without continuous drift or per-frame churn.

* fix(ui-egui): correct Pen cursor rasterization, caching, and benchmark (#9122)

- Fix cursor_bench imports to use public tool_cursor::pen with correct frame lifecycle.
- Apply and verify requested native scale per platform in benchmark Context.
- Replace benchmark hardcoded metrics with truthful measured counters and Result error returns.
- Fix Arc::ptr_eq identity checks, unused imports, and Image::from_raw codecs API.
- Add baseline painted fallback measurements to benchmark for real speedup comparisons.
- Keep original single-entry cache for non-Pen shapes and add separately bounded 6-entry Pen cache without whole-cache cloning.
- Preserve fractional-scale logical geometry via subpixel resampling and compensate for OS integer hotspot quantization.
- Add independent comparison test against painted path across scales and backgrounds (light/dark/midgrey).
- Fix Shape::Pen tuple match hazard and doc comments on pen().
- Register cursor_bench in perf/budgets.toml for xtask perf runner integration.

* fix(ui): benchmark cursor preparation inside real egui frames

* feat(ui-egui): visual validation reference, comparison metrics, and contact sheet for native Pen cursors (#9122)

* fix(ui): render cursor reference pairs without duplicate Area ids

* fix(ui): use egui 0.37 frame API in cursor benchmark

* fix(ui): retain rendered cursor textures and restore existing documentation

* fix(ui-egui): restore crisp Pen cursor rasterization and update cursor tests (#9122)

- Eliminate double-resampling blur in Pen cursor rasterization: use direct discrete
  vector glyph rasterization matching the painted fallback without fractional softening.
- Update CapsLock test to assert native OS cursor bitmap and fallback Crosshair for
  Pen tools, validating exact bitmap RGBA, dimensions, and hotspot.
- Add synthetic test proving mathematical equivalence between straight RGBA hardware
  blending and multi-pass painter fallback across dark, midgrey, and light backgrounds.

* test(ui): expect the native bitmap for Precise crosshair cursors

* fix(ui): bound cursor benchmark samples and strengthen bitmap tests

(cherry picked from commit 118c673e5d822742da0a1d99c5aa3a9989b47ff8)

* test(ui): pin cursor percentile rank and glyph-derived hotspots

* test(ui): cover every Pen cursor mapping and per-variant edge samples

---------

Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-05 04:54:22 +01:00
..