From ff4713c4342611b3bcb95839e8936b09c422d138 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Wed, 24 Sep 2014 07:39:37 +1000 Subject: [PATCH] Change opts to work in screen pixels that are scaled to device pixels. --- components/compositing/compositor.rs | 9 ++++++++- components/util/opts.rs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 7d0acea2dac..d33c634b2b7 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -142,8 +142,15 @@ impl IOCompositor { constellation_chan: ConstellationChan, time_profiler_chan: TimeProfilerChan, memory_profiler_chan: MemoryProfilerChan) -> IOCompositor { + + let scale_factor = match opts.device_pixels_per_px { + Some(device_pixels_per_px) => device_pixels_per_px, + None => ScaleFactor(1.0), + }; + let framebuffer_size = opts.initial_window_size.as_f32() * scale_factor; + let window: Rc = WindowMethods::new(app, opts.output_file.is_none(), - opts.initial_window_size); + framebuffer_size.as_uint()); // Create an initial layer tree. // diff --git a/components/util/opts.rs b/components/util/opts.rs index f243a3a7b00..677adba2592 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -89,7 +89,7 @@ pub struct Opts { pub devtools_server: bool, /// The initial requested size of the window. - pub initial_window_size: TypedSize2D, + pub initial_window_size: TypedSize2D, } fn print_usage(app: &str, opts: &[getopts::OptGroup]) {