Get the servo crate building with the new WebRender

This commit is contained in:
Patrick Walton 2019-06-04 21:39:59 -07:00 committed by Josh Matthews
parent 6b9924bec4
commit e57e2121b2
6 changed files with 28 additions and 14 deletions

View file

@ -84,6 +84,7 @@ use constellation::{FromCompositorLogger, FromScriptLogger};
use crossbeam_channel::{unbounded, Sender};
use embedder_traits::{EmbedderMsg, EmbedderProxy, EmbedderReceiver, EventLoopWaker};
use env_logger::Builder as EnvLoggerBuilder;
use euclid::TypedSize2D;
#[cfg(all(
not(target_os = "windows"),
not(target_os = "ios"),
@ -303,11 +304,16 @@ where
let render_notifier = Box::new(RenderNotifier::new(compositor_proxy.clone()));
// Cast from `DeviceIndependentPixel` to `DevicePixel`
let device_pixel_ratio = coordinates.hidpi_factor.get();
let window_size = TypedSize2D::from_untyped(
&(opts.initial_window_size.to_f32() / device_pixel_ratio).to_i32().to_untyped());
webrender::Renderer::new(
window.gl(),
render_notifier,
webrender::RendererOptions {
device_pixel_ratio: coordinates.hidpi_factor.get(),
device_pixel_ratio,
resource_override_path: opts.shaders_dir.clone(),
enable_aa: opts.enable_text_antialiasing,
debug_flags: debug_flags,
@ -323,6 +329,7 @@ where
..Default::default()
},
None,
window_size,
)
.expect("Unable to initialize webrender!")
};