Skip to content

Test linear Eyedropper clipboard colors in 32-bit documents - #20205

Open
yoriswind wants to merge 4 commits into
storytold:mainfrom
yoriswind:codex/eyedropper-copy-linear-19719
Open

yoriswind wants to merge 4 commits into
storytold:mainfrom
yoriswind:codex/eyedropper-copy-linear-19719

Conversation

@yoriswind

@yoriswind yoriswind commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Tracks #19719.

The Eyedropper's two clipboard commands use the stored linear components in a 32-bit RGB document. This PR adds regression coverage for that behavior and keeps the current sampling and clipboard implementation.

  • The converted RGB fixture checks gray, orange, and blue at 8, 16, and 32 bits in both Hex Code and HTML.
  • The native Float fixture checks that red above 1.0 is capped at ff in the output while linear green stays 37.

The preceding revision's CI failure reproduced an extra transfer on linear gray: it produced 0a0a0a instead of 373737. The replacement removes that extra transfer from the PR. The resulting diff against Main adds only tests and their registration. Hosted coverage on the replacement revision is pending.

Summary by CodeRabbit

  • Tests
    • Added coverage for Eyedropper color copying across 8-bit, 16-bit, and 32-bit documents, including HDR colors.
    • Verified that copied color codes match each document’s color depth and that HDR values are clamped appropriately in HEX and HTML clipboard text.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Adds Eyedropper tests for HEX and HTML clipboard output across 8-bit, 16-bit, and 32-bit RGB documents. The tests also check that an HDR red channel remains 1.5 while clipboard output is clamped to ff3700.

Changes: Eyedropper clipboard color

Layer / File(s) Summary
Depth and HDR clipboard tests
crates/ui-egui/src/canvas/canvas_tool_menu.rs, crates/ui-egui/src/canvas/eyedropper_copy_hex_32bit_tests.rs
The canvas menu module includes the new test module. The tests check HEX and HTML clipboard output across document depths and verify the HDR value and clamped clipboard color.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: aiongg

Merge Risk: Minimal · up to 32203

