mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Move Image and PixelFormat to net_traits.
This commit is contained in:
parent
e3ebbd0fcd
commit
dce2872f45
14 changed files with 40 additions and 32 deletions
|
@ -18,9 +18,10 @@ use gleam::gl::types::{GLint, GLsizei};
|
||||||
use image::{DynamicImage, ImageFormat, RgbImage};
|
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||||
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use msg::constellation_msg::{Image, PixelFormat, Key, KeyModifiers, KeyState};
|
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
||||||
use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId};
|
use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId};
|
||||||
use msg::constellation_msg::{TraversalDirection, WindowSizeType};
|
use msg::constellation_msg::{TraversalDirection, WindowSizeType};
|
||||||
|
use net_traits::image::base::{Image, PixelFormat};
|
||||||
use profile_traits::mem::{self, Reporter, ReporterRequest};
|
use profile_traits::mem::{self, Reporter, ReporterRequest};
|
||||||
use profile_traits::time::{self, ProfilerCategory, profile};
|
use profile_traits::time::{self, ProfilerCategory, profile};
|
||||||
use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg};
|
use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg};
|
||||||
|
|
|
@ -9,7 +9,8 @@ use compositor::CompositingReason;
|
||||||
use euclid::point::Point2D;
|
use euclid::point::Point2D;
|
||||||
use euclid::size::Size2D;
|
use euclid::size::Size2D;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState, PipelineId};
|
use msg::constellation_msg::{Key, KeyModifiers, KeyState, PipelineId};
|
||||||
|
use net_traits::image::base::Image;
|
||||||
use profile_traits::mem;
|
use profile_traits::mem;
|
||||||
use profile_traits::time;
|
use profile_traits::time;
|
||||||
use script_traits::{AnimationState, ConstellationMsg, EventResult};
|
use script_traits::{AnimationState, ConstellationMsg, EventResult};
|
||||||
|
|
|
@ -14,7 +14,6 @@ bitflags = "0.7"
|
||||||
cssparser = {version = "0.7", features = ["heap_size", "serde-serialization"]}
|
cssparser = {version = "0.7", features = ["heap_size", "serde-serialization"]}
|
||||||
heapsize = "0.3.0"
|
heapsize = "0.3.0"
|
||||||
heapsize_plugin = "0.1.2"
|
heapsize_plugin = "0.1.2"
|
||||||
ipc-channel = "0.5"
|
|
||||||
plugins = {path = "../plugins"}
|
plugins = {path = "../plugins"}
|
||||||
serde = "0.8"
|
serde = "0.8"
|
||||||
serde_derive = "0.8"
|
serde_derive = "0.8"
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
//! The high-level interface from script to constellation. Using this abstract interface helps
|
//! The high-level interface from script to constellation. Using this abstract interface helps
|
||||||
//! reduce coupling between these two components.
|
//! reduce coupling between these two components.
|
||||||
|
|
||||||
use ipc_channel::ipc::IpcSharedMemory;
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use webrender_traits;
|
use webrender_traits;
|
||||||
|
@ -163,25 +162,6 @@ bitflags! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)]
|
|
||||||
pub enum PixelFormat {
|
|
||||||
K8, // Luminance channel only
|
|
||||||
KA8, // Luminance + alpha
|
|
||||||
RGB8, // RGB, 8 bits per channel
|
|
||||||
RGBA8, // RGB + alpha, 8 bits per channel
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
|
|
||||||
pub struct Image {
|
|
||||||
pub width: u32,
|
|
||||||
pub height: u32,
|
|
||||||
pub format: PixelFormat,
|
|
||||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
|
||||||
pub bytes: IpcSharedMemory,
|
|
||||||
#[ignore_heap_size_of = "Defined in webrender_traits"]
|
|
||||||
pub id: Option<webrender_traits::ImageKey>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize)]
|
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize)]
|
||||||
pub enum TraversalDirection {
|
pub enum TraversalDirection {
|
||||||
Forward(usize),
|
Forward(usize),
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
extern crate heapsize;
|
extern crate heapsize;
|
||||||
extern crate ipc_channel;
|
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
|
|
|
@ -27,3 +27,8 @@ url = {version = "1.2", features = ["heap_size"]}
|
||||||
websocket = "0.17"
|
websocket = "0.17"
|
||||||
uuid = { version = "0.3.1", features = ["v4", "serde"] }
|
uuid = { version = "0.3.1", features = ["v4", "serde"] }
|
||||||
cookie = {version = "0.2.5", features = ["serialize-rustc"]}
|
cookie = {version = "0.2.5", features = ["serialize-rustc"]}
|
||||||
|
|
||||||
|
[dependencies.webrender_traits]
|
||||||
|
git = "https://github.com/servo/webrender"
|
||||||
|
default_features = false
|
||||||
|
features = ["serde_derive"]
|
||||||
|
|
|
@ -4,8 +4,26 @@
|
||||||
|
|
||||||
use ipc_channel::ipc::IpcSharedMemory;
|
use ipc_channel::ipc::IpcSharedMemory;
|
||||||
use piston_image::{self, DynamicImage, ImageFormat};
|
use piston_image::{self, DynamicImage, ImageFormat};
|
||||||
|
use webrender_traits;
|
||||||
|
|
||||||
pub use msg::constellation_msg::{Image, PixelFormat};
|
#[derive(Clone, Copy, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)]
|
||||||
|
pub enum PixelFormat {
|
||||||
|
K8, // Luminance channel only
|
||||||
|
KA8, // Luminance + alpha
|
||||||
|
RGB8, // RGB, 8 bits per channel
|
||||||
|
RGBA8, // RGB + alpha, 8 bits per channel
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||||
|
pub struct Image {
|
||||||
|
pub width: u32,
|
||||||
|
pub height: u32,
|
||||||
|
pub format: PixelFormat,
|
||||||
|
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
||||||
|
pub bytes: IpcSharedMemory,
|
||||||
|
#[ignore_heap_size_of = "Defined in webrender_traits"]
|
||||||
|
pub id: Option<webrender_traits::ImageKey>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)]
|
#[derive(Clone, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)]
|
||||||
pub struct ImageMetadata {
|
pub struct ImageMetadata {
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use image::base::ImageMetadata;
|
use image::base::{Image, ImageMetadata};
|
||||||
use ipc_channel::ipc::{self, IpcSender};
|
use ipc_channel::ipc::{self, IpcSender};
|
||||||
use msg::constellation_msg::Image;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ extern crate serde_derive;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
extern crate util;
|
extern crate util;
|
||||||
extern crate uuid;
|
extern crate uuid;
|
||||||
|
extern crate webrender_traits;
|
||||||
extern crate websocket;
|
extern crate websocket;
|
||||||
|
|
||||||
use cookie_rs::Cookie;
|
use cookie_rs::Cookie;
|
||||||
|
|
|
@ -51,11 +51,12 @@ use hyper::header::Headers;
|
||||||
use hyper::method::Method;
|
use hyper::method::Method;
|
||||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
use msg::constellation_msg::{FrameId, FrameType, Image, Key, KeyModifiers, KeyState};
|
use msg::constellation_msg::{FrameId, FrameType, Key, KeyModifiers, KeyState};
|
||||||
use msg::constellation_msg::{PipelineId, PipelineNamespaceId, ReferrerPolicy};
|
use msg::constellation_msg::{PipelineId, PipelineNamespaceId, ReferrerPolicy};
|
||||||
use msg::constellation_msg::{TraversalDirection, WindowSizeType};
|
use msg::constellation_msg::{TraversalDirection, WindowSizeType};
|
||||||
use net_traits::{LoadOrigin, ResourceThreads};
|
use net_traits::{LoadOrigin, ResourceThreads};
|
||||||
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
use net_traits::bluetooth_thread::BluetoothMethodMsg;
|
||||||
|
use net_traits::image::base::Image;
|
||||||
use net_traits::image_cache_thread::ImageCacheThread;
|
use net_traits::image_cache_thread::ImageCacheThread;
|
||||||
use net_traits::response::HttpsState;
|
use net_traits::response::HttpsState;
|
||||||
use profile_traits::mem;
|
use profile_traits::mem;
|
||||||
|
|
3
components/servo/Cargo.lock
generated
3
components/servo/Cargo.lock
generated
|
@ -1385,7 +1385,6 @@ dependencies = [
|
||||||
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1485,6 +1484,7 @@ dependencies = [
|
||||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"util 0.0.1",
|
"util 0.0.1",
|
||||||
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"webrender_traits 0.6.0 (git+https://github.com/servo/webrender)",
|
||||||
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2647,6 +2647,7 @@ dependencies = [
|
||||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
|
"net_traits 0.0.1",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"regex 0.1.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 0.1.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -16,6 +16,7 @@ image = "0.10"
|
||||||
ipc-channel = "0.5"
|
ipc-channel = "0.5"
|
||||||
log = "0.3.5"
|
log = "0.3.5"
|
||||||
msg = {path = "../msg"}
|
msg = {path = "../msg"}
|
||||||
|
net_traits = {path = "../net_traits"}
|
||||||
plugins = {path = "../plugins"}
|
plugins = {path = "../plugins"}
|
||||||
regex = "0.1.55"
|
regex = "0.1.55"
|
||||||
rustc-serialize = "0.3.4"
|
rustc-serialize = "0.3.4"
|
||||||
|
|
|
@ -18,6 +18,7 @@ extern crate ipc_channel;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
extern crate msg;
|
extern crate msg;
|
||||||
|
extern crate net_traits;
|
||||||
extern crate regex;
|
extern crate regex;
|
||||||
extern crate rustc_serialize;
|
extern crate rustc_serialize;
|
||||||
extern crate script_traits;
|
extern crate script_traits;
|
||||||
|
@ -33,8 +34,8 @@ use hyper::method::Method::{self, Post};
|
||||||
use image::{DynamicImage, ImageFormat, RgbImage};
|
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||||
use keys::keycodes_to_keys;
|
use keys::keycodes_to_keys;
|
||||||
use msg::constellation_msg::{FrameId, PipelineId};
|
use msg::constellation_msg::{FrameId, PipelineId, TraversalDirection};
|
||||||
use msg::constellation_msg::{PixelFormat, TraversalDirection};
|
use net_traits::image::base::PixelFormat;
|
||||||
use regex::Captures;
|
use regex::Captures;
|
||||||
use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64};
|
use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64};
|
||||||
use rustc_serialize::json::{Json, ToJson};
|
use rustc_serialize::json::{Json, ToJson};
|
||||||
|
|
3
ports/cef/Cargo.lock
generated
3
ports/cef/Cargo.lock
generated
|
@ -1285,7 +1285,6 @@ dependencies = [
|
||||||
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize_plugin 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1363,6 +1362,7 @@ dependencies = [
|
||||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"util 0.0.1",
|
"util 0.0.1",
|
||||||
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"webrender_traits 0.6.0 (git+https://github.com/servo/webrender)",
|
||||||
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2505,6 +2505,7 @@ dependencies = [
|
||||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
|
"net_traits 0.0.1",
|
||||||
"plugins 0.0.1",
|
"plugins 0.0.1",
|
||||||
"regex 0.1.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 0.1.76 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue