feat: Add gallery presets, MultiDisplay support, and viewport tests

- Add ~20 gallery presets covering sources, effects, cameras, displays
- Add MultiDisplay support with --display multi:terminal,pygame syntax
- Fix ViewportFilterStage to recompute layout on viewport_width change
- Add benchmark.py module for hook-based performance testing
- Add viewport resize tests to test_viewport_filter_performance.py
This commit is contained in:
2026-03-17 01:24:15 -07:00
parent 57de835ae0
commit 05d261273e
8 changed files with 453 additions and 128 deletions

View File

@@ -437,8 +437,9 @@ class ViewportFilterStage(Stage):
viewport_width = ctx.params.viewport_width if ctx.params else 80
camera_y = ctx.get("camera_y", 0)
# Recompute layout only when item count changes
if len(data) != self._cached_count:
# Recompute layout when item count OR viewport width changes
cached_width = getattr(self, "_cached_width", None)
if len(data) != self._cached_count or cached_width != viewport_width:
self._layout = []
y = 0
from engine.render.blocks import estimate_block_height
@@ -454,6 +455,7 @@ class ViewportFilterStage(Stage):
self._layout.append((y, h))
y += h
self._cached_count = len(data)
self._cached_width = viewport_width
# Find items visible in [camera_y - buffer, camera_y + viewport_height + buffer]
buffer_zone = viewport_height