mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Extract device_pixels_per_px from global opts
This is also an embedder specific option, so removing it from the global options makes sense.
This commit is contained in:
parent
74f1e2ec32
commit
0ee300479e
9 changed files with 67 additions and 36 deletions
|
@ -32,10 +32,6 @@ pub struct Opts {
|
||||||
/// The maximum size of each tile in pixels (`-s`).
|
/// The maximum size of each tile in pixels (`-s`).
|
||||||
pub tile_size: usize,
|
pub tile_size: usize,
|
||||||
|
|
||||||
/// The ratio of device pixels per px at the default scale. If unspecified, will use the
|
|
||||||
/// platform default setting.
|
|
||||||
pub device_pixels_per_px: Option<f32>,
|
|
||||||
|
|
||||||
/// `None` to disable the time profiler or `Some` to enable it with:
|
/// `None` to disable the time profiler or `Some` to enable it with:
|
||||||
///
|
///
|
||||||
/// - an interval in seconds to cause it to produce output on that interval.
|
/// - an interval in seconds to cause it to produce output on that interval.
|
||||||
|
@ -524,7 +520,6 @@ pub fn default_opts() -> Opts {
|
||||||
is_running_problem_test: false,
|
is_running_problem_test: false,
|
||||||
url: None,
|
url: None,
|
||||||
tile_size: 512,
|
tile_size: 512,
|
||||||
device_pixels_per_px: None,
|
|
||||||
time_profiling: None,
|
time_profiling: None,
|
||||||
time_profiler_trace_path: None,
|
time_profiler_trace_path: None,
|
||||||
mem_profiler_period: None,
|
mem_profiler_period: None,
|
||||||
|
@ -587,7 +582,6 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
||||||
opts.optflag("g", "gpu", "GPU painting");
|
opts.optflag("g", "gpu", "GPU painting");
|
||||||
opts.optopt("o", "output", "Output file", "output.png");
|
opts.optopt("o", "output", "Output file", "output.png");
|
||||||
opts.optopt("s", "size", "Size of tiles", "512");
|
opts.optopt("s", "size", "Size of tiles", "512");
|
||||||
opts.optopt("", "device-pixel-ratio", "Device pixels per px", "");
|
|
||||||
opts.optflagopt(
|
opts.optflagopt(
|
||||||
"p",
|
"p",
|
||||||
"profile",
|
"profile",
|
||||||
|
@ -792,15 +786,6 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
||||||
None => 512,
|
None => 512,
|
||||||
};
|
};
|
||||||
|
|
||||||
let device_pixels_per_px = opt_match.opt_str("device-pixel-ratio").map(|dppx_str| {
|
|
||||||
dppx_str.parse().unwrap_or_else(|err| {
|
|
||||||
args_fail(&format!(
|
|
||||||
"Error parsing option: --device-pixel-ratio ({})",
|
|
||||||
err
|
|
||||||
))
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
// If only the flag is present, default to a 5 second period for both profilers
|
// If only the flag is present, default to a 5 second period for both profilers
|
||||||
let time_profiling = if opt_match.opt_present("p") {
|
let time_profiling = if opt_match.opt_present("p") {
|
||||||
match opt_match.opt_str("p") {
|
match opt_match.opt_str("p") {
|
||||||
|
@ -951,7 +936,6 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
||||||
is_running_problem_test: is_running_problem_test,
|
is_running_problem_test: is_running_problem_test,
|
||||||
url: url_opt,
|
url: url_opt,
|
||||||
tile_size: tile_size,
|
tile_size: tile_size,
|
||||||
device_pixels_per_px: device_pixels_per_px,
|
|
||||||
time_profiling: time_profiling,
|
time_profiling: time_profiling,
|
||||||
time_profiler_trace_path: opt_match.opt_str("profiler-trace-path"),
|
time_profiler_trace_path: opt_match.opt_str("profiler-trace-path"),
|
||||||
mem_profiler_period: mem_profiler_period,
|
mem_profiler_period: mem_profiler_period,
|
||||||
|
|
|
@ -464,6 +464,10 @@ pub struct Constellation<Message, LTF, STF> {
|
||||||
|
|
||||||
/// Mechanism to force the compositor to process events.
|
/// Mechanism to force the compositor to process events.
|
||||||
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
||||||
|
|
||||||
|
/// The ratio of device pixels per px at the default scale. If unspecified, will use the
|
||||||
|
/// platform default setting.
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// State needed to construct a constellation.
|
/// State needed to construct a constellation.
|
||||||
|
@ -520,6 +524,10 @@ pub struct InitialConstellationState {
|
||||||
|
|
||||||
/// Mechanism to force the compositor to process events.
|
/// Mechanism to force the compositor to process events.
|
||||||
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
||||||
|
|
||||||
|
/// The ratio of device pixels per px at the default scale. If unspecified, will use the
|
||||||
|
/// platform default setting.
|
||||||
|
pub device_pixels_per_px: Option<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data needed for webdriver
|
/// Data needed for webdriver
|
||||||
|
@ -837,6 +845,7 @@ where
|
||||||
glplayer_threads: state.glplayer_threads,
|
glplayer_threads: state.glplayer_threads,
|
||||||
player_context: state.player_context,
|
player_context: state.player_context,
|
||||||
event_loop_waker: state.event_loop_waker,
|
event_loop_waker: state.event_loop_waker,
|
||||||
|
device_pixels_per_px,
|
||||||
};
|
};
|
||||||
|
|
||||||
constellation.run();
|
constellation.run();
|
||||||
|
@ -1081,6 +1090,7 @@ where
|
||||||
webxr_registry: self.webxr_registry.clone(),
|
webxr_registry: self.webxr_registry.clone(),
|
||||||
player_context: self.player_context.clone(),
|
player_context: self.player_context.clone(),
|
||||||
event_loop_waker: self.event_loop_waker.as_ref().map(|w| (*w).clone_box()),
|
event_loop_waker: self.event_loop_waker.as_ref().map(|w| (*w).clone_box()),
|
||||||
|
device_pixels_per_px: self.device_pixels_per_px,
|
||||||
});
|
});
|
||||||
|
|
||||||
let pipeline = match result {
|
let pipeline = match result {
|
||||||
|
|
|
@ -205,6 +205,10 @@ pub struct InitialPipelineState {
|
||||||
|
|
||||||
/// Mechanism to force the compositor to process events.
|
/// Mechanism to force the compositor to process events.
|
||||||
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
||||||
|
|
||||||
|
/// The ratio of device pixels per px at the default scale. If unspecified, will use the
|
||||||
|
/// platform default setting.
|
||||||
|
pub device_pixels_per_px: Option<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct NewPipeline {
|
pub struct NewPipeline {
|
||||||
|
@ -312,6 +316,7 @@ impl Pipeline {
|
||||||
webvr_chan: state.webvr_chan,
|
webvr_chan: state.webvr_chan,
|
||||||
webxr_registry: state.webxr_registry,
|
webxr_registry: state.webxr_registry,
|
||||||
player_context: state.player_context,
|
player_context: state.player_context,
|
||||||
|
device_pixels_per_px: state.device_pixels_per_px,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Spawn the child process.
|
// Spawn the child process.
|
||||||
|
@ -518,6 +523,7 @@ pub struct UnprivilegedPipelineContent {
|
||||||
webvr_chan: Option<IpcSender<WebVRMsg>>,
|
webvr_chan: Option<IpcSender<WebVRMsg>>,
|
||||||
webxr_registry: webxr_api::Registry,
|
webxr_registry: webxr_api::Registry,
|
||||||
player_context: WindowGLContext,
|
player_context: WindowGLContext,
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnprivilegedPipelineContent {
|
impl UnprivilegedPipelineContent {
|
||||||
|
@ -609,7 +615,7 @@ impl UnprivilegedPipelineContent {
|
||||||
layout_thread_busy_flag.clone(),
|
layout_thread_busy_flag.clone(),
|
||||||
self.opts.load_webfonts_synchronously,
|
self.opts.load_webfonts_synchronously,
|
||||||
self.opts.initial_window_size,
|
self.opts.initial_window_size,
|
||||||
self.opts.device_pixels_per_px,
|
self.device_pixels_per_px,
|
||||||
self.opts.dump_display_list,
|
self.opts.dump_display_list,
|
||||||
self.opts.dump_display_list_json,
|
self.opts.dump_display_list_json,
|
||||||
self.opts.dump_style_tree,
|
self.opts.dump_style_tree,
|
||||||
|
|
|
@ -306,7 +306,11 @@ impl<Window> Servo<Window>
|
||||||
where
|
where
|
||||||
Window: WindowMethods + 'static + ?Sized,
|
Window: WindowMethods + 'static + ?Sized,
|
||||||
{
|
{
|
||||||
pub fn new(mut embedder: Box<dyn EmbedderMethods>, window: Rc<Window>) -> Servo<Window> {
|
pub fn new(
|
||||||
|
mut embedder: Box<dyn EmbedderMethods>,
|
||||||
|
window: Rc<Window>,
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
|
) -> Servo<Window> {
|
||||||
// Global configuration options, parsed from the command line.
|
// Global configuration options, parsed from the command line.
|
||||||
let opts = opts::get();
|
let opts = opts::get();
|
||||||
|
|
||||||
|
@ -551,6 +555,7 @@ where
|
||||||
webvr_constellation_sender,
|
webvr_constellation_sender,
|
||||||
glplayer_threads,
|
glplayer_threads,
|
||||||
event_loop_waker,
|
event_loop_waker,
|
||||||
|
device_pixels_per_px,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Send the constellation's swmanager sender to service worker manager thread
|
// Send the constellation's swmanager sender to service worker manager thread
|
||||||
|
@ -582,7 +587,7 @@ where
|
||||||
opts.is_running_problem_test,
|
opts.is_running_problem_test,
|
||||||
opts.exit_after_load,
|
opts.exit_after_load,
|
||||||
opts.convert_mouse_to_touch,
|
opts.convert_mouse_to_touch,
|
||||||
opts.device_pixels_per_px,
|
device_pixels_per_px,
|
||||||
);
|
);
|
||||||
|
|
||||||
Servo {
|
Servo {
|
||||||
|
@ -870,6 +875,7 @@ fn create_constellation(
|
||||||
webvr_constellation_sender: Option<Sender<Sender<ConstellationMsg>>>,
|
webvr_constellation_sender: Option<Sender<Sender<ConstellationMsg>>>,
|
||||||
glplayer_threads: Option<GLPlayerThreads>,
|
glplayer_threads: Option<GLPlayerThreads>,
|
||||||
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
) -> (Sender<ConstellationMsg>, SWManagerSenders) {
|
) -> (Sender<ConstellationMsg>, SWManagerSenders) {
|
||||||
// Global configuration options, parsed from the command line.
|
// Global configuration options, parsed from the command line.
|
||||||
let opts = opts::get();
|
let opts = opts::get();
|
||||||
|
@ -912,6 +918,7 @@ fn create_constellation(
|
||||||
glplayer_threads,
|
glplayer_threads,
|
||||||
player_context,
|
player_context,
|
||||||
event_loop_waker,
|
event_loop_waker,
|
||||||
|
device_pixels_per_px,
|
||||||
};
|
};
|
||||||
let (constellation_chan, from_swmanager_sender) = Constellation::<
|
let (constellation_chan, from_swmanager_sender) = Constellation::<
|
||||||
script_layout_interface::message::Msg,
|
script_layout_interface::message::Msg,
|
||||||
|
@ -920,7 +927,7 @@ fn create_constellation(
|
||||||
>::start(
|
>::start(
|
||||||
initial_state,
|
initial_state,
|
||||||
opts.initial_window_size,
|
opts.initial_window_size,
|
||||||
opts.device_pixels_per_px,
|
device_pixels_per_px,
|
||||||
opts.random_pipeline_closure_probability,
|
opts.random_pipeline_closure_probability,
|
||||||
opts.random_pipeline_closure_seed,
|
opts.random_pipeline_closure_seed,
|
||||||
opts.is_running_problem_test,
|
opts.is_running_problem_test,
|
||||||
|
|
|
@ -34,12 +34,18 @@ pub struct App {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
pub fn run(angle: bool, enable_vsync: bool, use_msaa: bool, no_native_titlebar: bool) {
|
pub fn run(
|
||||||
|
angle: bool,
|
||||||
|
enable_vsync: bool,
|
||||||
|
use_msaa: bool,
|
||||||
|
no_native_titlebar: bool,
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
|
) {
|
||||||
let events_loop = EventsLoop::new(opts::get().headless);
|
let events_loop = EventsLoop::new(opts::get().headless);
|
||||||
|
|
||||||
// Implements window methods, used by compositor.
|
// Implements window methods, used by compositor.
|
||||||
let window = if opts::get().headless {
|
let window = if opts::get().headless {
|
||||||
headless_window::Window::new(opts::get().initial_window_size)
|
headless_window::Window::new(opts::get().initial_window_size, device_pixels_per_px)
|
||||||
} else {
|
} else {
|
||||||
Rc::new(headed_window::Window::new(
|
Rc::new(headed_window::Window::new(
|
||||||
opts::get().initial_window_size,
|
opts::get().initial_window_size,
|
||||||
|
@ -49,6 +55,7 @@ impl App {
|
||||||
enable_vsync,
|
enable_vsync,
|
||||||
use_msaa,
|
use_msaa,
|
||||||
no_native_titlebar,
|
no_native_titlebar,
|
||||||
|
device_pixels_per_px,
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +70,7 @@ impl App {
|
||||||
// Handle browser state.
|
// Handle browser state.
|
||||||
let browser = Browser::new(window.clone());
|
let browser = Browser::new(window.clone());
|
||||||
|
|
||||||
let mut servo = Servo::new(embedder, window.clone());
|
let mut servo = Servo::new(embedder, window.clone(), device_pixels_per_px);
|
||||||
let browser_id = BrowserId::new();
|
let browser_id = BrowserId::new();
|
||||||
servo.handle_events(vec![WindowEvent::NewBrowser(get_default_url(), browser_id)]);
|
servo.handle_events(vec![WindowEvent::NewBrowser(get_default_url(), browser_id)]);
|
||||||
servo.setup_logging();
|
servo.setup_logging();
|
||||||
|
|
|
@ -75,6 +75,7 @@ pub struct Window {
|
||||||
enable_vsync: bool,
|
enable_vsync: bool,
|
||||||
use_msaa: bool,
|
use_msaa: bool,
|
||||||
no_native_titlebar: bool,
|
no_native_titlebar: bool,
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
@ -98,6 +99,7 @@ impl Window {
|
||||||
enable_vsync: bool,
|
enable_vsync: bool,
|
||||||
use_msaa: bool,
|
use_msaa: bool,
|
||||||
no_native_titlebar: bool,
|
no_native_titlebar: bool,
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
) -> Window {
|
) -> Window {
|
||||||
let opts = opts::get();
|
let opts = opts::get();
|
||||||
|
|
||||||
|
@ -210,6 +212,7 @@ impl Window {
|
||||||
enable_vsync,
|
enable_vsync,
|
||||||
use_msaa,
|
use_msaa,
|
||||||
no_native_titlebar,
|
no_native_titlebar,
|
||||||
|
device_pixels_per_px,
|
||||||
};
|
};
|
||||||
|
|
||||||
window.present();
|
window.present();
|
||||||
|
@ -329,7 +332,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn servo_hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> {
|
fn servo_hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||||
match opts::get().device_pixels_per_px {
|
match self.device_pixels_per_px {
|
||||||
Some(device_pixels_per_px) => Scale::new(device_pixels_per_px),
|
Some(device_pixels_per_px) => Scale::new(device_pixels_per_px),
|
||||||
_ => match opts::get().output_file {
|
_ => match opts::get().output_file {
|
||||||
Some(_) => Scale::new(1.0),
|
Some(_) => Scale::new(1.0),
|
||||||
|
@ -561,6 +564,7 @@ impl webxr::glwindow::GlWindow for Window {
|
||||||
self.enable_vsync,
|
self.enable_vsync,
|
||||||
self.use_msaa,
|
self.use_msaa,
|
||||||
self.no_native_titlebar,
|
self.no_native_titlebar,
|
||||||
|
self.device_pixels_per_px,
|
||||||
));
|
));
|
||||||
app::register_window(window.clone());
|
app::register_window(window.clone());
|
||||||
Ok(window)
|
Ok(window)
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
//! A headless window implementation.
|
//! A headless window implementation.
|
||||||
|
|
||||||
use crate::window_trait::WindowPortsMethods;
|
use crate::window_trait::WindowPortsMethods;
|
||||||
use glutin;
|
|
||||||
use euclid::{default::Size2D as UntypedSize2D, Point2D, Rotation3D, Scale, Size2D, UnknownUnit};
|
use euclid::{default::Size2D as UntypedSize2D, Point2D, Rotation3D, Scale, Size2D, UnknownUnit};
|
||||||
use gleam::gl;
|
use gleam::gl;
|
||||||
|
use glutin;
|
||||||
use servo::compositing::windowing::{AnimationState, WindowEvent};
|
use servo::compositing::windowing::{AnimationState, WindowEvent};
|
||||||
use servo::compositing::windowing::{EmbedderCoordinates, WindowMethods};
|
use servo::compositing::windowing::{EmbedderCoordinates, WindowMethods};
|
||||||
use servo::servo_config::opts;
|
|
||||||
use servo::servo_geometry::DeviceIndependentPixel;
|
use servo::servo_geometry::DeviceIndependentPixel;
|
||||||
use servo::style_traits::DevicePixel;
|
use servo::style_traits::DevicePixel;
|
||||||
use servo::webrender_api::units::{DeviceIntRect, DeviceIntSize};
|
use servo::webrender_api::units::{DeviceIntRect, DeviceIntSize};
|
||||||
|
@ -92,10 +91,14 @@ pub struct Window {
|
||||||
animation_state: Cell<AnimationState>,
|
animation_state: Cell<AnimationState>,
|
||||||
fullscreen: Cell<bool>,
|
fullscreen: Cell<bool>,
|
||||||
gl: Rc<dyn gl::Gl>,
|
gl: Rc<dyn gl::Gl>,
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
pub fn new(size: Size2D<u32, DeviceIndependentPixel>) -> Rc<dyn WindowPortsMethods> {
|
pub fn new(
|
||||||
|
size: Size2D<u32, DeviceIndependentPixel>,
|
||||||
|
device_pixels_per_px: Option<f32>,
|
||||||
|
) -> Rc<dyn WindowPortsMethods> {
|
||||||
let context = HeadlessContext::new(size.width, size.height, None);
|
let context = HeadlessContext::new(size.width, size.height, None);
|
||||||
let gl = unsafe { gl::GlFns::load_with(|s| HeadlessContext::get_proc_address(s)) };
|
let gl = unsafe { gl::GlFns::load_with(|s| HeadlessContext::get_proc_address(s)) };
|
||||||
|
|
||||||
|
@ -110,13 +113,14 @@ impl Window {
|
||||||
gl,
|
gl,
|
||||||
animation_state: Cell::new(AnimationState::Idle),
|
animation_state: Cell::new(AnimationState::Idle),
|
||||||
fullscreen: Cell::new(false),
|
fullscreen: Cell::new(false),
|
||||||
|
device_pixels_per_px,
|
||||||
};
|
};
|
||||||
|
|
||||||
Rc::new(window)
|
Rc::new(window)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn servo_hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> {
|
fn servo_hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||||
match opts::get().device_pixels_per_px {
|
match self.device_pixels_per_px {
|
||||||
Some(device_pixels_per_px) => Scale::new(device_pixels_per_px),
|
Some(device_pixels_per_px) => Scale::new(device_pixels_per_px),
|
||||||
_ => Scale::new(1.0),
|
_ => Scale::new(1.0),
|
||||||
}
|
}
|
||||||
|
@ -133,9 +137,7 @@ impl WindowPortsMethods for Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn id(&self) -> glutin::WindowId {
|
fn id(&self) -> glutin::WindowId {
|
||||||
unsafe {
|
unsafe { glutin::WindowId::dummy() }
|
||||||
glutin::WindowId::dummy()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn page_height(&self) -> f32 {
|
fn page_height(&self) -> f32 {
|
||||||
|
@ -167,8 +169,7 @@ impl WindowMethods for Window {
|
||||||
|
|
||||||
fn get_coordinates(&self) -> EmbedderCoordinates {
|
fn get_coordinates(&self) -> EmbedderCoordinates {
|
||||||
let dpr = self.servo_hidpi_factor();
|
let dpr = self.servo_hidpi_factor();
|
||||||
let size =
|
let size = (Size2D::new(self.context.width, self.context.height).to_f32() * dpr).to_i32();
|
||||||
(Size2D::new(self.context.width, self.context.height).to_f32() * dpr).to_i32();
|
|
||||||
let viewport = DeviceIntRect::new(Point2D::zero(), size);
|
let viewport = DeviceIntRect::new(Point2D::zero(), size);
|
||||||
let framebuffer = DeviceIntSize::from_untyped(size.to_untyped());
|
let framebuffer = DeviceIntSize::from_untyped(size.to_untyped());
|
||||||
EmbedderCoordinates {
|
EmbedderCoordinates {
|
||||||
|
@ -223,7 +224,10 @@ impl webxr::glwindow::GlWindow for Window {
|
||||||
fn swap_buffers(&self) {}
|
fn swap_buffers(&self) {}
|
||||||
fn size(&self) -> UntypedSize2D<gl::GLsizei> {
|
fn size(&self) -> UntypedSize2D<gl::GLsizei> {
|
||||||
let dpr = self.servo_hidpi_factor().get();
|
let dpr = self.servo_hidpi_factor().get();
|
||||||
Size2D::new((self.context.width as f32 * dpr) as gl::GLsizei, (self.context.height as f32 * dpr) as gl::GLsizei)
|
Size2D::new(
|
||||||
|
(self.context.width as f32 * dpr) as gl::GLsizei,
|
||||||
|
(self.context.height as f32 * dpr) as gl::GLsizei,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fn new_window(&self) -> Result<Rc<dyn webxr::glwindow::GlWindow>, ()> {
|
fn new_window(&self) -> Result<Rc<dyn webxr::glwindow::GlWindow>, ()> {
|
||||||
let width = self.context.width;
|
let width = self.context.width;
|
||||||
|
@ -236,6 +240,7 @@ impl webxr::glwindow::GlWindow for Window {
|
||||||
gl,
|
gl,
|
||||||
animation_state: Cell::new(AnimationState::Idle),
|
animation_state: Cell::new(AnimationState::Idle),
|
||||||
fullscreen: Cell::new(false),
|
fullscreen: Cell::new(false),
|
||||||
|
device_pixels_per_px: self.device_pixels_per_px,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
fn get_rotation(&self) -> Rotation3D<f32, UnknownUnit, UnknownUnit> {
|
fn get_rotation(&self) -> Rotation3D<f32, UnknownUnit, UnknownUnit> {
|
||||||
|
|
|
@ -96,6 +96,7 @@ pub fn main() {
|
||||||
);
|
);
|
||||||
opts.optflag("", "msaa", "Use multisample antialiasing in WebRender.");
|
opts.optflag("", "msaa", "Use multisample antialiasing in WebRender.");
|
||||||
opts.optflag("b", "no-native-titlebar", "Do not use native titlebar");
|
opts.optflag("b", "no-native-titlebar", "Do not use native titlebar");
|
||||||
|
opts.optopt("", "device-pixel-ratio", "Device pixels per px", "");
|
||||||
|
|
||||||
let opts_matches;
|
let opts_matches;
|
||||||
let content_process_token;
|
let content_process_token;
|
||||||
|
@ -159,7 +160,14 @@ pub fn main() {
|
||||||
opts_matches.opt_present("no-native-titlebar") || !(pref!(shell.native_titlebar.enabled));
|
opts_matches.opt_present("no-native-titlebar") || !(pref!(shell.native_titlebar.enabled));
|
||||||
let enable_vsync = !opts_matches.opt_present("disable-vsync");
|
let enable_vsync = !opts_matches.opt_present("disable-vsync");
|
||||||
let use_msaa = opts_matches.opt_present("msaa");
|
let use_msaa = opts_matches.opt_present("msaa");
|
||||||
App::run(angle, enable_vsync, use_msaa, do_not_use_native_titlebar);
|
let device_pixels_per_px = opts_matches.opt_str("device-pixel-ratio").map(|dppx_str| {
|
||||||
|
dppx_str.parse().unwrap_or_else(|err| {
|
||||||
|
error!( "Error parsing option: --device-pixel-ratio ({})", err);
|
||||||
|
process::exit(1);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
App::run(angle, enable_vsync, use_msaa, do_not_use_native_titlebar, device_pixels_per_px);
|
||||||
|
|
||||||
platform::deinit(clean_shutdown)
|
platform::deinit(clean_shutdown)
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ pub fn init(
|
||||||
gl: gl.clone(),
|
gl: gl.clone(),
|
||||||
});
|
});
|
||||||
|
|
||||||
let servo = Servo::new(embedder_callbacks, window_callbacks.clone());
|
let servo = Servo::new(embedder_callbacks, window_callbacks.clone(), None);
|
||||||
|
|
||||||
SERVO.with(|s| {
|
SERVO.with(|s| {
|
||||||
let mut servo_glue = ServoGlue {
|
let mut servo_glue = ServoGlue {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue