Skip to content

Fix canvas noise pixel addressing - #109

Open
woolong900 wants to merge 1 commit into
adryfish:148.0.7778.215from
woolong900:fix/canvas-noise-addressing
Open

woolong900 wants to merge 1 commit into
adryfish:148.0.7778.215from
woolong900:fix/canvas-noise-addressing

Conversation

@woolong900

@woolong900 woolong900 commented Nov 10, 2026 •

Copy link
Copy Markdown

Summary

Parenthesize the writable_addr macro arguments so coordinate expressions are evaluated before byte-offset scaling.

Problem

ShuffleSubchannelColorData calls the macro with expressions such as x + 1 and y + 1. Without parentheses, those expand as:

x + 1 * sizeof(T)
y + 1 * stride

instead of:

(x + 1) * sizeof(T)
(y + 1) * stride

This reads misaligned bytes for the right and bottom neighbors, causing solid-color canvas regions to be misclassified as edges and modified.

Validation

A standalone simulation of the patch algorithm produced:

  • before: 2 modified pixels in a solid 16×16 canvas
  • after: 0 modified pixels in a solid 16×16 canvas
  • edge pixels in a non-uniform 64×64 canvas remain modified and differ across seeds

git diff --check also passes.

@woolong900 woolong900 changed the title fix canvas noise pixel addressing Fix canvas noise pixel addressing Nov 10, 2026
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