Harden canvas state isolation for neon HUD and ship rendering#121
Closed
serzel wants to merge 1 commit into
Closed
Harden canvas state isolation for neon HUD and ship rendering#121serzel wants to merge 1 commit into
serzel wants to merge 1 commit into
Conversation
serzel
deleted the
codex/fix-rendering-state-contamination-in-neon.js
branch
February 18, 2026 21:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
shadowColor,shadowBlur,globalCompositeOperation,globalAlpha) from leaking into ship rendering whensave()/restore()nesting is imbalanced.Ship.render()never inherits composite or shadow settings from prior UI draws.Description
resetRenderIsolationState(ctx)andwithNeonIsolation(ctx, draw)tosrc/ui/neon.jsand applied them totubeStroke,neonLine,neonPanel,neonText, andneonBarso every neon draw path explicitly resets state before and after drawing.save()/restore()usages inside neon code with the isolation wrapper and explicit resets to guaranteectx.shadowBlur = 0,ctx.shadowColor = 'rgba(0,0,0,0)',ctx.globalCompositeOperation = 'source-over', andctx.globalAlpha = 1on exit.Ship.render()insrc/entities/Ship.jsto add a localresetRenderState()and to wrap trail, sprite, thrust, and halo sections withtry/finallyblocks and explicit resets so ship drawing begins and ends with a known clean canvas state.Testing
node --check src/ui/neon.jsand it succeeded.node --check src/entities/Ship.jsand it succeeded.net::ERR_EMPTY_RESPONSE, so the visual smoke test did not complete.Codex Task