mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Fix the build and tidy and address nits
This commit is contained in:
parent
168a526221
commit
f829eaea03
3 changed files with 25 additions and 31 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -138,7 +138,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "azure"
|
name = "azure"
|
||||||
version = "0.36.1"
|
version = "0.36.1"
|
||||||
source = "git+https://github.com/servo/rust-azure#37a57b3d862bcf345d1413c7ebb534ff69daab3b"
|
source = "git+https://github.com/servo/rust-azure#5996612af3139cc3c5eafb019d8218f8ca1634de"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cmake 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cmake 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2504,8 +2504,9 @@ version = "0.1.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3711,7 +3712,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raqote"
|
name = "raqote"
|
||||||
version = "0.6.2-alpha.0"
|
version = "0.6.2-alpha.0"
|
||||||
source = "git+https://github.com/jrmuizel/raqote#2d9a0fbb419d10e066fb49e121a45fce1e1f2abe"
|
source = "git+https://github.com/jrmuizel/raqote#b3675e6cc1ac1d854605918f6613b64636d5e47b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"font-kit 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"font-kit 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -256,7 +256,7 @@ impl GenericDrawTarget for azure_hl::DrawTarget {
|
||||||
.map(|s| SourceSurface::Azure(s))
|
.map(|s| SourceSurface::Azure(s))
|
||||||
}
|
}
|
||||||
fn draw_surface(
|
fn draw_surface(
|
||||||
&self,
|
&mut self,
|
||||||
surface: SourceSurface,
|
surface: SourceSurface,
|
||||||
dest: Rect<f64>,
|
dest: Rect<f64>,
|
||||||
source: Rect<f64>,
|
source: Rect<f64>,
|
||||||
|
@ -269,7 +269,8 @@ impl GenericDrawTarget for azure_hl::DrawTarget {
|
||||||
draw_options.as_azure().composition,
|
draw_options.as_azure().composition,
|
||||||
azure_hl::AntialiasMode::None,
|
azure_hl::AntialiasMode::None,
|
||||||
);
|
);
|
||||||
self.draw_surface(
|
azure_hl::DrawTarget::draw_surface(
|
||||||
|
self,
|
||||||
surface.into_azure(),
|
surface.into_azure(),
|
||||||
dest.to_azure_style(),
|
dest.to_azure_style(),
|
||||||
source.to_azure_style(),
|
source.to_azure_style(),
|
||||||
|
|
|
@ -140,14 +140,14 @@ impl<'a> StrokeOptions<'a> {
|
||||||
StrokeOptions::Raqote(options, _) => options.miter_limit = _val,
|
StrokeOptions::Raqote(options, _) => options.miter_limit = _val,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn set_line_join(&mut self, _val: LineJoinStyle) {
|
pub fn set_line_join(&mut self, val: LineJoinStyle) {
|
||||||
match self {
|
match self {
|
||||||
StrokeOptions::Raqote(options, _) => options.join = _val.to_raqote_style(),
|
StrokeOptions::Raqote(options, _) => options.join = val.to_raqote_style(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn set_line_cap(&mut self, _val: LineCapStyle) {
|
pub fn set_line_cap(&mut self, val: LineCapStyle) {
|
||||||
match self {
|
match self {
|
||||||
StrokeOptions::Raqote(options, _) => options.cap = _val.to_raqote_style(),
|
StrokeOptions::Raqote(options, _) => options.cap = val.to_raqote_style(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn as_raqote(&self) -> &raqote::StrokeStyle {
|
pub fn as_raqote(&self) -> &raqote::StrokeStyle {
|
||||||
|
@ -158,9 +158,9 @@ impl<'a> StrokeOptions<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DrawOptions {
|
impl DrawOptions {
|
||||||
pub fn set_alpha(&mut self, _val: f32) {
|
pub fn set_alpha(&mut self, val: f32) {
|
||||||
match self {
|
match self {
|
||||||
DrawOptions::Raqote(draw_options) => draw_options.alpha = _val,
|
DrawOptions::Raqote(draw_options) => draw_options.alpha = val,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn as_raqote(&self) -> &raqote::DrawOptions {
|
pub fn as_raqote(&self) -> &raqote::DrawOptions {
|
||||||
|
@ -188,7 +188,9 @@ impl Path {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn copy_to_builder(&self) -> Box<dyn GenericPathBuilder> {
|
pub fn copy_to_builder(&self) -> Box<dyn GenericPathBuilder> {
|
||||||
Box::new(PathBuilder(Some(raqote::PathBuilder::from(self.as_raqote().clone()))))
|
Box::new(PathBuilder(Some(raqote::PathBuilder::from(
|
||||||
|
self.as_raqote().clone(),
|
||||||
|
))))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_raqote(&self) -> &raqote::Path {
|
pub fn as_raqote(&self) -> &raqote::Path {
|
||||||
|
@ -232,12 +234,7 @@ impl GenericDrawTarget for raqote::DrawTarget {
|
||||||
let data = surface.as_raqote();
|
let data = surface.as_raqote();
|
||||||
let s = unsafe { std::slice::from_raw_parts(data.as_ptr() as *const u32, data.len() / 4) };
|
let s = unsafe { std::slice::from_raw_parts(data.as_ptr() as *const u32, data.len() / 4) };
|
||||||
dt.get_data_mut().copy_from_slice(s);
|
dt.get_data_mut().copy_from_slice(s);
|
||||||
raqote::DrawTarget::copy_surface(
|
raqote::DrawTarget::copy_surface(self, &dt, source.to_box2d(), destination);
|
||||||
self,
|
|
||||||
&dt,
|
|
||||||
source.to_box2d(),
|
|
||||||
destination
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
fn create_gradient_stops(
|
fn create_gradient_stops(
|
||||||
&self,
|
&self,
|
||||||
|
@ -278,10 +275,11 @@ impl GenericDrawTarget for raqote::DrawTarget {
|
||||||
width: source.size.width as i32,
|
width: source.size.width as i32,
|
||||||
height: source.size.height as i32,
|
height: source.size.height as i32,
|
||||||
data: unsafe {
|
data: unsafe {
|
||||||
std::slice::from_raw_parts(
|
std::slice::from_raw_parts(
|
||||||
v.as_ptr() as *const u32,
|
v.as_ptr() as *const u32,
|
||||||
v.len() * std::mem::size_of::<u8>(),
|
v.len() * std::mem::size_of::<u8>(),
|
||||||
) },
|
)
|
||||||
|
},
|
||||||
};
|
};
|
||||||
raqote::DrawTarget::draw_image_with_size_at(
|
raqote::DrawTarget::draw_image_with_size_at(
|
||||||
self,
|
self,
|
||||||
|
@ -541,14 +539,6 @@ impl ToRaqoteStyle for LineCapStyle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(pylbrecht)
|
|
||||||
#[cfg(feature = "raqote_backend")]
|
|
||||||
impl Clone for Pattern<'_> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
unimplemented!();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait ToRaqoteSource<'a> {
|
pub trait ToRaqoteSource<'a> {
|
||||||
fn to_raqote_source(self) -> Option<raqote::Source<'a>>;
|
fn to_raqote_source(self) -> Option<raqote::Source<'a>>;
|
||||||
}
|
}
|
||||||
|
@ -571,7 +561,9 @@ impl<'a> ToRaqoteSource<'a> for FillOrStrokeStyle {
|
||||||
let data = &surface.surface_data[..];
|
let data = &surface.surface_data[..];
|
||||||
Some(raqote::Source::Image(
|
Some(raqote::Source::Image(
|
||||||
raqote::Image {
|
raqote::Image {
|
||||||
data: unsafe { std::slice::from_raw_parts(data.as_ptr() as *const u32, data.len() / 4) },
|
data: unsafe {
|
||||||
|
std::slice::from_raw_parts(data.as_ptr() as *const u32, data.len() / 4)
|
||||||
|
},
|
||||||
width: surface.surface_size.width as i32,
|
width: surface.surface_size.width as i32,
|
||||||
height: surface.surface_size.height as i32,
|
height: surface.surface_size.height as i32,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue