canvas: Pass pattern by ref (#37662)

We pass all other options as ref too.

Testing: Just refactor, but the code is covered by WPT tests.

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev 2025-06-24 07:20:38 +02:00 committed by GitHub
parent 25fe003af2
commit e0f3679d55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 40 deletions

View file

@ -81,7 +81,7 @@ pub(crate) trait GenericDrawTarget<B: Backend> {
sigma: f32,
operator: B::CompositionOp,
);
fn fill(&mut self, path: &B::Path, pattern: B::Pattern<'_>, draw_options: &B::DrawOptions);
fn fill(&mut self, path: &B::Path, pattern: &B::Pattern<'_>, draw_options: &B::DrawOptions);
fn fill_text(
&mut self,
text_runs: Vec<TextRun>,
@ -92,7 +92,7 @@ pub(crate) trait GenericDrawTarget<B: Backend> {
fn fill_rect(
&mut self,
rect: &Rect<f32>,
pattern: B::Pattern<'_>,
pattern: &B::Pattern<'_>,
draw_options: &B::DrawOptions,
);
fn get_size(&self) -> Size2D<i32>;
@ -103,7 +103,7 @@ pub(crate) trait GenericDrawTarget<B: Backend> {
fn stroke(
&mut self,
path: &B::Path,
pattern: B::Pattern<'_>,
pattern: &B::Pattern<'_>,
stroke_options: &B::StrokeOptions,
draw_options: &B::DrawOptions,
);
@ -111,14 +111,14 @@ pub(crate) trait GenericDrawTarget<B: Backend> {
&mut self,
start: Point2D<f32>,
end: Point2D<f32>,
pattern: B::Pattern<'_>,
pattern: &B::Pattern<'_>,
stroke_options: &B::StrokeOptions,
draw_options: &B::DrawOptions,
);
fn stroke_rect(
&mut self,
rect: &Rect<f32>,
pattern: B::Pattern<'_>,
pattern: &B::Pattern<'_>,
stroke_options: &B::StrokeOptions,
draw_options: &B::DrawOptions,
);