This change only adds Eyedropper clipboard tests and has no production behavior change at this head. The tests have not been run here, so a failing assertion in CI is possible, but no actual defect has been established.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive [#19719] Requirement 1 (both Eyedropper copy entries use linear value x 255 in 32-bit documents): Not established. The whole-PR diff of crates/ui-egui/src/canvas/canvas_tool_menu.rs could not be read … Provide readable whole-PR diff or head blobs for canvas_tool_menu.rs and sampling.rs showing that both Eyedropper copy entries (Hex and HTML) call the 32-bit linear clipboard path and that non-F32 depths return the unchanged sample. Provide…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: tests for linear Eyedropper clipboard colors in 32-bit documents. The objectives describe a fix so 32-bit Eyedropper copy uses linear components, and the added tests v…
Out of Scope Changes check Passed The changed files in the whole-PR summary are canvas_tool_menu.rs (test module wiring only, +4/-0 per current summary), sampling.rs (clipboard helper), and eyedropper_copy_hex_32bit_tests.rs (new test…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: tests for linear Eyedropper clipboard colors in 32-bit documents. The objectives describe a fix so 32-bit Eyedropper copy uses linear components, and the added tests verify Hex and HTML clipboard output at 8, 16, and 32 bits, including HDR clamping. The title says 'Test' and omits the behavior change itself. The raw summary lists only test additions, so the title matches the changeset as summarized. It is a reasonable match, though it understates the fix described in the objectives.

Full details: Out of Scope Changes check

Explanation

The changed files in the whole-PR summary are canvas_tool_menu.rs (test module wiring only, +4/-0 per current summary), sampling.rs (clipboard helper), and eyedropper_copy_hex_32bit_tests.rs (new tests). All match the Where list of #19719. The HDR clamping test is covered by the issue, which says HDR values keep today's clamping. The PR description and summary report no docs or parity file edits and no changes to menu rows, labels, or action routing. No unrelated change is demonstrated. The unreadable canvas_tool_menu.rs diff limits this conclusion, but the available evidence shows no out-of-scope change.

Full details: Linked Issues check

Explanation

[#19719] Requirement 1 (both Eyedropper copy entries use linear value x 255 in 32-bit documents): Not established. The whole-PR diff of crates/ui-egui/src/canvas/canvas_tool_menu.rs could not be read because its changed blobs are missing from the checkout. The current PR summary describes this file only as a test module addition (+4/-0). The previous assessment relied on a routing change (+5/-1) in this file, and the current evidence does not show it. The diff of crates/ui-egui/src/canvas/sampling.rs returned empty output, so it does not confirm the clipboard_color helper either. The PR description states that both commands call the new sample path, but that statement is not verified against code. Requirement 2 (8-bit and 16-bit unchanged): the summary says the helper returns the unchanged sample when depth is not F32, but this rests on the same unread sampling.rs code. The test eyedropper_copy_switches_to_linear_components_only_at_32_bits has not run in hosted execution. The raw summary also describes HDR clamping tests (a 1.5 red channel clamped to ff3700) in eyedropper_copy_hex_32bit_tests.rs, which is consistent with the issue, but the test outcomes are unconfirmed.

Resolution

Provide readable whole-PR diff or head blobs for canvas_tool_menu.rs and sampling.rs showing that both Eyedropper copy entries (Hex and HTML) call the 32-bit linear clipboard path and that non-F32 depths return the unchanged sample. Provide the result of the hosted run of eyedropper_copy_switches_to_linear_components_only_at_32_bits, or confirm that it passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f8a4b74 and 32203b1.

Files selected for processing: 2

  • crates/ui-egui/src/canvas/canvas_tool_menu.rs
  • crates/ui-egui/src/canvas/eyedropper_copy_hex_32bit_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@autocraft-bot

autocraft-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

AI-generated review (Opus). Not a maintainer decision.

Blocking problems found:

Blocking: the Eyedropper copy rows now convert 32-bit colours to linear twice. The tree already stores 32-bit documents as linear light. Converting to 32 bits turns grey 128 into about 0.2159, and the engine's depth-change tests check that value. The composite sample used by the menu returns those stored values as they are, because sRGB encoding only happens later, when the canvas is shown. So the copy rows already put 373737 on the clipboard for that grey before this PR. The new conversion decodes the linear value again, so the clipboard gets a much darker colour, and the PR's own test canno…

  • [regression] 32-bit Eyedropper copy converts already-linear samples to linear again (crates/ui-egui/src/canvas/sampling.rs:131): clipboard_color applies srgb_to_linear to the result of composite_color when the document is 32-bit. composite_color calls document.sampleColor, which composites the stored samples without any display encoding. 32-bit documents already hold linear light: change_depth decodes through the sRGB curve when widening to F32 and tags the document linear sRGB (crates/engine…

Reviewed at a6657c7.

Recommendation: fix the blocking problems above before the merge.

@davidmann4

Copy link
Copy Markdown
Contributor

Thank you @yoriswind, this is the right direction. I'm carrying it to the end in #20525 together with the other item, with your commits kept as they are, and fixing the failing test there. Your review is welcome.

@autocraft-bot

autocraft-bot Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Automated message. Not a maintainer decision.

Working. Next on dylanmtaylor's Task Runner.

Started and approved by davidmann4.

Parts:

  • 1 32-bit Eyedropper copy converts already-linear samples to linear again

Details for maintainers: this item

Take actions (reply @autocraftbot <command>): hold

@yoriswind yoriswind changed the title Copy linear Eyedropper colors from 32-bit documents Test linear Eyedropper clipboard colors in 32-bit documents Dec 5, 2026

This branch has not been deployed

No deployments
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.

3 participants