canvas: Use Transform2D<f64> instead of Transform2D<f32> (#38316)

I mostly did dumb replacement so please check that this is correct. In
addition, `canvas_data::draw_with_shadow` needs some a bit of a closer
look.

Testing: This is covered by existing tests, and it is likely that WPT
tests are unaffected by the precision of the transform, even though it
is technically more correct.
Fixes: #38256

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger 2025-08-11 18:46:25 +02:00 committed by GitHub
parent 4ff1e8dbd9
commit 3f7f9ba6cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 91 additions and 97 deletions

View file

@ -371,7 +371,7 @@ impl Canvas {
text_options: TextOptions,
shadow_options: ShadowOptions,
composition_options: CompositionOptions,
transform: Transform2D<f32>,
transform: Transform2D<f64>,
) {
match self {
#[cfg(feature = "raqote")]
@ -423,7 +423,7 @@ impl Canvas {
style: FillOrStrokeStyle,
shadow_options: ShadowOptions,
composition_options: CompositionOptions,
transform: Transform2D<f32>,
transform: Transform2D<f64>,
) {
match self {
#[cfg(feature = "raqote")]
@ -449,7 +449,7 @@ impl Canvas {
line_options: LineOptions,
shadow_options: ShadowOptions,
composition_options: CompositionOptions,
transform: Transform2D<f32>,
transform: Transform2D<f64>,
) {
match self {
#[cfg(feature = "raqote")]
@ -490,7 +490,7 @@ impl Canvas {
style: FillOrStrokeStyle,
shadow_options: ShadowOptions,
composition_options: CompositionOptions,
transform: Transform2D<f32>,
transform: Transform2D<f64>,
) {
match self {
#[cfg(feature = "raqote")]
@ -531,7 +531,7 @@ impl Canvas {
line_options: LineOptions,
shadow_options: ShadowOptions,
composition_options: CompositionOptions,
transform: Transform2D<f32>,
transform: Transform2D<f64>,
) {
match self {
#[cfg(feature = "raqote")]
@ -565,7 +565,7 @@ impl Canvas {
}
}
fn clear_rect(&mut self, rect: &Rect<f32>, transform: Transform2D<f32>) {
fn clear_rect(&mut self, rect: &Rect<f32>, transform: Transform2D<f64>) {
match self {
#[cfg(feature = "raqote")]
Canvas::Raqote(canvas_data) => canvas_data.clear_rect(rect, transform),
@ -585,7 +585,7 @@ impl Canvas {
smoothing_enabled: bool,
shadow_options: ShadowOptions,
composition_options: CompositionOptions,
transform: Transform2D<f32>,
transform: Transform2D<f64>,
) {
match self {
#[cfg(feature = "raqote")]
@ -646,7 +646,7 @@ impl Canvas {
}
}
fn clip_path(&mut self, path: &Path, fill_rule: FillRule, transform: Transform2D<f32>) {
fn clip_path(&mut self, path: &Path, fill_rule: FillRule, transform: Transform2D<f64>) {
match self {
#[cfg(feature = "raqote")]
Canvas::Raqote(canvas_data) => canvas_data.clip_path(path, fill_rule, transform),