Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorPicker: Ignore TextureRect expand mode during legacy picking #97212

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

Riteo
Copy link
Contributor

@Riteo Riteo commented Sep 20, 2024

Fixes #75514

The color picker has a "legacy" fallback mode when FEATURE_SCREEN_CAPTURE is not supported by the current DisplayServer. It works by "freezing" the current view by making a huge Popup with a TextureRect inside covering the screen.

Before this patch, said TextureRect could get cut off if its buffer was nominally bigger than the parent popup, such as when the canvas_items content scale mode is active.

This is because the default TextureRect scaling logic only allows expanding the texture up. EXPAND_IGNORE_SIZE fixes that by allowing the texture to logically "shrink", filling the whole screen independently of the actual buffer size.

Special thanks to @fedyfausto for helping with the diagnosis :D


Note that the preview will be blurrier than the native canvas_items rendering. I think that's because the popup is re-rendering the buffer but I'm not completely sure.

Before After
before after

The color picker has a "legacy" fallback mode when
`FEATURE_SCREEN_CAPTURE` is not supported by the current
`DisplayServer`. It works by "freezing" the current view by making a
huge `Popup` with a `TextureRect` inside covering the screen.

Before this patch, said `TextureRect` could get cut off if its buffer
was nominally bigger than the parent popup, such as when the
`canvas_items` content scale mode is active.

This is because the default TextureRect scaling logic only allows
expanding the texture up. `EXPAND_IGNORE_SIZE` fixes that by allowing
the texture to logically "shrink", filling the whole screen
independently of the actual buffer size.

Special thanks to Federico Fausto Santoro for helping with the diagnosis
:D

Co-Authored-By: Federico Fausto Santoro <[email protected]>
@Riteo Riteo added this to the 4.4 milestone Sep 20, 2024
@Riteo Riteo requested a review from a team as a code owner September 20, 2024 00:58
@akien-mga akien-mga changed the title ColorPicker: ignore TextureRect expand mode during legacy picking ColorPicker: Ignore TextureRect expand mode during legacy picking Sep 20, 2024
@akien-mga akien-mga added the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Sep 20, 2024
@KoBeWi
Copy link
Member

KoBeWi commented Oct 19, 2024

Shouldn't the text be inside the colored rectangle?

@Riteo
Copy link
Contributor Author

Riteo commented Oct 20, 2024

@KoBeWi no idea, that's how it looks on master even when not using any content scale mode IIRC.

@Repiteo Repiteo merged commit 814187d into godotengine:master Oct 25, 2024
19 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 25, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release topic:gui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking on Color Picker zoom in when Stretch Mode is canvas_items (DisplayServer regression)
5 participants