Rename hidpi_factor to scale_factor (#1334)
* Rename hidpi_factor to scale_factor * Deprecate WINIT_HIDPI_FACTOR environment variable in favor of WINIT_X11_SCALE_FACTOR * Rename HiDpiFactorChanged to DpiChanged and update docs I'm renaming it to DpiChanged instead of ScaleFactorChanged, since I'd like Winit to expose the raw DPI value at some point in the near future, and DpiChanged is a more apt name for that purpose. * Format * Fix macos and ios again * Fix bad macos rebase
This commit is contained in:
parent
85ea3f1d5d
commit
d29f7f34aa
34 changed files with 252 additions and 248 deletions
|
|
@ -41,7 +41,7 @@ pub fn window_size() -> LogicalSize<f64> {
|
|||
LogicalSize { width, height }
|
||||
}
|
||||
|
||||
pub fn hidpi_factor() -> f64 {
|
||||
pub fn scale_factor() -> f64 {
|
||||
let window = window();
|
||||
window.device_pixel_ratio()
|
||||
}
|
||||
|
|
@ -49,10 +49,10 @@ pub fn hidpi_factor() -> f64 {
|
|||
pub fn set_canvas_size(raw: &CanvasElement, size: Size) {
|
||||
use stdweb::*;
|
||||
|
||||
let hidpi_factor = hidpi_factor();
|
||||
let scale_factor = scale_factor();
|
||||
|
||||
let physical_size = size.to_physical::<u32>(hidpi_factor);
|
||||
let logical_size = size.to_logical::<f64>(hidpi_factor);
|
||||
let physical_size = size.to_physical::<u32>(scale_factor);
|
||||
let logical_size = size.to_logical::<f64>(scale_factor);
|
||||
|
||||
raw.set_width(physical_size.width);
|
||||
raw.set_height(physical_size.height);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue