fix(desktop): damage rect rounding + debug overlay scale (#195) - #201
Merged
Conversation
Finding 2: trackBoundaryDamage scissor rect used truncate(min) + round-half-up(size), which under-covers by 1px at fractional device scales (1.25x, 1.5x, 1.75x). Use Floor(min)/Ceil(max) independently, matching gg's own Context.trackDamage rounding. Extracted into physicalDamageRect helper for independent testing. Finding 3: dirtyOverlay.draw pre-multiplied coordinates by DeviceScale before passing to Fill/Stroke, which apply deviceMatrix again = double scale (4x on 2x display). Removed pre-multiplication, added Push/Identity/Pop state isolation, and border guard for degenerate rects. 9 new tests covering fractional scales, paint state isolation, and degenerate rects.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Summary
Fixes findings 2 and 3 from #195 (damage rects: logical vs physical pixel mismatches).
Finding 2 (production): scissor rounding
trackBoundaryDamageused truncate+round-half-up-size formula. At fractional scales (1.25x, 1.5x, 1.75x), this under-covers by 1 physical pixel — stale LoadOpLoad seam. Fix:math.Floor/math.Ceilrounding via extractedphysicalDamageRecthelper.Finding 3 (debug overlay): deviceScale²
debug_dirty.gopre-multiplied by scale beforeFill/Strokewhich appliesdeviceMatrixagain = double scale. Fix: removed manual pre-multiplication, added Push/Identity/Pop state isolation.Tests
physicalDamageRecttests (1x, 2x, 1.5x discriminating, 1.25x, 1.75x)Findings 1, 4, 5 from #195 are gg-side — tracked separately.
Test plan
go build ./...— passgo test ./... -count=1— 0 failuresgolangci-lint run --timeout=5m— 0 issues