mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Use the --device-pixel-ratio in opt instead of /components/servo/
This commit is contained in:
parent
aa72b8783d
commit
abea15d419
2 changed files with 13 additions and 13 deletions
|
@ -601,8 +601,18 @@ impl Window {
|
|||
self.event_queue.borrow_mut().push(WindowEvent::MouseWindowEventClass(event));
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
match opts::get().device_pixels_per_px {
|
||||
Some(device_pixels_per_px) => TypedScale::new(device_pixels_per_px),
|
||||
None => match opts::get().output_file {
|
||||
Some(_) => TypedScale::new(1.0),
|
||||
None => self.platform_hidpi_factor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn platform_hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window, ..) => {
|
||||
TypedScale::new(window.hidpi_factor())
|
||||
|
@ -614,7 +624,7 @@ impl Window {
|
|||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
fn platform_hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
let hdc = unsafe { user32::GetDC(::std::ptr::null_mut()) };
|
||||
let ppi = unsafe { gdi32::GetDeviceCaps(hdc, winapi::wingdi::LOGPIXELSY) };
|
||||
TypedScale::new(ppi as f32 / 96.0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue