mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Move PaintListener to gfx_traits, Fixes #8834
Adding layers and msg dependency to gfx_traits.
This commit is contained in:
parent
f5eec35cb4
commit
701aebee48
9 changed files with 57 additions and 34 deletions
|
@ -8,12 +8,12 @@ use CompositorMsg as ConstellationMsg;
|
||||||
use compositor;
|
use compositor;
|
||||||
use euclid::point::Point2D;
|
use euclid::point::Point2D;
|
||||||
use euclid::size::Size2D;
|
use euclid::size::Size2D;
|
||||||
|
use gfx_traits::PaintListener;
|
||||||
use headless;
|
use headless;
|
||||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||||
use layers::layers::{BufferRequest, LayerBufferSet};
|
use layers::layers::{BufferRequest, LayerBufferSet};
|
||||||
use layers::platform::surface::{NativeDisplay, NativeSurface};
|
use layers::platform::surface::{NativeDisplay, NativeSurface};
|
||||||
use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerProperties};
|
use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerProperties, ScriptToCompositorMsg};
|
||||||
use msg::compositor_msg::{PaintListener, ScriptToCompositorMsg};
|
|
||||||
use msg::constellation_msg::{AnimationState, PipelineId};
|
use msg::constellation_msg::{AnimationState, PipelineId};
|
||||||
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState};
|
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState};
|
||||||
use profile_traits::mem;
|
use profile_traits::mem;
|
||||||
|
|
|
@ -15,12 +15,11 @@ use euclid::rect::Rect;
|
||||||
use euclid::size::Size2D;
|
use euclid::size::Size2D;
|
||||||
use font_cache_task::FontCacheTask;
|
use font_cache_task::FontCacheTask;
|
||||||
use font_context::FontContext;
|
use font_context::FontContext;
|
||||||
use gfx_traits::color;
|
use gfx_traits::{PaintListener, color};
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
|
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
|
||||||
use layers::platform::surface::{NativeDisplay, NativeSurface};
|
use layers::platform::surface::{NativeDisplay, NativeSurface};
|
||||||
use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerKind, LayerProperties};
|
use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerKind, LayerProperties, ScrollPolicy};
|
||||||
use msg::compositor_msg::{PaintListener, ScrollPolicy};
|
|
||||||
use msg::constellation_msg::PaintMsg as ConstellationMsg;
|
use msg::constellation_msg::PaintMsg as ConstellationMsg;
|
||||||
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
|
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
|
||||||
use paint_context::PaintContext;
|
use paint_context::PaintContext;
|
||||||
|
|
|
@ -10,3 +10,10 @@ path = "lib.rs"
|
||||||
[dependencies.azure]
|
[dependencies.azure]
|
||||||
git = "https://github.com/servo/rust-azure"
|
git = "https://github.com/servo/rust-azure"
|
||||||
features = ["plugins"]
|
features = ["plugins"]
|
||||||
|
|
||||||
|
[dependencies.layers]
|
||||||
|
git = "https://github.com/servo/rust-layers"
|
||||||
|
features = ["plugins"]
|
||||||
|
|
||||||
|
[dependencies.msg]
|
||||||
|
path = "../msg"
|
||||||
|
|
|
@ -4,6 +4,12 @@
|
||||||
|
|
||||||
#![crate_name = "gfx_traits"]
|
#![crate_name = "gfx_traits"]
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
extern crate azure;
|
extern crate azure;
|
||||||
|
extern crate layers;
|
||||||
|
extern crate msg;
|
||||||
|
|
||||||
pub mod color;
|
pub mod color;
|
||||||
|
mod paint_listener;
|
||||||
|
|
||||||
|
pub use paint_listener::PaintListener;
|
||||||
|
|
34
components/gfx_traits/paint_listener.rs
Normal file
34
components/gfx_traits/paint_listener.rs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use layers::layers::{BufferRequest, LayerBufferSet};
|
||||||
|
use layers::platform::surface::NativeDisplay;
|
||||||
|
use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerProperties};
|
||||||
|
use msg::constellation_msg::PipelineId;
|
||||||
|
|
||||||
|
/// The interface used by the painter to acquire draw targets for each paint frame and
|
||||||
|
/// submit them to be drawn to the display.
|
||||||
|
pub trait PaintListener {
|
||||||
|
fn native_display(&mut self) -> Option<NativeDisplay>;
|
||||||
|
|
||||||
|
/// Informs the compositor of the layers for the given pipeline. The compositor responds by
|
||||||
|
/// creating and/or destroying paint layers as necessary.
|
||||||
|
fn initialize_layers_for_pipeline(&mut self,
|
||||||
|
pipeline_id: PipelineId,
|
||||||
|
properties: Vec<LayerProperties>,
|
||||||
|
epoch: Epoch);
|
||||||
|
|
||||||
|
/// Sends new buffers for the given layers to the compositor.
|
||||||
|
fn assign_painted_buffers(&mut self,
|
||||||
|
pipeline_id: PipelineId,
|
||||||
|
epoch: Epoch,
|
||||||
|
replies: Vec<(LayerId, Box<LayerBufferSet>)>,
|
||||||
|
frame_tree_id: FrameTreeId);
|
||||||
|
|
||||||
|
/// Inform the compositor that these buffer requests will be ignored.
|
||||||
|
fn ignore_buffer_requests(&mut self, buffer_requests: Vec<BufferRequest>);
|
||||||
|
|
||||||
|
// Notification that the paint task wants to exit.
|
||||||
|
fn notify_paint_task_exiting(&mut self, pipeline_id: PipelineId);
|
||||||
|
}
|
|
@ -6,8 +6,6 @@ use azure::azure_hl::Color;
|
||||||
use constellation_msg::{Key, KeyModifiers, KeyState, PipelineId};
|
use constellation_msg::{Key, KeyModifiers, KeyState, PipelineId};
|
||||||
use euclid::{Matrix4, Point2D, Rect, Size2D};
|
use euclid::{Matrix4, Point2D, Rect, Size2D};
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use layers::layers::{BufferRequest, LayerBufferSet};
|
|
||||||
use layers::platform::surface::NativeDisplay;
|
|
||||||
use std::fmt::{self, Debug, Formatter};
|
use std::fmt::{self, Debug, Formatter};
|
||||||
|
|
||||||
/// A newtype struct for denoting the age of messages; prevents race conditions.
|
/// A newtype struct for denoting the age of messages; prevents race conditions.
|
||||||
|
@ -126,32 +124,6 @@ pub struct LayerProperties {
|
||||||
pub scrolls_overflow_area: bool,
|
pub scrolls_overflow_area: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The interface used by the painter to acquire draw targets for each paint frame and
|
|
||||||
/// submit them to be drawn to the display.
|
|
||||||
pub trait PaintListener {
|
|
||||||
fn native_display(&mut self) -> Option<NativeDisplay>;
|
|
||||||
|
|
||||||
/// Informs the compositor of the layers for the given pipeline. The compositor responds by
|
|
||||||
/// creating and/or destroying paint layers as necessary.
|
|
||||||
fn initialize_layers_for_pipeline(&mut self,
|
|
||||||
pipeline_id: PipelineId,
|
|
||||||
properties: Vec<LayerProperties>,
|
|
||||||
epoch: Epoch);
|
|
||||||
|
|
||||||
/// Sends new buffers for the given layers to the compositor.
|
|
||||||
fn assign_painted_buffers(&mut self,
|
|
||||||
pipeline_id: PipelineId,
|
|
||||||
epoch: Epoch,
|
|
||||||
replies: Vec<(LayerId, Box<LayerBufferSet>)>,
|
|
||||||
frame_tree_id: FrameTreeId);
|
|
||||||
|
|
||||||
/// Inform the compositor that these buffer requests will be ignored.
|
|
||||||
fn ignore_buffer_requests(&mut self, buffer_requests: Vec<BufferRequest>);
|
|
||||||
|
|
||||||
// Notification that the paint task wants to exit.
|
|
||||||
fn notify_paint_task_exiting(&mut self, pipeline_id: PipelineId);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub enum ScriptToCompositorMsg {
|
pub enum ScriptToCompositorMsg {
|
||||||
ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>, bool),
|
ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>, bool),
|
||||||
|
@ -169,4 +141,3 @@ pub enum EventResult {
|
||||||
DefaultAllowed,
|
DefaultAllowed,
|
||||||
DefaultPrevented,
|
DefaultPrevented,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
components/servo/Cargo.lock
generated
2
components/servo/Cargo.lock
generated
|
@ -655,6 +655,8 @@ name = "gfx_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"azure 0.2.1 (git+https://github.com/servo/rust-azure)",
|
"azure 0.2.1 (git+https://github.com/servo/rust-azure)",
|
||||||
|
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
|
||||||
|
"msg 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
2
ports/cef/Cargo.lock
generated
2
ports/cef/Cargo.lock
generated
|
@ -615,6 +615,8 @@ name = "gfx_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"azure 0.2.1 (git+https://github.com/servo/rust-azure)",
|
"azure 0.2.1 (git+https://github.com/servo/rust-azure)",
|
||||||
|
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
|
||||||
|
"msg 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
2
ports/gonk/Cargo.lock
generated
2
ports/gonk/Cargo.lock
generated
|
@ -613,6 +613,8 @@ name = "gfx_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"azure 0.2.1 (git+https://github.com/servo/rust-azure)",
|
"azure 0.2.1 (git+https://github.com/servo/rust-azure)",
|
||||||
|
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
|
||||||
|
"msg 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue