Skip to content

Add paint-time rounded image alpha masks - #9

Merged
wingleeio merged 1 commit into
zeronsh:mainfrom
gaelcado:codex/rounded-image-mask
Sep 14, 2026
Merged

wingleeio merged 1 commit into
zeronsh:mainfrom
gaelcado:codex/rounded-image-mask

Conversation

@gaelcado

@gaelcado gaelcado commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Add an optional paint-time rounded alpha exclusion for fitted images. Moving or resizing the mask reuses the existing image atlas tile instead of rasterizing and uploading a new bitmap.

This supports the composer background in zeronsh/zeron#341, where asynchronous geometry-baked masks could lag sidebar changes and navigation.

Implementation

  • Add ImageAlphaMask and Window::paint_image_fitted_masked, with window-space geometry scaled to device pixels.
  • Apply a rounded-rectangle signed-distance smoothstep feather and optional bottom fade in Metal, WGSL, and HLSL.
  • Preserve source color/alpha, scoped edge fades, cropping, and corner clipping. Existing paint APIs pass no mask and retain their behavior.
  • Rebase on current main, including the Windows edge-fade fix from Fix Windows image rendering and edge fading #7; extend the Windows buffer-layout tests for the new fields.
  • Keep composer-specific dimensions, choreography, and caching policy in the app, not Zui.

Validation

  • All 16 Metal library tests pass, including an offscreen GPU/reference comparison across changing mask geometries, source alpha/color preservation, a single sprite, atlas reuse, and exact restoration when the mask is disabled.
  • WGSL validation and host/shader layout tests pass.
  • The dependent app built and passed 913 UI tests with the local renderer before publication; the app PR will be checked again against the published revision.
  • Scoped formatting and diff checks pass.

Windows HLSL and layout tests are updated but have not run on Windows locally. The standalone GPUI core test target is blocked by missing upstream IBM Plex Sans and Lilex font fixtures. Live app motion has not been re-recorded for this renderer change.

Dependency

The app PR depends on this renderer change. No application setting or protocol migration is introduced here.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@wingleeio wingleeio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking findings. Reviewed mask scaling, the unchanged atlas key/cropping path, default-disabled behavior, Metal/WGSL/HLSL alpha composition, and sprite layout changes. Local validation: gpui_wgpu library tests 27 passed, 2 ignored; all four HLSL host-layout tests passed when extracted unchanged into an independent Linux test harness; scoped formatting and diff checks passed. The GPUI core test target remains blocked by the existing missing IBM Plex Sans and Lilex fixtures. Native Metal and Windows execution was not available in this Linux environment; the Metal GPU/reference regression was inspected but not rerun here.

@wingleeio
wingleeio merged commit aa00941 into zeronsh:main Sep 14, 2026
1 check 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.

2 participants