Skip to content

Commit

Permalink
Apply my suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed Feb 20, 2025
1 parent 411d79f commit 3ae695b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions masonry/src/core/contexts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,10 +780,17 @@ impl_context_method!(
}
);

// Methods on selected context types.
// Access selected global state information.
impl_context_method!(PaintCtx<'_>, AccessCtx<'_>, {
/// 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.
pub fn get_scale_factor(&self) -> f64 {
self.global_state.scale_factor
}
Expand Down

0 comments on commit 3ae695b

Please sign in to comment.