mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
canvas: Make draw_options
non optional in fill_rect
(#37603)
All other draw functions already have them non-optional and we always passed `Some` anyway. Testing: Existing WPT tests Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
927573de97
commit
f370606fa8
3 changed files with 5 additions and 15 deletions
|
@ -93,7 +93,7 @@ pub(crate) trait GenericDrawTarget<B: Backend> {
|
|||
&mut self,
|
||||
rect: &Rect<f32>,
|
||||
pattern: B::Pattern<'_>,
|
||||
draw_options: Option<&B::DrawOptions>,
|
||||
draw_options: &B::DrawOptions,
|
||||
);
|
||||
fn get_size(&self) -> Size2D<i32>;
|
||||
fn get_transform(&self) -> Transform2D<f32>;
|
||||
|
|
|
@ -766,14 +766,14 @@ impl<'a, B: Backend> CanvasData<'a, B> {
|
|||
new_draw_target.fill_rect(
|
||||
&draw_rect,
|
||||
self.state.fill_style.clone(),
|
||||
Some(&self.state.draw_options),
|
||||
&self.state.draw_options,
|
||||
);
|
||||
});
|
||||
} else {
|
||||
self.drawtarget.fill_rect(
|
||||
&draw_rect,
|
||||
self.state.fill_style.clone(),
|
||||
Some(&self.state.draw_options),
|
||||
&self.state.draw_options,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -559,7 +559,7 @@ impl GenericDrawTarget<RaqoteBackend> for raqote::DrawTarget {
|
|||
&mut self,
|
||||
rect: &Rect<f32>,
|
||||
pattern: <RaqoteBackend as Backend>::Pattern<'_>,
|
||||
draw_options: Option<&<RaqoteBackend as Backend>::DrawOptions>,
|
||||
draw_options: &<RaqoteBackend as Backend>::DrawOptions,
|
||||
) {
|
||||
let mut pb = raqote::PathBuilder::new();
|
||||
pb.rect(
|
||||
|
@ -568,18 +568,8 @@ impl GenericDrawTarget<RaqoteBackend> for raqote::DrawTarget {
|
|||
rect.size.width,
|
||||
rect.size.height,
|
||||
);
|
||||
let draw_options = if let Some(options) = draw_options {
|
||||
*options
|
||||
} else {
|
||||
raqote::DrawOptions::new()
|
||||
};
|
||||
|
||||
<Self as GenericDrawTarget<RaqoteBackend>>::fill(
|
||||
self,
|
||||
&pb.finish(),
|
||||
pattern,
|
||||
&draw_options,
|
||||
);
|
||||
<Self as GenericDrawTarget<RaqoteBackend>>::fill(self, &pb.finish(), pattern, draw_options);
|
||||
}
|
||||
fn get_size(&self) -> Size2D<i32> {
|
||||
Size2D::new(self.width(), self.height())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue