mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
auto merge of #3800 : glennw/servo/native-gfx-metadata, r=mbrubeck
This is a prerequisite for glutin support. Tested on Linux, mac. Tested that android + cef build.
This commit is contained in:
commit
a258746269
12 changed files with 49 additions and 9 deletions
|
@ -145,13 +145,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
// display list. This is only here because we don't have that logic in the renderer yet.
|
||||
let window_size = window.framebuffer_size();
|
||||
let hidpi_factor = window.hidpi_factor();
|
||||
let context = CompositorTask::create_graphics_context(&window.native_metadata());
|
||||
|
||||
let show_debug_borders = opts::get().show_debug_borders;
|
||||
IOCompositor {
|
||||
window: window,
|
||||
port: port,
|
||||
context: rendergl::RenderContext::new(CompositorTask::create_graphics_context(),
|
||||
show_debug_borders),
|
||||
context: rendergl::RenderContext::new(context, show_debug_borders),
|
||||
root_pipeline: None,
|
||||
scene: Scene::new(Rect {
|
||||
origin: Zero::zero(),
|
||||
|
@ -294,7 +294,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
|
||||
(Ok(GetGraphicsMetadata(chan)), NotShuttingDown) => {
|
||||
chan.send(Some(azure_hl::current_graphics_metadata()));
|
||||
chan.send(Some(self.window.native_metadata()));
|
||||
}
|
||||
|
||||
(Ok(CreateOrUpdateRootLayer(layer_properties)), NotShuttingDown) => {
|
||||
|
|
|
@ -25,9 +25,6 @@ use std::rc::Rc;
|
|||
|
||||
use url::Url;
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
use azure::azure_hl;
|
||||
|
||||
/// The implementation of the layers-based compositor.
|
||||
#[deriving(Clone)]
|
||||
pub struct CompositorChan {
|
||||
|
@ -189,11 +186,13 @@ impl CompositorTask {
|
|||
///
|
||||
/// FIXME(pcwalton): Probably could be less platform-specific, using the metadata abstraction.
|
||||
#[cfg(target_os="linux")]
|
||||
pub fn create_graphics_context() -> NativeCompositingGraphicsContext {
|
||||
NativeCompositingGraphicsContext::from_display(azure_hl::current_display())
|
||||
pub fn create_graphics_context(native_metadata: &NativeGraphicsMetadata)
|
||||
-> NativeCompositingGraphicsContext {
|
||||
NativeCompositingGraphicsContext::from_display(native_metadata.display)
|
||||
}
|
||||
#[cfg(not(target_os="linux"))]
|
||||
pub fn create_graphics_context() -> NativeCompositingGraphicsContext {
|
||||
pub fn create_graphics_context(_: &NativeGraphicsMetadata)
|
||||
-> NativeCompositingGraphicsContext {
|
||||
NativeCompositingGraphicsContext::new()
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use geom::point::TypedPoint2D;
|
|||
use geom::scale_factor::ScaleFactor;
|
||||
use geom::size::TypedSize2D;
|
||||
use layers::geometry::DevicePixel;
|
||||
use layers::platform::surface::NativeGraphicsMetadata;
|
||||
use servo_msg::compositor_msg::{ReadyState, RenderState};
|
||||
use servo_util::geometry::ScreenPx;
|
||||
|
||||
|
@ -71,5 +72,8 @@ pub trait WindowMethods {
|
|||
|
||||
/// Returns the hidpi factor of the monitor.
|
||||
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32>;
|
||||
|
||||
/// Gets the OS native graphics information for this window.
|
||||
fn native_metadata(&self) -> NativeGraphicsMetadata;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue