Skip to content

Supersample the static background once per resize - #14

Merged
vaprdev merged 6 commits into
mainfrom
static-supersample
Oct 10, 2026
Merged

vaprdev merged 6 commits into
mainfrom
static-supersample

Conversation

@vaprdev

@vaprdev vaprdev commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Summary

The static background (sky, mountains, ground, still props) is now drawn once per resize at 2× resolution (capped at 600k pixels) and box-filtered down into a Canvas-owned background, then layout() runs again at 1× only for the state scenes need. Static edges are anti-aliased instead of stair-stepped; the per-frame cost doesn't change.

 resize()
-  layout() at 1×  → background
+  layout() at 2×  → box filter → background   (this.px, this.shrink())
+  layout() at 1×  → scene state only

Refinement: lines that the 2× filter thinned out now use thick() so they read as before on cells: the tundra lake cracks and igloo seams, and zen's bridge posts and rail.

Evidence

supersample
supersample 2

Measured against origin/main back to back (every wallpaper and time, teeming, 320×180): scene 2.32 → 2.19 ms per frame; layout() per resize 25 → 56 ms.

Verified: typecheck, build, dev/check.ts --max-ms=60 in octant and quadrant mode (0 failed); screenshots regenerated.

Merge Danger

Door: two-way

Blast Radius: every wallpaper's layout(); resizes cost about 30 ms more.

# Conflicts:
#	src/canvas.ts
#	wallpapers/beach.ts
#	wallpapers/city.ts
#	wallpapers/desert.ts
#	wallpapers/farm.ts
#	wallpapers/jungle.ts
#	wallpapers/prehistoric.ts
#	wallpapers/space.ts
#	wallpapers/template.ts
#	wallpapers/tundra.ts
#	wallpapers/zen.ts
@vaprdev
vaprdev merged commit 1617414 into main Oct 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant