mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement Source::Surface for FillOrStrokeStyle with raqote
This commit is contained in:
parent
8a57876482
commit
168a526221
1 changed files with 14 additions and 1 deletions
|
@ -554,6 +554,7 @@ pub trait ToRaqoteSource<'a> {
|
|||
}
|
||||
|
||||
impl<'a> ToRaqoteSource<'a> for FillOrStrokeStyle {
|
||||
#[allow(unsafe_code)]
|
||||
fn to_raqote_source(self) -> Option<raqote::Source<'a>> {
|
||||
use canvas_traits::canvas::FillOrStrokeStyle::*;
|
||||
|
||||
|
@ -566,7 +567,19 @@ impl<'a> ToRaqoteSource<'a> for FillOrStrokeStyle {
|
|||
})),
|
||||
LinearGradient(_) => unimplemented!(),
|
||||
RadialGradient(_) => unimplemented!(),
|
||||
Surface(_) => unimplemented!(),
|
||||
Surface(ref surface) => {
|
||||
let data = &surface.surface_data[..];
|
||||
Some(raqote::Source::Image(
|
||||
raqote::Image {
|
||||
data: unsafe { std::slice::from_raw_parts(data.as_ptr() as *const u32, data.len() / 4) },
|
||||
width: surface.surface_size.width as i32,
|
||||
height: surface.surface_size.height as i32,
|
||||
},
|
||||
raqote::ExtendMode::Repeat, // TODO: repeat-x, repeat-y ?
|
||||
raqote::FilterMode::Bilinear,
|
||||
raqote::Transform::identity(),
|
||||
))
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue