-
Notifications
You must be signed in to change notification settings - Fork 125
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
Add DPI scale factor to the render root state #872
Conversation
so that it's available to widgets
as it's not called on dpi changes, so will have outdated info
I'll defer to @PoignardAzur, but I am happy to approve in principle, as a stop-gap until we get a more coherent design. (This would also be useful for e.g. Obviously it is true that this value is pretty meaningless for widgets with a transform applied, but that's pretty unavoidable; Transforms are designed to break these kinds of things anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
We're overdue for a coherent, well-documented handling of scaling, and this is a first step towards that.
Since it only causes re-render, so app logic doesn't need it.
let it live in RenderRootState only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your patience. I don't need you to do anything else on this; I'll apply the suggestions and merge tomorrow.
masonry/src/core/contexts.rs
Outdated
// Methods on selected context types. | ||
// Access selected global state information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just remove these comments - they give very little information.
I'll do this tomorrow if this hasn't landed by then.
// Methods on selected context types. | ||
// Access selected global state information. | ||
impl_context_method!(PaintCtx<'_>, AccessCtx<'_>, { | ||
/// Get DPI scaling factor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Get DPI scaling factor. | |
/// Get DPI scaling factor. | |
/// | |
/// This is not required for most widgets, and should be used only for precise | |
/// rendering, such as rendering single pixel lines or selecting image variants. | |
/// This is currently only provided in the render stages, as these are the only passes which | |
/// are re-run when the scale factor changes. | |
/// | |
/// Note that accessibility nodes and paint results will automatically be scaled by Masonry. | |
/// This also doesn't account for the widget's current transform, which cannot currently be | |
/// accessed by widgets directly. |
so that it's available to widgets that can fix blurry lines due to bad overlapping positioning of its internal elements
partially addresses #869