diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-10 16:55:17 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-10 16:55:17 -0600 |
commit | 796fae4bbe966a4e6e32b01fa44f6123c7162992 (patch) | |
tree | 17056c47425e2463b105866196f7c4a28d196e25 | |
parent | e3f07dfa1673950f5aad44e1be6d3667172343b6 (diff) | |
parent | 473df194fce0793242d5ddceda2ec5d66c920267 (diff) | |
download | servo-796fae4bbe966a4e6e32b01fa44f6123c7162992.tar.gz servo-796fae4bbe966a4e6e32b01fa44f6123c7162992.zip |
Auto merge of #14153 - vvuk:win32-dwrite, r=glennw
Add support for DirectWrite font rendering on Windows
<!-- Please describe your changes on the following line: -->
This PR adds support for DirectWrite text rendering using a thin wrapper for dwrite, as well as similar functionality added to WebRender. In doing so it removes the FreeType dep from the Windows build.
There is still work to be done here, but this is a good starting point for future cleanup and fixes.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [X] These changes fix #13371 (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because they are already tested by other tests
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14153)
<!-- Reviewable:end -->
29 files changed, 747 insertions, 241 deletions
diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index fd516a2e853..2a706c4b9c0 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -53,15 +53,12 @@ core-foundation = "0.2" core-graphics = "0.4" core-text = "2.0" -[target.'cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))'.dependencies] -freetype = {git = "https://github.com/servo/rust-freetype"} - [target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies] +freetype = {git = "https://github.com/servo/rust-freetype"} servo-fontconfig = "0.2.1" [target.'cfg(any(target_arch = "x86_64", target_arch = "aarch64"))'.dependencies] simd = {git = "https://github.com/huonw/simd"} [target.'cfg(target_os = "windows")'.dependencies] -winapi = "0.2" -gdi32-sys = "0.2" +dwrote = {git = "https://github.com/vvuk/dwrote-rs"} diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs index 700ed171dd6..38c43af3019 100644 --- a/components/gfx/lib.rs +++ b/components/gfx/lib.rs @@ -29,19 +29,16 @@ extern crate bitflags; #[cfg(target_os = "macos")] extern crate core_text; // Windows-specific library dependencies -#[cfg(target_os = "windows")] extern crate gdi32; -#[cfg(target_os = "windows")] extern crate winapi; +#[cfg(target_os = "windows")] extern crate dwrote; extern crate euclid; extern crate fnv; -// Platforms that use Freetype/Fontconfig library dependencies #[cfg(any(target_os = "linux", target_os = "android"))] extern crate fontconfig; extern crate fontsan; -#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))] +#[cfg(any(target_os = "linux", target_os = "android"))] extern crate freetype; - extern crate gfx_traits; // Eventually we would like the shaper to be pluggable, as many operating systems have their own diff --git a/components/gfx/platform/mod.rs b/components/gfx/platform/mod.rs index 47ba97cc1e0..9a505c14284 100644 --- a/components/gfx/platform/mod.rs +++ b/components/gfx/platform/mod.rs @@ -2,19 +2,19 @@ * 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/. */ -#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))] +#[cfg(any(target_os = "linux", target_os = "android"))] pub use platform::freetype::{font, font_context}; #[cfg(any(target_os = "linux", target_os = "android"))] pub use platform::freetype::{font_list, font_template}; #[cfg(target_os = "windows")] -pub use platform::windows::{font_list, font_template}; +pub use platform::windows::{font, font_context, font_list, font_template}; #[cfg(target_os = "macos")] pub use platform::macos::{font, font_context, font_list, font_template}; -#[cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))] +#[cfg(any(target_os = "linux", target_os = "android"))] mod freetype { use libc::c_char; use std::ffi::CStr; @@ -46,6 +46,8 @@ mod macos { #[cfg(target_os = "windows")] mod windows { + pub mod font; + pub mod font_context; pub mod font_list; pub mod font_template; } diff --git a/components/gfx/platform/windows/font.rs b/components/gfx/platform/windows/font.rs new file mode 100644 index 00000000000..7397d216599 --- /dev/null +++ b/components/gfx/platform/windows/font.rs @@ -0,0 +1,204 @@ +/* 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/. */ + +// NOTE: https://www.chromium.org/directwrite-font-proxy has useful +// information for an approach that we'll likely need to take when the +// renderer moves to a sandboxed process. + +use app_units::Au; +use dwrote::{Font, FontFace}; +use dwrote::{FontWeight, FontStretch, FontStyle}; +use font::{FontHandleMethods, FontMetrics, FontTableMethods}; +use font::{FontTableTag, FractionalPixel}; +use platform::font_template::FontTemplateData; +use platform::windows::font_context::FontContextHandle; +use platform::windows::font_list::font_from_atom; +use std::sync::Arc; +use style::computed_values::{font_stretch, font_weight}; +use text::glyph::GlyphId; + +// 1em = 12pt = 16px, assuming 72 points per inch and 96 px per inch +fn pt_to_px(pt: f64) -> f64 { pt / 72. * 96. } +fn em_to_px(em: f64) -> f64 { em * 16. } +fn au_from_em(em: f64) -> Au { Au::from_f64_px(em_to_px(em)) } +fn au_from_pt(pt: f64) -> Au { Au::from_f64_px(pt_to_px(pt)) } + +pub struct FontTable { + data: Vec<u8>, +} + +impl FontTable { + pub fn wrap(data: &[u8]) -> FontTable { + FontTable { data: data.to_vec() } + } +} + +impl FontTableMethods for FontTable { + fn buffer(&self) -> &[u8] { + &self.data + } +} + +#[derive(Debug)] +pub struct FontHandle { + font_data: Arc<FontTemplateData>, + font: Font, + face: FontFace, + em_size: f32, + du_per_em: f32, + du_to_px: f32, + scaled_du_to_px: f32, +} + +impl FontHandle { +} + +impl FontHandleMethods for FontHandle { + fn new_from_template(_: &FontContextHandle, template: Arc<FontTemplateData>, pt_size: Option<Au>) + -> Result<Self, ()> + { + if let Some(_) = template.bytes { + // FIXME we should load from template.bytes + Err(()) + } else { + let font = font_from_atom(&template.identifier); + let face = font.create_font_face(); + + let pt_size = pt_size.unwrap_or(au_from_pt(12.)); + let du_per_em = face.metrics().designUnitsPerEm as f32; + + let em_size = pt_size.to_f32_px() / 16.; + let design_units_per_pixel = du_per_em / 16.; + + let design_units_to_pixels = 1. / design_units_per_pixel; + let scaled_design_units_to_pixels = em_size / design_units_per_pixel; + + Ok(FontHandle { + font_data: template.clone(), + font: font, + face: face, + em_size: em_size, + du_per_em: du_per_em, + du_to_px: design_units_to_pixels, + scaled_du_to_px: scaled_design_units_to_pixels, + }) + } + } + + fn template(&self) -> Arc<FontTemplateData> { + self.font_data.clone() + } + + fn family_name(&self) -> String { + self.font.family_name() + } + + fn face_name(&self) -> String { + self.font.face_name() + } + + fn is_italic(&self) -> bool { + match self.font.style() { + FontStyle::Normal => false, + FontStyle::Oblique | FontStyle::Italic => true, + } + } + + fn boldness(&self) -> font_weight::T { + match self.font.weight() { + FontWeight::Thin => font_weight::T::Weight100, + FontWeight::ExtraLight => font_weight::T::Weight200, + FontWeight::Light => font_weight::T::Weight300, + // slightly lighter gray + FontWeight::SemiLight => font_weight::T::Weight300, + FontWeight::Regular => font_weight::T::Weight400, + FontWeight::Medium => font_weight::T::Weight500, + FontWeight::SemiBold => font_weight::T::Weight600, + FontWeight::Bold => font_weight::T::Weight700, + FontWeight::ExtraBold => font_weight::T::Weight800, + FontWeight::Black => font_weight::T::Weight900, + // slightly blacker black + FontWeight::ExtraBlack => font_weight::T::Weight900, + } + } + + fn stretchiness(&self) -> font_stretch::T { + match self.font.stretch() { + FontStretch::Undefined => font_stretch::T::normal, + FontStretch::UltraCondensed => font_stretch::T::ultra_condensed, + FontStretch::ExtraCondensed => font_stretch::T::extra_condensed, + FontStretch::Condensed => font_stretch::T::condensed, + FontStretch::SemiCondensed => font_stretch::T::semi_condensed, + FontStretch::Normal => font_stretch::T::normal, + FontStretch::SemiExpanded => font_stretch::T::semi_expanded, + FontStretch::Expanded => font_stretch::T::expanded, + FontStretch::ExtraExpanded => font_stretch::T::extra_expanded, + FontStretch::UltraExpanded => font_stretch::T::ultra_expanded, + } + } + + fn glyph_index(&self, codepoint: char) -> Option<GlyphId> { + let glyph = self.face.get_glyph_indices(&[codepoint as u32])[0]; + if glyph == 0 { + return None; + } + Some(glyph as GlyphId) + } + + fn glyph_h_advance(&self, glyph: GlyphId) -> Option<FractionalPixel> { + if glyph == 0 { + return None; + } + + let gm = self.face.get_design_glyph_metrics(&[glyph as u16], false)[0]; + let f = (gm.advanceWidth as f32 * self.scaled_du_to_px) as FractionalPixel; + + Some(f) + } + + /// Can this font do basic horizontal LTR shaping without Harfbuzz? + fn can_do_fast_shaping(&self) -> bool { + // TODO copy CachedKernTable from the MacOS X implementation to + // somehwere global and use it here. We could also implement the + // IDirectWriteFontFace1 interface and use the glyph kerning pair + // methods there. + false + } + + fn glyph_h_kerning(&self, _: GlyphId, _: GlyphId) -> FractionalPixel { + 0.0 + } + + fn metrics(&self) -> FontMetrics { + let dm = self.face.metrics(); + + let au_from_du = |du| -> Au { Au::from_f32_px(du as f32 * self.du_to_px) }; + let au_from_du_s = |du| -> Au { Au:: from_f32_px(du as f32 * self.scaled_du_to_px) }; + + // anything that we calculate and don't just pull out of self.face.metrics + // is pulled out here for clarity + let leading = dm.ascent - dm.capHeight; + + let metrics = FontMetrics { + underline_size: au_from_du(dm.underlineThickness as i32), + underline_offset: au_from_du_s(dm.underlinePosition as i32), + strikeout_size: au_from_du(dm.strikethroughThickness as i32), + strikeout_offset: au_from_du_s(dm.strikethroughPosition as i32), + leading: au_from_du_s(leading as i32), + x_height: au_from_du_s(dm.xHeight as i32), + em_size: au_from_em(self.em_size as f64), + ascent: au_from_du_s(dm.ascent as i32), + descent: au_from_du_s(dm.descent as i32), + max_advance: au_from_pt(0.0), // FIXME + average_advance: au_from_pt(0.0), // FIXME + line_gap: au_from_du(dm.lineGap as i32), + }; + debug!("Font metrics (@{} pt): {:?}", self.em_size * 12., metrics); + metrics + } + + fn table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> { + self.face.get_font_table(tag).map(|bytes| FontTable { data: bytes }) + } +} diff --git a/components/gfx/platform/windows/font_context.rs b/components/gfx/platform/windows/font_context.rs new file mode 100644 index 00000000000..26670bb7dd9 --- /dev/null +++ b/components/gfx/platform/windows/font_context.rs @@ -0,0 +1,21 @@ +/* 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 heapsize::HeapSizeOf; + +#[derive(Clone, Debug)] +pub struct FontContextHandle; + +impl FontContextHandle { + // *shrug* + pub fn new() -> FontContextHandle { + FontContextHandle {} + } +} + +impl HeapSizeOf for FontContextHandle { + fn heap_size_of_children(&self) -> usize { + 0 + } +} diff --git a/components/gfx/platform/windows/font_list.rs b/components/gfx/platform/windows/font_list.rs index ed7657f5519..27dfd5e73fe 100644 --- a/components/gfx/platform/windows/font_list.rs +++ b/components/gfx/platform/windows/font_list.rs @@ -2,73 +2,70 @@ * 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 gdi32; -use std::ffi::OsString; -use std::os::windows::ffi::OsStringExt; -use std::ptr; -use winapi::{LOGFONTW, LPARAM, OUT_TT_ONLY_PRECIS, VOID}; -use winapi::{c_int, DWORD, LF_FACESIZE}; +use dwrote::{Font, FontDescriptor, FontCollection}; +use servo_atoms::Atom; +use std::collections::HashMap; +use std::sync::Mutex; +use std::sync::atomic::{Ordering, AtomicUsize}; + +lazy_static! { + static ref FONT_ATOM_COUNTER: AtomicUsize = AtomicUsize::new(1); + static ref FONT_ATOM_MAP: Mutex<HashMap<Atom, FontDescriptor>> = Mutex::new(HashMap::new()); +} pub static SANS_SERIF_FONT_FAMILY: &'static str = "Arial"; pub fn system_default_family(_: &str) -> Option<String> { - None + Some("Verdana".to_owned()) } pub fn last_resort_font_families() -> Vec<String> { vec!("Arial".to_owned()) } -unsafe extern "system" fn enum_font_callback(lpelfe: *const LOGFONTW, - _: *const VOID, - _: DWORD, - lparam: LPARAM) -> c_int { - let name = (*lpelfe).lfFaceName; - let term_pos = name.iter().position(|c| *c == 0).unwrap(); - let name = OsString::from_wide(&name[0..term_pos]).into_string().unwrap(); - - let fonts = lparam as *mut Vec<String>; - let fonts = &mut *fonts; - fonts.push(name); - - 1 +pub fn for_each_available_family<F>(mut callback: F) where F: FnMut(String) { + let system_fc = FontCollection::system(); + for family in system_fc.families_iter() { + callback(family.name()); + } } -pub fn for_each_available_family<F>(mut callback: F) where F: FnMut(String) { - let mut fonts = Vec::new(); +// for_each_variation is supposed to return a string that can be +// atomized and then uniquely used to return back to this font. +// Some platforms use the full postscript name (MacOS X), or +// a font filename. +// +// For windows we're going to use just a basic integer value that +// we'll stringify, and then put them all in a HashMap with +// the actual FontDescriptor there. - let mut config = LOGFONTW { - lfHeight: 0, - lfWidth: 0, - lfEscapement: 0, - lfOrientation: 0, - lfWeight: 0, - lfItalic: 0, - lfUnderline: 0, - lfStrikeOut: 0, - lfCharSet: 0, - lfOutPrecision: OUT_TT_ONLY_PRECIS as u8, - lfClipPrecision: 0, - lfQuality: 0, - lfPitchAndFamily: 0, - lfFaceName: [0; LF_FACESIZE], - }; +pub fn for_each_variation<F>(family_name: &str, mut callback: F) where F: FnMut(String) { + let system_fc = FontCollection::system(); + if let Some(family) = system_fc.get_font_family_by_name(family_name) { + let count = family.get_font_count(); + for i in 0..count { + let font = family.get_font(i); + let index = FONT_ATOM_COUNTER.fetch_add(1, Ordering::Relaxed); + let index_str = format!("{}", index); + let atom = Atom::from(index_str.clone()); - unsafe { - let hdc = gdi32::CreateCompatibleDC(ptr::null_mut()); - gdi32::EnumFontFamiliesExW(hdc, - &mut config, - Some(enum_font_callback), - &mut fonts as *mut Vec<String> as LPARAM, - 0); - gdi32::DeleteDC(hdc); - } + { + let descriptor = font.to_descriptor(); + let mut fonts = FONT_ATOM_MAP.lock().unwrap(); + fonts.insert(atom, descriptor); + } - for family in fonts { - callback(family); + callback(index_str); + } } } -pub fn for_each_variation<F>(family_name: &str, mut callback: F) where F: FnMut(String) { - callback(family_name.to_owned()); +pub fn descriptor_from_atom(ident: &Atom) -> FontDescriptor { + let fonts = FONT_ATOM_MAP.lock().unwrap(); + fonts.get(ident).unwrap().clone() +} + +pub fn font_from_atom(ident: &Atom) -> Font { + let fonts = FONT_ATOM_MAP.lock().unwrap(); + FontCollection::system().get_font_from_descriptor(fonts.get(ident).unwrap()).unwrap() } diff --git a/components/gfx/platform/windows/font_template.rs b/components/gfx/platform/windows/font_template.rs index 933c1d596bb..5a4709610c4 100644 --- a/components/gfx/platform/windows/font_template.rs +++ b/components/gfx/platform/windows/font_template.rs @@ -2,88 +2,49 @@ * 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 gdi32; +use platform::windows::font_list::{descriptor_from_atom, font_from_atom}; use servo_atoms::Atom; -use std::ffi::OsString; -use std::io::Error; -use std::os::windows::ffi::OsStrExt; -use std::ptr; +use std::io; use webrender_traits::NativeFontHandle; -use winapi::{DWORD, LF_FACESIZE, LOGFONTW, OUT_TT_ONLY_PRECIS, WCHAR}; - -const GDI_ERROR: DWORD = 0xffffffff; #[derive(Deserialize, Serialize, Debug)] pub struct FontTemplateData { - pub bytes: Vec<u8>, + pub bytes: Option<Vec<u8>>, pub identifier: Atom, } impl FontTemplateData { pub fn new(identifier: Atom, - font_data: Option<Vec<u8>>) -> Result<FontTemplateData, Error> { - let bytes = match font_data { - Some(bytes) => { - bytes - }, - None => { - assert!(identifier.len() < LF_FACESIZE); - let name = OsString::from(identifier.as_ref()); - let buffer: Vec<WCHAR> = name.encode_wide().collect(); - let mut string: [WCHAR; LF_FACESIZE] = [0; LF_FACESIZE]; - - for (src, dest) in buffer.iter().zip(string.iter_mut()) { - *dest = *src; - } - - let config = LOGFONTW { - lfHeight: 0, - lfWidth: 0, - lfEscapement: 0, - lfOrientation: 0, - lfWeight: 0, - lfItalic: 0, - lfUnderline: 0, - lfStrikeOut: 0, - lfCharSet: 0, - lfOutPrecision: OUT_TT_ONLY_PRECIS as u8, - lfClipPrecision: 0, - lfQuality: 0, - lfPitchAndFamily: 0, - lfFaceName: string, - }; - - unsafe { - let hdc = gdi32::CreateCompatibleDC(ptr::null_mut()); - let hfont = gdi32::CreateFontIndirectW(&config as *const _); - gdi32::SelectObject(hdc, hfont as *mut _); - let size = gdi32::GetFontData(hdc, 0, 0, ptr::null_mut(), 0); - assert!(size != GDI_ERROR); - let mut buffer: Vec<u8> = vec![0; size as usize]; - let actual_size = gdi32::GetFontData(hdc, 0, 0, buffer.as_mut_ptr() as *mut _, size); - assert!(actual_size == size); - gdi32::DeleteDC(hdc); - gdi32::DeleteObject(hfont as *mut _); - buffer - } - } - }; - + font_data: Option<Vec<u8>>) -> Result<FontTemplateData, io::Error> { Ok(FontTemplateData { - bytes: bytes, + bytes: font_data, identifier: identifier, }) } pub fn bytes(&self) -> Vec<u8> { - self.bytes.clone() + if self.bytes.is_some() { + self.bytes.as_ref().unwrap().clone() + } else { + let font = font_from_atom(&self.identifier); + let face = font.create_font_face(); + let files = face.get_files(); + assert!(files.len() > 0); + + files[0].get_font_file_bytes() + } } pub fn bytes_if_in_memory(&self) -> Option<Vec<u8>> { - Some(self.bytes()) + self.bytes.clone() } pub fn native_font(&self) -> Option<NativeFontHandle> { - None + if self.bytes.is_some() { + panic!("Can't create fonts yet"); + } + + let descriptor = descriptor_from_atom(&self.identifier); + Some(descriptor) } } diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index dd1cee652f0..91a5d273c28 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -49,8 +49,8 @@ dependencies = [ "util 0.0.1", "util_tests 0.0.1", "webdriver_server 0.0.1", - "webrender 0.8.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender 0.8.1 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -278,7 +278,7 @@ dependencies = [ "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "util 0.0.1", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -294,7 +294,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -396,8 +396,8 @@ dependencies = [ "time 0.1.35 (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", - "webrender 0.8.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender 0.8.1 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -430,7 +430,7 @@ dependencies = [ "style_traits 0.0.1", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -619,6 +619,30 @@ dependencies = [ ] [[package]] +name = "dwrite-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dwrote" +version = "0.1.0" +source = "git+https://github.com/vvuk/dwrote-rs#2bf7d4792d15fccb50f1e247e4be9c2c7b893f2b" +dependencies = [ + "dwrite-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "encoding" version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -845,11 +869,11 @@ dependencies = [ "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "fontsan 0.3.2 (git+https://github.com/servo/fontsan)", "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", - "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "harfbuzz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -876,8 +900,7 @@ dependencies = [ "unicode-script 0.1.1 (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", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", "xi-unicode 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1256,7 +1279,7 @@ dependencies = [ "unicode-script 0.1.1 (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", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1296,7 +1319,7 @@ dependencies = [ "style 0.0.1", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1310,7 +1333,7 @@ dependencies = [ "profile_traits 0.0.1", "script_traits 0.0.1", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1506,7 +1529,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1544,7 +1567,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1603,7 +1626,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2136,7 +2159,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2247,6 +2270,8 @@ dependencies = [ "quote 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_codegen_internals 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2549,6 +2574,51 @@ dependencies = [ ] [[package]] +name = "syntex" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "syntex_errors 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_errors" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_pos" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_syntax" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_errors 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "target_build_utils" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2595,6 +2665,15 @@ dependencies = [ ] [[package]] +name = "term" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "thread-id" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2875,8 +2954,8 @@ dependencies = [ [[package]] name = "webrender" -version = "0.8.0" -source = "git+https://github.com/servo/webrender#a0b6ea0b51a170caf591fb281f5aba25e566158f" +version = "0.8.1" +source = "git+https://github.com/servo/webrender#0f79d9dc449e324ca8bee0b8f82bc1459ba2dba6" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2885,6 +2964,7 @@ dependencies = [ "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", @@ -2896,17 +2976,18 @@ dependencies = [ "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] name = "webrender_traits" -version = "0.8.0" -source = "git+https://github.com/servo/webrender#a0b6ea0b51a170caf591fb281f5aba25e566158f" +version = "0.8.1" +source = "git+https://github.com/servo/webrender#0f79d9dc449e324ca8bee0b8f82bc1459ba2dba6" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3064,6 +3145,8 @@ dependencies = [ "checksum dlib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd015f00d33d7e4ff66f1589fb824ccf3ccb10209b66c7b756f26ba9aa90215" "checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d" "checksum dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07c4c7cc7b396419bc0a4d90371d0cee16cb5053b53647d287c0b728000c41fe" +"checksum dwrite-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7918280f33862bc8542212d74f2149b1a87ab402fd15f4ce9a1c56582958d6e" +"checksum dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)" = "<none>" "checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" "checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" "checksum encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" @@ -3217,10 +3300,15 @@ dependencies = [ "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum syn 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "76c2db66dc579998854d84ff0ff4a81cb73e69596764d144ce7cece4d04ce6b5" "checksum synstructure 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c93b5595e44343867746223dd8de40c15e53e89f5fb252e3d20e0187a698647c" +"checksum syntex 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17e2e2ad78f4942d011750c304e9a9874717b6986c8fa2f6072f58fbd0835dcb" +"checksum syntex_errors 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0b2784ff2ca385a451f1f835dcb3926e5c61461c6468aac1e35edcbc4cd33808" +"checksum syntex_pos 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25fadff25e4db9336cd715dea4bc7d4bf51d08cc39a1463b689661f1dea6893c" +"checksum syntex_syntax 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c3c7d1082d30f7042d1e7b00bd2ab0466daa84529fa13891e9312d8a32fd97e" "checksum target_build_utils 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a1be18d4d908e4e5697908de04fdd5099505463fc8eaf1ceb8133ae486936aa" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" "checksum tempfile 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9270837a93bad1b1dac18fe67e786b3c960513af86231f6f4f57fddd594ff0c8" "checksum tendril 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cebf864c2d90394a1b66d6fe45963f9a177f2af81a0edea5060f77627f9c4587" +"checksum term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a" "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" "checksum thread_local 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "55dd963dbaeadc08aa7266bf7f91c3154a7805e32bb94b820b769d2ef3b4744d" "checksum threadpool 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59f6d3eff89920113dac9db44dde461d71d01e88a5b57b258a0466c32b5d7fe1" @@ -3249,8 +3337,8 @@ dependencies = [ "checksum wayland-sys 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9633f7fe5de56544215f82eaf1b76bf1b584becf7f08b58cbef4c2c7d10e803a" "checksum wayland-window 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "309b69d3a863c9c21422d889fb7d98cf02f8a2ca054960a49243ce5b67ad884c" "checksum webdriver 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee2d66e90672022ced375134329c57be4db228b19b120b97b744a469c381be06" -"checksum webrender 0.8.0 (git+https://github.com/servo/webrender)" = "<none>" -"checksum webrender_traits 0.8.0 (git+https://github.com/servo/webrender)" = "<none>" +"checksum webrender 0.8.1 (git+https://github.com/servo/webrender)" = "<none>" +"checksum webrender_traits 0.8.1 (git+https://github.com/servo/webrender)" = "<none>" "checksum websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a1a6ea5ed0367f32eb3d94dcc58859ef4294b5f75ba983dbf56ac314af45d" "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" diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 2c0cc39a25b..f4cf4da97c5 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -248,7 +248,7 @@ dependencies = [ "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "util 0.0.1", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -264,7 +264,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -336,8 +336,8 @@ dependencies = [ "time 0.1.35 (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", - "webrender 0.8.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender 0.8.1 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -370,7 +370,7 @@ dependencies = [ "style_traits 0.0.1", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -559,6 +559,30 @@ dependencies = [ ] [[package]] +name = "dwrite-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dwrote" +version = "0.1.0" +source = "git+https://github.com/vvuk/dwrote-rs#2bf7d4792d15fccb50f1e247e4be9c2c7b893f2b" +dependencies = [ + "dwrite-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_codegen 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "encoding" version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -744,11 +768,11 @@ dependencies = [ "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "fontsan 0.3.2 (git+https://github.com/servo/fontsan)", "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", - "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "harfbuzz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -775,8 +799,7 @@ dependencies = [ "unicode-script 0.1.1 (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", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", "xi-unicode 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1146,7 +1169,7 @@ dependencies = [ "unicode-script 0.1.1 (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", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1179,7 +1202,7 @@ dependencies = [ "style 0.0.1", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1193,7 +1216,7 @@ dependencies = [ "profile_traits 0.0.1", "script_traits 0.0.1", "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1389,7 +1412,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -1427,7 +1450,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1464,7 +1487,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1957,7 +1980,7 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2050,6 +2073,8 @@ dependencies = [ "quote 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_codegen_internals 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2120,8 +2145,8 @@ dependencies = [ "url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webdriver_server 0.0.1", - "webrender 0.8.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender 0.8.1 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] @@ -2378,6 +2403,51 @@ dependencies = [ ] [[package]] +name = "syntex" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "syntex_errors 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_errors" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_pos" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntex_syntax" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_errors 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_pos 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "target_build_utils" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2424,6 +2494,15 @@ dependencies = [ ] [[package]] +name = "term" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "thread-id" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2689,8 +2768,8 @@ dependencies = [ [[package]] name = "webrender" -version = "0.8.0" -source = "git+https://github.com/servo/webrender#a0b6ea0b51a170caf591fb281f5aba25e566158f" +version = "0.8.1" +source = "git+https://github.com/servo/webrender#0f79d9dc449e324ca8bee0b8f82bc1459ba2dba6" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2699,6 +2778,7 @@ dependencies = [ "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.1 (git+https://github.com/servo/rust-freetype)", @@ -2710,17 +2790,18 @@ dependencies = [ "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.8.0 (git+https://github.com/servo/webrender)", + "webrender_traits 0.8.1 (git+https://github.com/servo/webrender)", ] [[package]] name = "webrender_traits" -version = "0.8.0" -source = "git+https://github.com/servo/webrender#a0b6ea0b51a170caf591fb281f5aba25e566158f" +version = "0.8.1" +source = "git+https://github.com/servo/webrender#0f79d9dc449e324ca8bee0b8f82bc1459ba2dba6" dependencies = [ "app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)", "euclid 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2876,6 +2957,8 @@ dependencies = [ "checksum dlib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd015f00d33d7e4ff66f1589fb824ccf3ccb10209b66c7b756f26ba9aa90215" "checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d" "checksum dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07c4c7cc7b396419bc0a4d90371d0cee16cb5053b53647d287c0b728000c41fe" +"checksum dwrite-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7918280f33862bc8542212d74f2149b1a87ab402fd15f4ce9a1c56582958d6e" +"checksum dwrote 0.1.0 (git+https://github.com/vvuk/dwrote-rs)" = "<none>" "checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" "checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" "checksum encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" @@ -3021,10 +3104,15 @@ dependencies = [ "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum syn 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "76c2db66dc579998854d84ff0ff4a81cb73e69596764d144ce7cece4d04ce6b5" "checksum synstructure 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c93b5595e44343867746223dd8de40c15e53e89f5fb252e3d20e0187a698647c" +"checksum syntex 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17e2e2ad78f4942d011750c304e9a9874717b6986c8fa2f6072f58fbd0835dcb" +"checksum syntex_errors 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0b2784ff2ca385a451f1f835dcb3926e5c61461c6468aac1e35edcbc4cd33808" +"checksum syntex_pos 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25fadff25e4db9336cd715dea4bc7d4bf51d08cc39a1463b689661f1dea6893c" +"checksum syntex_syntax 0.48.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c3c7d1082d30f7042d1e7b00bd2ab0466daa84529fa13891e9312d8a32fd97e" "checksum target_build_utils 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a1be18d4d908e4e5697908de04fdd5099505463fc8eaf1ceb8133ae486936aa" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" "checksum tempfile 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9270837a93bad1b1dac18fe67e786b3c960513af86231f6f4f57fddd594ff0c8" "checksum tendril 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cebf864c2d90394a1b66d6fe45963f9a177f2af81a0edea5060f77627f9c4587" +"checksum term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3deff8a2b3b6607d6d7cc32ac25c0b33709453ca9cceac006caac51e963cf94a" "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" "checksum thread_local 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "55dd963dbaeadc08aa7266bf7f91c3154a7805e32bb94b820b769d2ef3b4744d" "checksum threadpool 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "59f6d3eff89920113dac9db44dde461d71d01e88a5b57b258a0466c32b5d7fe1" @@ -3052,8 +3140,8 @@ dependencies = [ "checksum wayland-sys 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9633f7fe5de56544215f82eaf1b76bf1b584becf7f08b58cbef4c2c7d10e803a" "checksum wayland-window 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "309b69d3a863c9c21422d889fb7d98cf02f8a2ca054960a49243ce5b67ad884c" "checksum webdriver 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee2d66e90672022ced375134329c57be4db228b19b120b97b744a469c381be06" -"checksum webrender 0.8.0 (git+https://github.com/servo/webrender)" = "<none>" -"checksum webrender_traits 0.8.0 (git+https://github.com/servo/webrender)" = "<none>" +"checksum webrender 0.8.1 (git+https://github.com/servo/webrender)" = "<none>" +"checksum webrender_traits 0.8.1 (git+https://github.com/servo/webrender)" = "<none>" "checksum websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a1a6ea5ed0367f32eb3d94dcc58859ef4294b5f75ba983dbf56ac314af45d" "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" diff --git a/resources/shaders/blur.fs.glsl b/resources/shaders/blur.fs.glsl deleted file mode 100644 index 2af2a7ebabb..00000000000 --- a/resources/shaders/blur.fs.glsl +++ /dev/null @@ -1,44 +0,0 @@ -/* 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/. */ - -// `vBorderPosition` is the position of the source texture in the atlas. - -float gauss(float x, float sigma) { - return (1.0 / sqrt(6.283185307179586 * sigma * sigma)) * exp(-(x * x) / (2.0 * sigma * sigma)); -} - -void main(void) { -#ifdef SERVO_ES2 - // TODO(gw): for loops have to be unrollable on es2. - SetFragColor(vec4(1.0, 0.0, 0.0, 1.0)); -#else - vec2 sideOffsets = (vDestTextureSize - vSourceTextureSize) / 2.0; - int range = int(vBlurRadius) * 3; - float sigma = vBlurRadius / 2.0; - vec4 value = vec4(0.0); - vec2 sourceTextureUvOrigin = vBorderPosition.xy; - vec2 sourceTextureUvSize = vBorderPosition.zw - sourceTextureUvOrigin; - for (int offset = -range; offset <= range; offset++) { - float offsetF = float(offset); - vec2 lColorTexCoord = (vColorTexCoord.xy * vDestTextureSize - sideOffsets) / - vSourceTextureSize; - lColorTexCoord += vec2(offsetF) / vSourceTextureSize * uDirection; - vec4 x = lColorTexCoord.x >= 0.0 && - lColorTexCoord.x <= 1.0 && - lColorTexCoord.y >= 0.0 && - lColorTexCoord.y <= 1.0 ? - texture(sDiffuse, lColorTexCoord * sourceTextureUvSize + sourceTextureUvOrigin) : - vec4(0.0); - - // Alpha must be premultiplied in order to properly blur the alpha channel. - value += vec4(x.rgb * x.a, x.a) * gauss(offsetF, sigma); - } - - // Unpremultiply the alpha. - value = vec4(value.rgb / value.a, value.a); - - SetFragColor(value); -#endif -} - diff --git a/resources/shaders/blur.vs.glsl b/resources/shaders/blur.vs.glsl deleted file mode 100644 index 4e03cf38a67..00000000000 --- a/resources/shaders/blur.vs.glsl +++ /dev/null @@ -1,14 +0,0 @@ -/* 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/. */ - -void main(void) -{ - vColorTexCoord = aColorTexCoordRectTop.xy; - vBorderPosition = aBorderPosition; - vBlurRadius = aBlurRadius; - vDestTextureSize = aDestTextureSize; - vSourceTextureSize = aSourceTextureSize; - gl_Position = uTransform * vec4(aPosition, 1.0); -} - diff --git a/resources/shaders/cs_blur.fs.glsl b/resources/shaders/cs_blur.fs.glsl new file mode 100644 index 00000000000..4217b780f2e --- /dev/null +++ b/resources/shaders/cs_blur.fs.glsl @@ -0,0 +1,40 @@ +#line 1 +/* 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/. */ + +// TODO(gw): Write a fast path blur that handles smaller blur radii +// with a offset / weight uniform table and a constant +// loop iteration count! + +// TODO(gw): Make use of the bilinear sampling trick to reduce +// the number of texture fetches needed for a gaussian blur. + +float gauss(float x, float sigma) { + return (1.0 / sqrt(6.283185307179586 * sigma * sigma)) * exp(-(x * x) / (2.0 * sigma * sigma)); +} + +void main(void) { + vec4 sample = texture(sCache, vUv); + vec4 color = vec4(sample.rgb * sample.a, sample.a) * gauss(0.0, vSigma); + + for (int i=1 ; i < vBlurRadius ; ++i) { + vec2 offset = vec2(float(i)) * vOffsetScale; + + vec2 st0 = clamp(vUv.xy + offset, vUvRect.xy, vUvRect.zw); + vec4 color0 = texture(sCache, vec3(st0, vUv.z)); + + vec2 st1 = clamp(vUv.xy - offset, vUvRect.xy, vUvRect.zw); + vec4 color1 = texture(sCache, vec3(st1, vUv.z)); + + // Alpha must be premultiplied in order to properly blur the alpha channel. + float weight = gauss(float(i), vSigma); + color += vec4(color0.rgb * color0.a, color0.a) * weight; + color += vec4(color1.rgb * color1.a, color1.a) * weight; + } + + // Unpremultiply the alpha. + color.rgb /= color.a; + + oFragColor = color; +} diff --git a/resources/shaders/cs_blur.glsl b/resources/shaders/cs_blur.glsl new file mode 100644 index 00000000000..110b748b7dc --- /dev/null +++ b/resources/shaders/cs_blur.glsl @@ -0,0 +1,10 @@ +#line 1 +/* 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/. */ + +varying vec3 vUv; +flat varying vec4 vUvRect; +flat varying vec2 vOffsetScale; +flat varying float vSigma; +flat varying int vBlurRadius; diff --git a/resources/shaders/cs_blur.vs.glsl b/resources/shaders/cs_blur.vs.glsl new file mode 100644 index 00000000000..1e89b60e5e5 --- /dev/null +++ b/resources/shaders/cs_blur.vs.glsl @@ -0,0 +1,45 @@ +#line 1 +/* 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/. */ + +// Applies a separable gaussian blur in one direction, as specified +// by the dir field in the blur command. + +#define DIR_HORIZONTAL 0 +#define DIR_VERTICAL 1 + +void main(void) { + BlurCommand cmd = fetch_blur(gl_InstanceID); + RenderTaskData task = fetch_render_task(cmd.task_id); + RenderTaskData src_task = fetch_render_task(cmd.src_task_id); + + vec4 local_rect = task.data0; + + vec2 pos = mix(local_rect.xy, + local_rect.xy + local_rect.zw, + aPosition.xy); + + vec2 texture_size = textureSize(sCache, 0).xy; + vUv.z = src_task.data1.x; + vBlurRadius = int(task.data1.y); + vSigma = task.data1.y * 0.5; + + switch (cmd.dir) { + case DIR_HORIZONTAL: + vOffsetScale = vec2(1.0 / texture_size.x, 0.0); + break; + case DIR_VERTICAL: + vOffsetScale = vec2(0.0, 1.0 / texture_size.y); + break; + } + + vUvRect = vec4(src_task.data0.xy, src_task.data0.xy + src_task.data0.zw); + vUvRect /= texture_size.xyxy; + + vec2 uv0 = src_task.data0.xy / texture_size; + vec2 uv1 = (src_task.data0.xy + src_task.data0.zw) / texture_size; + vUv.xy = mix(uv0, uv1, aPosition.xy); + + gl_Position = uTransform * vec4(pos, 0.0, 1.0); +} diff --git a/resources/shaders/cs_text_run.fs.glsl b/resources/shaders/cs_text_run.fs.glsl new file mode 100644 index 00000000000..8e9b40db247 --- /dev/null +++ b/resources/shaders/cs_text_run.fs.glsl @@ -0,0 +1,9 @@ +#line 1 +/* 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/. */ + +void main(void) { + float a = texture(sColor0, vUv).a; + oFragColor = vec4(vColor.rgb, vColor.a * a); +} diff --git a/resources/shaders/cs_text_run.glsl b/resources/shaders/cs_text_run.glsl new file mode 100644 index 00000000000..39ed226b264 --- /dev/null +++ b/resources/shaders/cs_text_run.glsl @@ -0,0 +1,7 @@ +#line 1 +/* 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/. */ + +varying vec2 vUv; +flat varying vec4 vColor; diff --git a/resources/shaders/cs_text_run.vs.glsl b/resources/shaders/cs_text_run.vs.glsl new file mode 100644 index 00000000000..3ac5314bce3 --- /dev/null +++ b/resources/shaders/cs_text_run.vs.glsl @@ -0,0 +1,35 @@ +#line 1 +/* 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/. */ + +// Draw a text run to a cache target. These are always +// drawn un-transformed. These are used for effects such +// as text-shadow. + +void main(void) { + CachePrimitiveInstance cpi = fetch_cache_instance(gl_InstanceID); + RenderTaskData task = fetch_render_task(cpi.render_task_index); + TextRun text = fetch_text_run(cpi.specific_prim_index); + Glyph glyph = fetch_glyph(cpi.sub_index); + PrimitiveGeometry pg = fetch_prim_geometry(cpi.global_prim_index); + + // Glyphs size is already in device-pixels. + // The render task origin is in device-pixels. Offset that by + // the glyph offset, relative to its primitive bounding rect. + vec2 size = glyph.uv_rect.zw - glyph.uv_rect.xy; + vec2 origin = task.data0.xy + uDevicePixelRatio * (glyph.offset.xy - pg.local_rect.xy); + vec4 local_rect = vec4(origin, size); + + vec2 texture_size = vec2(textureSize(sColor0, 0)); + vec2 st0 = glyph.uv_rect.xy / texture_size; + vec2 st1 = glyph.uv_rect.zw / texture_size; + + vec2 pos = mix(local_rect.xy, + local_rect.xy + local_rect.zw, + aPosition.xy); + vUv = mix(st0, st1, aPosition.xy); + vColor = text.color; + + gl_Position = uTransform * vec4(pos, 0.0, 1.0); +} diff --git a/resources/shaders/debug_font.fs.glsl b/resources/shaders/debug_font.fs.glsl index a10e0da4ceb..5550fa93447 100644 --- a/resources/shaders/debug_font.fs.glsl +++ b/resources/shaders/debug_font.fs.glsl @@ -5,9 +5,9 @@ void main(void) { #ifdef SERVO_ES2 - float alpha = texture(sDiffuse, vColorTexCoord.xy).a; + float alpha = texture(sColor0, vColorTexCoord.xy).a; #else - float alpha = texture(sDiffuse, vColorTexCoord.xy).r; + float alpha = texture(sColor0, vColorTexCoord.xy).r; #endif oFragColor = vec4(vColor.xyz, vColor.w * alpha); } diff --git a/resources/shaders/prim_shared.glsl b/resources/shaders/prim_shared.glsl index e4803c42a6f..b98d9d2b72f 100644 --- a/resources/shaders/prim_shared.glsl +++ b/resources/shaders/prim_shared.glsl @@ -277,10 +277,31 @@ PrimitiveInstance fetch_instance(int index) { return pi; } +struct BlurCommand { + int task_id; + int src_task_id; + int dir; +}; + +BlurCommand fetch_blur(int index) { + BlurCommand blur; + + int offset = index * 1; + + ivec4 data0 = int_data[offset + 0]; + + blur.task_id = data0.x; + blur.src_task_id = data0.y; + blur.dir = data0.z; + + return blur; +} + struct CachePrimitiveInstance { int global_prim_index; int specific_prim_index; int render_task_index; + int sub_index; }; CachePrimitiveInstance fetch_cache_instance(int index) { @@ -293,6 +314,7 @@ CachePrimitiveInstance fetch_cache_instance(int index) { cpi.global_prim_index = data0.x; cpi.specific_prim_index = data0.y; cpi.render_task_index = data0.z; + cpi.sub_index = data0.w; return cpi; } diff --git a/resources/shaders/ps_cache_image.fs.glsl b/resources/shaders/ps_cache_image.fs.glsl new file mode 100644 index 00000000000..36ab69e3136 --- /dev/null +++ b/resources/shaders/ps_cache_image.fs.glsl @@ -0,0 +1,7 @@ +/* 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/. */ + +void main(void) { + oFragColor = texture(sCache, vUv); +} diff --git a/resources/shaders/ps_cache_image.glsl b/resources/shaders/ps_cache_image.glsl new file mode 100644 index 00000000000..a5930ae066d --- /dev/null +++ b/resources/shaders/ps_cache_image.glsl @@ -0,0 +1,5 @@ +/* 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/. */ + +varying vec3 vUv; diff --git a/resources/shaders/ps_cache_image.vs.glsl b/resources/shaders/ps_cache_image.vs.glsl new file mode 100644 index 00000000000..57e380bbbed --- /dev/null +++ b/resources/shaders/ps_cache_image.vs.glsl @@ -0,0 +1,27 @@ +#line 1 +/* 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/. */ + +// Draw a cached primitive (e.g. a blurred text run) from the +// target cache to the framebuffer, applying tile clip boundaries. + +void main(void) { + Primitive prim = load_primitive(gl_InstanceID); + + VertexInfo vi = write_vertex(prim.local_rect, + prim.local_clip_rect, + prim.layer, + prim.tile); + + RenderTaskData child_task = fetch_render_task(prim.user_data.x); + vUv.z = child_task.data1.x; + + vec2 texture_size = vec2(textureSize(sCache, 0)); + vec2 uv0 = child_task.data0.xy / texture_size; + vec2 uv1 = (child_task.data0.xy + child_task.data0.zw) / texture_size; + + vec2 f = (vi.local_clamped_pos - prim.local_rect.xy) / prim.local_rect.zw; + + vUv.xy = mix(uv0, uv1, f); +} diff --git a/resources/shaders/ps_image.fs.glsl b/resources/shaders/ps_image.fs.glsl index b685e4772e1..f425fb33988 100644 --- a/resources/shaders/ps_image.fs.glsl +++ b/resources/shaders/ps_image.fs.glsl @@ -25,5 +25,5 @@ void main(void) { vec2 st = vTextureOffset + ((position_in_tile / vStretchSize) * vTextureSize); alpha = alpha * float(all(bvec2(step(position_in_tile, vStretchSize)))); - oFragColor = vec4(1, 1, 1, alpha) * texture(sDiffuse, st); + oFragColor = vec4(1, 1, 1, alpha) * texture(sColor0, st); } diff --git a/resources/shaders/ps_image.vs.glsl b/resources/shaders/ps_image.vs.glsl index b4e7a3e80af..a3eb7808e56 100644 --- a/resources/shaders/ps_image.vs.glsl +++ b/resources/shaders/ps_image.vs.glsl @@ -23,7 +23,7 @@ void main(void) { #endif // vUv will contain how many times this image has wrapped around the image size. - vec2 texture_size = vec2(textureSize(sDiffuse, 0)); + vec2 texture_size = vec2(textureSize(sColor0, 0)); vec2 st0 = image.st_rect.xy / texture_size; vec2 st1 = image.st_rect.zw / texture_size; diff --git a/resources/shaders/ps_image_clip.fs.glsl b/resources/shaders/ps_image_clip.fs.glsl index 45907a97ab2..5d48c94b838 100644 --- a/resources/shaders/ps_image_clip.fs.glsl +++ b/resources/shaders/ps_image_clip.fs.glsl @@ -28,5 +28,5 @@ void main(void) { vec2 st = vTextureOffset + ((position_in_tile / vStretchSize) * vTextureSize); alpha = alpha * float(all(bvec2(step(position_in_tile, vStretchSize)))); - oFragColor = texture(sDiffuse, st) * vec4(1, 1, 1, alpha); + oFragColor = texture(sColor0, st) * vec4(1, 1, 1, alpha); } diff --git a/resources/shaders/ps_image_clip.vs.glsl b/resources/shaders/ps_image_clip.vs.glsl index 5e9161008e5..bfbf54bc857 100644 --- a/resources/shaders/ps_image_clip.vs.glsl +++ b/resources/shaders/ps_image_clip.vs.glsl @@ -27,7 +27,7 @@ void main(void) { write_clip(clip); // vUv will contain how many times this image has wrapped around the image size. - vec2 texture_size = vec2(textureSize(sDiffuse, 0)); + vec2 texture_size = vec2(textureSize(sColor0, 0)); vec2 st0 = image.st_rect.xy / texture_size; vec2 st1 = image.st_rect.zw / texture_size; diff --git a/resources/shaders/ps_text_run.fs.glsl b/resources/shaders/ps_text_run.fs.glsl index f0948b207e3..a3dcacced46 100644 --- a/resources/shaders/ps_text_run.fs.glsl +++ b/resources/shaders/ps_text_run.fs.glsl @@ -4,9 +4,9 @@ void main(void) { #ifdef WR_FEATURE_SUBPIXEL_AA - oFragColor = texture(sDiffuse, vUv); + oFragColor = texture(sColor0, vUv); #else - float a = texture(sDiffuse, vUv).a; + float a = texture(sColor0, vUv).a; #ifdef WR_FEATURE_TRANSFORM float alpha = 0.0; init_transform_fs(vLocalPos, vLocalRect, alpha); diff --git a/resources/shaders/ps_text_run.vs.glsl b/resources/shaders/ps_text_run.vs.glsl index 3a6e009447e..9adfbffc76b 100644 --- a/resources/shaders/ps_text_run.vs.glsl +++ b/resources/shaders/ps_text_run.vs.glsl @@ -25,7 +25,7 @@ void main(void) { vec2 f = (vi.local_clamped_pos - vi.local_rect.p0) / (vi.local_rect.p1 - vi.local_rect.p0); #endif - vec2 texture_size = vec2(textureSize(sDiffuse, 0)); + vec2 texture_size = vec2(textureSize(sColor0, 0)); vec2 st0 = glyph.uv_rect.xy / texture_size; vec2 st1 = glyph.uv_rect.zw / texture_size; diff --git a/resources/shaders/shared.glsl b/resources/shaders/shared.glsl index ffa16a1d770..f250a709c6d 100644 --- a/resources/shaders/shared.glsl +++ b/resources/shaders/shared.glsl @@ -33,7 +33,9 @@ //====================================================================================== // Shared shader uniforms //====================================================================================== -uniform sampler2D sDiffuse; +uniform sampler2D sColor0; +uniform sampler2D sColor1; +uniform sampler2D sColor2; uniform sampler2D sMask; //====================================================================================== |