mirror of
https://github.com/servo/servo.git
synced 2025-07-02 13:03:43 +01:00
Get the servo
crate building with the new WebRender
This commit is contained in:
parent
6b9924bec4
commit
e57e2121b2
6 changed files with 28 additions and 14 deletions
|
@ -32,7 +32,7 @@ use script_traits::{
|
|||
MouseButton, MouseEventType, ScrollState, TouchEventType, TouchId, WheelDelta,
|
||||
};
|
||||
use script_traits::{UntrustedNodeAddress, WindowSizeData, WindowSizeType};
|
||||
use servo_geometry::DeviceIndependentPixel;
|
||||
use servo_geometry::{DeviceIndependentPixel, FramebufferUintLength};
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::fs::{create_dir_all, File};
|
||||
|
@ -1268,7 +1268,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
CompositeTarget::Window => gl::RenderTargetInfo::default(),
|
||||
#[cfg(feature = "gl")]
|
||||
CompositeTarget::WindowAndPng | CompositeTarget::PngFile => {
|
||||
gl::initialize_png(&*self.window.gl(), width, height)
|
||||
gl::initialize_png(&*self.window.gl(),
|
||||
FramebufferUintLength::new(width.get()),
|
||||
FramebufferUintLength::new(height.get()))
|
||||
},
|
||||
#[cfg(not(feature = "gl"))]
|
||||
_ => (),
|
||||
|
@ -1330,7 +1332,10 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
CompositeTarget::Window => None,
|
||||
#[cfg(feature = "gl")]
|
||||
CompositeTarget::WindowAndPng => {
|
||||
let img = gl::draw_img(&*self.window.gl(), rt_info, width, height);
|
||||
let img = gl::draw_img(&*self.window.gl(),
|
||||
rt_info,
|
||||
FramebufferUintLength::new(width.get()),
|
||||
FramebufferUintLength::new(height.get()));
|
||||
Some(Image {
|
||||
width: img.width(),
|
||||
height: img.height(),
|
||||
|
@ -1349,7 +1354,10 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
|| match self.output_file.as_ref() {
|
||||
Some(path) => match File::create(path) {
|
||||
Ok(mut file) => {
|
||||
let img = gl::draw_img(gl, rt_info, width, height);
|
||||
let img = gl::draw_img(gl,
|
||||
rt_info,
|
||||
FramebufferUintLength::new(width.get()),
|
||||
FramebufferUintLength::new(height.get()));
|
||||
let dynamic_image = DynamicImage::ImageRgb8(img);
|
||||
if let Err(e) = dynamic_image.write_to(&mut file, ImageFormat::PNG)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ use std::time::Duration;
|
|||
use style_traits::DevicePixel;
|
||||
use webrender_api::ScrollLocation;
|
||||
use webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
|
||||
use webrender_api::units::{DevicePoint, FramebufferIntSize};
|
||||
use webrender_api::units::DevicePoint;
|
||||
use webvr::VRServiceManager;
|
||||
use webvr_traits::WebVRMainThreadHeartbeat;
|
||||
|
||||
|
@ -191,7 +191,7 @@ pub struct EmbedderCoordinates {
|
|||
/// Size of the native window.
|
||||
pub window: (DeviceIntSize, DeviceIntPoint),
|
||||
/// Size of the GL buffer in the window.
|
||||
pub framebuffer: FramebufferIntSize,
|
||||
pub framebuffer: DeviceIntSize,
|
||||
/// Coordinates of the document within the framebuffer.
|
||||
pub viewport: DeviceIntRect,
|
||||
}
|
||||
|
|
|
@ -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!")
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue