mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add origin-clean flag tracking for canvas
This commit is contained in:
parent
c6ae32abdd
commit
b8e9064fe6
15 changed files with 135 additions and 86 deletions
|
@ -18,12 +18,14 @@ pub struct CanvasPattern {
|
|||
surface_size: Size2D<i32>,
|
||||
repeat_x: bool,
|
||||
repeat_y: bool,
|
||||
origin_clean: bool,
|
||||
}
|
||||
|
||||
impl CanvasPattern {
|
||||
fn new_inherited(surface_data: Vec<u8>,
|
||||
surface_size: Size2D<i32>,
|
||||
repeat: RepetitionStyle)
|
||||
repeat: RepetitionStyle,
|
||||
origin_clean: bool)
|
||||
-> CanvasPattern {
|
||||
let (x, y) = match repeat {
|
||||
RepetitionStyle::Repeat => (true, true),
|
||||
|
@ -38,17 +40,23 @@ impl CanvasPattern {
|
|||
surface_size: surface_size,
|
||||
repeat_x: x,
|
||||
repeat_y: y,
|
||||
origin_clean: origin_clean,
|
||||
}
|
||||
}
|
||||
pub fn new(global: GlobalRef,
|
||||
surface_data: Vec<u8>,
|
||||
surface_size: Size2D<i32>,
|
||||
repeat: RepetitionStyle)
|
||||
repeat: RepetitionStyle,
|
||||
origin_clean: bool)
|
||||
-> Root<CanvasPattern> {
|
||||
reflect_dom_object(box CanvasPattern::new_inherited(surface_data, surface_size, repeat),
|
||||
reflect_dom_object(box CanvasPattern::new_inherited(surface_data, surface_size,
|
||||
repeat, origin_clean),
|
||||
global,
|
||||
CanvasPatternBinding::Wrap)
|
||||
}
|
||||
pub fn origin_is_clean(&self) -> bool {
|
||||
self.origin_clean
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ToFillOrStrokeStyle for &'a CanvasPattern {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue