canvas: Add CanvasPattern 'setTranform(transform)' method (#37731)

Follow the HTML canvas specification and add missing
'setTransform(transform)' method to CanvasPattern interface.
https://html.spec.whatwg.org/multipage/#dom-canvaspattern-settransform

Testing: Improvements in the tests
- html/canvas/element/fill-and-stroke-styles/2d.pattern.transform*
- html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.transform*

Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
This commit is contained in:
Andrei Volykhin 2025-06-26 17:38:30 +03:00 committed by GitHub
parent 5286869b96
commit 3c16db2642
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 65 additions and 51 deletions

View file

@ -214,6 +214,7 @@ pub struct SurfaceStyle {
pub surface_size: Size2D<u32>,
pub repeat_x: bool,
pub repeat_y: bool,
pub transform: Transform2D<f32>,
}
impl SurfaceStyle {
@ -222,12 +223,14 @@ impl SurfaceStyle {
surface_size: Size2D<u32>,
repeat_x: bool,
repeat_y: bool,
transform: Transform2D<f32>,
) -> Self {
Self {
surface_data: ByteBuf::from(surface_data),
surface_size,
repeat_x,
repeat_y,
transform,
}
}
}