Skip to content

chore(deps): the HiDPI stack, and the frame measurement that let it land - #185

Merged
tannevaled merged 0 commit into
mainfrom
test/metric-scale-frame
Aug 16, 2026
Merged

chore(deps): the HiDPI stack, and the frame measurement that let it land#185
tannevaled merged 0 commit into
mainfrom
test/metric-scale-frame

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

window v0.38.0, toolkit v0.163.0, painter v0.11.0 — three layers, each broken under the last:

  • painter took a stroke width and discarded it, so no border could ever be thicker than one pixel (painter#17);
  • the toolkit's SetMetricScale, the documented HiDPI knob, was routed through by ten files out of a hundred and sixty, and Menu/Browser answered only to their own Scale field (toolkit#208, #209);
  • nothing called the knob at all, so a NativeScale window handed the widget tree twice the pixels and told it nothing (window#50).

The measurement this repo owed

The reader threads its own scale through Scene.SetScale and embeds toolkit widgets, so the open question was whether anything would now be scaled twice. TestReaderFrameUnderMetricScale answers it by rendering the same frame at scale 2 with the toolkit told nothing and told 2:

800x600 frame: 804 of 480000 pixels differ (0.17%)
they lie within (425,21)-(774,74), across 54 of 600 rows

One band, one widget's worth of chrome drawing its borders at the size the screen deserves, layout unmoved. A double scale would have moved a large share of the frame — which is what the test now guards, with a deliberately loose bound: it is the difference between "a border got thicker" and "the interface was laid out twice as large", and those are two orders of magnitude apart.

🤖 Generated with Claude Code

@tannevaled
tannevaled merged this pull request into main Aug 16, 2026
12 checks passed
tannevaled added a commit that referenced this pull request Aug 17, 2026
…and (#185)

window v0.38.0, toolkit v0.163.0, painter v0.11.0. Three layers, each broken
under the last:

  - painter took a stroke width and discarded it, so no border could ever be
    thicker than one pixel;
  - the toolkit's SetMetricScale, the documented HiDPI knob, was routed through
    by ten files out of a hundred and sixty, and Menu and Browser answered only
    to their own Scale field;
  - nothing called the knob at all, so a NativeScale window handed the widget
    tree twice the pixels and told it nothing.

The reader threads its own scale through Scene.SetScale AND embeds toolkit
widgets, so the question was whether anything would now be scaled twice. It is
not, and this measures it rather than asserting it: the same frame at scale 2,
rendered with the toolkit told nothing and told 2, differs in 0.17% of its
pixels within one band of 54 rows -- chrome drawing its borders at the size the
screen deserves, layout unmoved. A double scale would have moved a large share
of the frame, two orders of magnitude away from the bound this now guards.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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