mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
canvas: Properly bound all image pattern axis by inserting clip (#37668)
Before we only handled no-repeat for rect, this means we rendered https://sagudev.github.io/briefcase/no-repeat.html incorrectly (like firefox). Now if one of the axis is bounded (does not repeat) we clip it and let other axis be unbounded (technically we clip it to end of canvas). This is also needed for vello backend. Testing: Tests in WPT exists and another test is added. --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
464d71ecfc
commit
75c13f1422
8 changed files with 314 additions and 70 deletions
|
@ -98,6 +98,7 @@ pub(crate) trait GenericDrawTarget<B: Backend> {
|
|||
fn get_transform(&self) -> Transform2D<f32>;
|
||||
fn pop_clip(&mut self);
|
||||
fn push_clip(&mut self, path: &B::Path);
|
||||
fn push_clip_rect(&mut self, rect: &Rect<i32>);
|
||||
fn set_transform(&mut self, matrix: &Transform2D<f32>);
|
||||
fn stroke(
|
||||
&mut self,
|
||||
|
@ -309,11 +310,13 @@ pub(crate) trait GenericPath<B: Backend<Path = Self>> {
|
|||
}
|
||||
}
|
||||
}
|
||||
fn bounding_box(&self) -> Rect<f64>;
|
||||
}
|
||||
|
||||
pub(crate) trait PatternHelpers {
|
||||
fn is_zero_size_gradient(&self) -> bool;
|
||||
fn draw_rect(&self, rect: &Rect<f32>) -> Rect<f32>;
|
||||
fn x_bound(&self) -> Option<u32>;
|
||||
fn y_bound(&self) -> Option<u32>;
|
||||
}
|
||||
|
||||
pub(crate) trait StrokeOptionsHelpers {
|
||||
|
@ -327,4 +330,5 @@ pub(crate) trait StrokeOptionsHelpers {
|
|||
|
||||
pub(crate) trait DrawOptionsHelpers {
|
||||
fn set_alpha(&mut self, val: f32);
|
||||
fn is_clear(&self) -> bool;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue