Update WR (CPU text optimizations, image format renames).

This commit is contained in:
Glenn Watson 2017-06-16 15:27:22 +10:00
parent e3a52536b6
commit e7b1e041c8
9 changed files with 39 additions and 39 deletions

54
Cargo.lock generated
View file

@ -322,7 +322,7 @@ dependencies = [
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "offscreen_gl_context 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"servo_config 0.0.1", "servo_config 0.0.1",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -336,7 +336,7 @@ dependencies = [
"ipc-channel 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -487,8 +487,8 @@ dependencies = [
"servo_url 0.0.1", "servo_url 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender 0.40.0 (git+https://github.com/servo/webrender)", "webrender 0.42.0 (git+https://github.com/servo/webrender)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -525,7 +525,7 @@ dependencies = [
"servo_remutex 0.0.1", "servo_remutex 0.0.1",
"servo_url 0.0.1", "servo_url 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
"webvr_traits 0.0.1", "webvr_traits 0.0.1",
] ]
@ -763,7 +763,7 @@ dependencies = [
"servo_geometry 0.0.1", "servo_geometry 0.0.1",
"servo_url 0.0.1", "servo_url 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
"x11 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1063,7 +1063,7 @@ dependencies = [
"truetype 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", "truetype 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-bidi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
"xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"xml5ever 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1144,7 +1144,7 @@ dependencies = [
"servo_url 0.0.1", "servo_url 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"x11 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1449,7 +1449,7 @@ dependencies = [
"style_traits 0.0.1", "style_traits 0.0.1",
"unicode-bidi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -1490,7 +1490,7 @@ dependencies = [
"servo_geometry 0.0.1", "servo_geometry 0.0.1",
"servo_url 0.0.1", "servo_url 0.0.1",
"style 0.0.1", "style 0.0.1",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -1504,7 +1504,7 @@ dependencies = [
"profile_traits 0.0.1", "profile_traits 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"servo_url 0.0.1", "servo_url 0.0.1",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -1580,8 +1580,8 @@ dependencies = [
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"webdriver_server 0.0.1", "webdriver_server 0.0.1",
"webrender 0.40.0 (git+https://github.com/servo/webrender)", "webrender 0.42.0 (git+https://github.com/servo/webrender)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
"webvr 0.0.1", "webvr 0.0.1",
"webvr_traits 0.0.1", "webvr_traits 0.0.1",
] ]
@ -1744,7 +1744,7 @@ dependencies = [
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -1788,7 +1788,7 @@ dependencies = [
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -1847,7 +1847,7 @@ dependencies = [
"servo_url 0.0.1", "servo_url 0.0.1",
"url 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -2436,7 +2436,7 @@ dependencies = [
"url 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"utf-8 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "utf-8 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
"webvr 0.0.1", "webvr 0.0.1",
"webvr_traits 0.0.1", "webvr_traits 0.0.1",
"xml5ever 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2466,7 +2466,7 @@ dependencies = [
"selectors 0.19.0", "selectors 0.19.0",
"servo_url 0.0.1", "servo_url 0.0.1",
"style 0.0.1", "style 0.0.1",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
@ -2512,7 +2512,7 @@ dependencies = [
"style_traits 0.0.1", "style_traits 0.0.1",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
"webvr_traits 0.0.1", "webvr_traits 0.0.1",
] ]
@ -3357,8 +3357,8 @@ dependencies = [
[[package]] [[package]]
name = "webrender" name = "webrender"
version = "0.40.0" version = "0.42.0"
source = "git+https://github.com/servo/webrender#181759db5be23d05b6dab273db36475edde18bdc" source = "git+https://github.com/servo/webrender#891670e5233650843d6189d1b72f202da3837ae8"
dependencies = [ dependencies = [
"app_units 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.0.0-alpha6 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.0.0-alpha6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3381,13 +3381,13 @@ dependencies = [
"rayon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_profiler 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "thread_profiler 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
] ]
[[package]] [[package]]
name = "webrender_traits" name = "webrender_traits"
version = "0.40.0" version = "0.42.0"
source = "git+https://github.com/servo/webrender#181759db5be23d05b6dab273db36475edde18bdc" source = "git+https://github.com/servo/webrender#891670e5233650843d6189d1b72f202da3837ae8"
dependencies = [ dependencies = [
"app_units 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.0.0-alpha6 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.0.0-alpha6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3414,7 +3414,7 @@ dependencies = [
"msg 0.0.1", "msg 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"servo_config 0.0.1", "servo_config 0.0.1",
"webrender_traits 0.40.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.42.0 (git+https://github.com/servo/webrender)",
"webvr_traits 0.0.1", "webvr_traits 0.0.1",
] ]
@ -3789,8 +3789,8 @@ dependencies = [
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff" "checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff"
"checksum webdriver 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d548aabf87411b1b4ba91fd07eacd8b238135c7131a452b8a9f6386209167e18" "checksum webdriver 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d548aabf87411b1b4ba91fd07eacd8b238135c7131a452b8a9f6386209167e18"
"checksum webrender 0.40.0 (git+https://github.com/servo/webrender)" = "<none>" "checksum webrender 0.42.0 (git+https://github.com/servo/webrender)" = "<none>"
"checksum webrender_traits 0.40.0 (git+https://github.com/servo/webrender)" = "<none>" "checksum webrender_traits 0.42.0 (git+https://github.com/servo/webrender)" = "<none>"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum ws 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04614a58714f3fd4a8b1da4bcae9f031c532d35988c3d39627619248113f8be8" "checksum ws 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "04614a58714f3fd4a8b1da4bcae9f031c532d35988c3d39627619248113f8be8"

View file

@ -564,7 +564,7 @@ impl<'a> CanvasPaintThread<'a> {
width: size.width as u32, width: size.width as u32,
height: size.height as u32, height: size.height as u32,
stride: None, stride: None,
format: webrender_traits::ImageFormat::RGBA8, format: webrender_traits::ImageFormat::BGRA8,
offset: 0, offset: 0,
is_opaque: false, is_opaque: false,
}; };

View file

@ -254,7 +254,7 @@ impl WebGLPaintThread {
width: width as u32, width: width as u32,
height: height as u32, height: height as u32,
stride: None, stride: None,
format: webrender_traits::ImageFormat::RGBA8, format: webrender_traits::ImageFormat::BGRA8,
offset: 0, offset: 0,
is_opaque: false, is_opaque: false,
}; };

View file

@ -1951,7 +1951,7 @@ impl FragmentDisplayListBuilding for Fragment {
webrender_image: WebRenderImageInfo { webrender_image: WebRenderImageInfo {
width: computed_width as u32, width: computed_width as u32,
height: computed_height as u32, height: computed_height as u32,
format: PixelFormat::RGBA8, format: PixelFormat::BGRA8,
key: Some(canvas_data.image_key), key: Some(canvas_data.image_key),
}, },
image_data: None, image_data: None,

View file

@ -40,7 +40,7 @@ fn convert_format(format: PixelFormat) -> webrender_traits::ImageFormat {
panic!("Not support by webrender yet"); panic!("Not support by webrender yet");
} }
PixelFormat::RGB8 => webrender_traits::ImageFormat::RGB8, PixelFormat::RGB8 => webrender_traits::ImageFormat::RGB8,
PixelFormat::RGBA8 => webrender_traits::ImageFormat::RGBA8, PixelFormat::BGRA8 => webrender_traits::ImageFormat::BGRA8,
} }
} }
@ -66,7 +66,7 @@ fn set_webrender_image_key(webrender_api: &webrender_traits::RenderApi, image: &
let format = convert_format(image.format); let format = convert_format(image.format);
let mut bytes = Vec::new(); let mut bytes = Vec::new();
bytes.extend_from_slice(&*image.bytes); bytes.extend_from_slice(&*image.bytes);
if format == webrender_traits::ImageFormat::RGBA8 { if format == webrender_traits::ImageFormat::BGRA8 {
premultiply(bytes.as_mut_slice()); premultiply(bytes.as_mut_slice());
} }
let descriptor = webrender_traits::ImageDescriptor { let descriptor = webrender_traits::ImageDescriptor {
@ -87,7 +87,7 @@ fn set_webrender_image_key(webrender_api: &webrender_traits::RenderApi, image: &
// Consider using SIMD to speed this up if it shows in profiles. // Consider using SIMD to speed this up if it shows in profiles.
fn is_image_opaque(format: webrender_traits::ImageFormat, bytes: &[u8]) -> bool { fn is_image_opaque(format: webrender_traits::ImageFormat, bytes: &[u8]) -> bool {
match format { match format {
webrender_traits::ImageFormat::RGBA8 => { webrender_traits::ImageFormat::BGRA8 => {
let mut is_opaque = true; let mut is_opaque = true;
for i in 0..(bytes.len() / 4) { for i in 0..(bytes.len() / 4) {
if bytes[i * 4 + 3] != 255 { if bytes[i * 4 + 3] != 255 {

View file

@ -16,7 +16,7 @@ pub enum PixelFormat {
/// RGB, 8 bits per channel /// RGB, 8 bits per channel
RGB8, RGB8,
/// RGB + alpha, 8 bits per channel /// RGB + alpha, 8 bits per channel
RGBA8, BGRA8,
} }
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)] #[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
@ -83,7 +83,7 @@ pub fn load_from_memory(buffer: &[u8]) -> Option<Image> {
Some(Image { Some(Image {
width: rgba.width(), width: rgba.width(),
height: rgba.height(), height: rgba.height(),
format: PixelFormat::RGBA8, format: PixelFormat::BGRA8,
bytes: IpcSharedMemory::from_bytes(&*rgba), bytes: IpcSharedMemory::from_bytes(&*rgba),
id: None, id: None,
}) })

View file

@ -431,7 +431,7 @@ impl CanvasRenderingContext2D {
let image_size = Size2D::new(img.width as i32, img.height as i32); let image_size = Size2D::new(img.width as i32, img.height as i32);
let image_data = match img.format { let image_data = match img.format {
PixelFormat::RGBA8 => img.bytes.to_vec(), PixelFormat::BGRA8 => img.bytes.to_vec(),
PixelFormat::K8 => panic!("K8 color type not supported"), PixelFormat::K8 => panic!("K8 color type not supported"),
PixelFormat::RGB8 => panic!("RGB8 color type not supported"), PixelFormat::RGB8 => panic!("RGB8 color type not supported"),
PixelFormat::KA8 => panic!("KA8 color type not supported"), PixelFormat::KA8 => panic!("KA8 color type not supported"),

View file

@ -75,7 +75,7 @@ impl PaintWorkletGlobalScope {
let image = Image { let image = Image {
width: width, width: width,
height: height, height: height,
format: PixelFormat::RGBA8, format: PixelFormat::BGRA8,
bytes: IpcSharedMemory::from_bytes(&*self.buffer.borrow()), bytes: IpcSharedMemory::from_bytes(&*self.buffer.borrow()),
id: None, id: None,
}; };

View file

@ -690,9 +690,9 @@ impl WebGLRenderingContext {
let size = Size2D::new(img.width as i32, img.height as i32); let size = Size2D::new(img.width as i32, img.height as i32);
// For now Servo's images are all stored as RGBA8 internally. // For now Servo's images are all stored as BGRA8 internally.
let mut data = match img.format { let mut data = match img.format {
PixelFormat::RGBA8 => img.bytes.to_vec(), PixelFormat::BGRA8 => img.bytes.to_vec(),
_ => unimplemented!(), _ => unimplemented!(),
}; };