diff options
-rw-r--r-- | components/compositing/compositor_task.rs | 4 | ||||
-rw-r--r-- | components/gfx/paint_task.rs | 5 | ||||
-rw-r--r-- | components/gfx_traits/Cargo.toml | 7 | ||||
-rw-r--r-- | components/gfx_traits/lib.rs | 6 | ||||
-rw-r--r-- | components/gfx_traits/paint_listener.rs | 34 | ||||
-rw-r--r-- | components/msg/compositor_msg.rs | 29 | ||||
-rw-r--r-- | components/servo/Cargo.lock | 2 | ||||
-rw-r--r-- | ports/cef/Cargo.lock | 2 | ||||
-rw-r--r-- | ports/gonk/Cargo.lock | 2 |
9 files changed, 57 insertions, 34 deletions
diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 532590665f2..07a60289cec 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -8,12 +8,12 @@ use CompositorMsg as ConstellationMsg; use compositor; use euclid::point::Point2D; use euclid::size::Size2D; +use gfx_traits::PaintListener; use headless; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use layers::layers::{BufferRequest, LayerBufferSet}; use layers::platform::surface::{NativeDisplay, NativeSurface}; -use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerProperties}; -use msg::compositor_msg::{PaintListener, ScriptToCompositorMsg}; +use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerProperties, ScriptToCompositorMsg}; use msg::constellation_msg::{AnimationState, PipelineId}; use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState}; use profile_traits::mem; diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 78e7a9e6e66..fd619721732 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -15,12 +15,11 @@ use euclid::rect::Rect; use euclid::size::Size2D; use font_cache_task::FontCacheTask; use font_context::FontContext; -use gfx_traits::color; +use gfx_traits::{PaintListener, color}; use ipc_channel::ipc::IpcSender; use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet}; use layers::platform::surface::{NativeDisplay, NativeSurface}; -use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerKind, LayerProperties}; -use msg::compositor_msg::{PaintListener, ScrollPolicy}; +use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerKind, LayerProperties, ScrollPolicy}; use msg::constellation_msg::PaintMsg as ConstellationMsg; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId}; use paint_context::PaintContext; diff --git a/components/gfx_traits/Cargo.toml b/components/gfx_traits/Cargo.toml index a092e9f0ddf..6289f073cc7 100644 --- a/components/gfx_traits/Cargo.toml +++ b/components/gfx_traits/Cargo.toml @@ -10,3 +10,10 @@ path = "lib.rs" [dependencies.azure] git = "https://github.com/servo/rust-azure" features = ["plugins"] + +[dependencies.layers] +git = "https://github.com/servo/rust-layers" +features = ["plugins"] + +[dependencies.msg] +path = "../msg" diff --git a/components/gfx_traits/lib.rs b/components/gfx_traits/lib.rs index ea77933ce89..2500db1db20 100644 --- a/components/gfx_traits/lib.rs +++ b/components/gfx_traits/lib.rs @@ -4,6 +4,12 @@ #![crate_name = "gfx_traits"] #![crate_type = "rlib"] + extern crate azure; +extern crate layers; +extern crate msg; pub mod color; +mod paint_listener; + +pub use paint_listener::PaintListener; diff --git a/components/gfx_traits/paint_listener.rs b/components/gfx_traits/paint_listener.rs new file mode 100644 index 00000000000..8ca8ff05488 --- /dev/null +++ b/components/gfx_traits/paint_listener.rs @@ -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); +} diff --git a/components/msg/compositor_msg.rs b/components/msg/compositor_msg.rs index 240f7750505..6c48e293554 100644 --- a/components/msg/compositor_msg.rs +++ b/components/msg/compositor_msg.rs @@ -6,8 +6,6 @@ use azure::azure_hl::Color; use constellation_msg::{Key, KeyModifiers, KeyState, PipelineId}; use euclid::{Matrix4, Point2D, Rect, Size2D}; use ipc_channel::ipc::IpcSender; -use layers::layers::{BufferRequest, LayerBufferSet}; -use layers::platform::surface::NativeDisplay; use std::fmt::{self, Debug, Formatter}; /// A newtype struct for denoting the age of messages; prevents race conditions. @@ -126,32 +124,6 @@ pub struct LayerProperties { 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)] pub enum ScriptToCompositorMsg { ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>, bool), @@ -169,4 +141,3 @@ pub enum EventResult { DefaultAllowed, DefaultPrevented, } - diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 8f525198765..5e6eb4a0afe 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -655,6 +655,8 @@ name = "gfx_traits" version = "0.0.1" dependencies = [ "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]] diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 0f780c1d4bf..9c5743ca3e8 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -615,6 +615,8 @@ name = "gfx_traits" version = "0.0.1" dependencies = [ "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]] diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index ce26c67f259..cbe163396ff 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -613,6 +613,8 @@ name = "gfx_traits" version = "0.0.1" dependencies = [ "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]] |