Fix the SVG renderer not representing skewed raster images (#4218)

Fix the SVG renderer not skewing raster images to fit their bounds
This commit is contained in:
Keavon Chambers
2026-06-08 21:28:38 -07:00
committed by GitHub
parent bc1f63ccc6
commit b4e04e616a

View File

@@ -1558,11 +1558,9 @@ impl Render for List<Raster<CPU>> {
render.parent_tag( render.parent_tag(
"foreignObject", "foreignObject",
|attributes| { |attributes| {
let mut transform_values = transform.to_scale_angle_translation();
let size = DVec2::new(image.width as f64, image.height as f64); let size = DVec2::new(image.width as f64, image.height as f64);
transform_values.0 /= size;
let matrix = DAffine2::from_scale_angle_translation(transform_values.0, transform_values.1, transform_values.2); let matrix = transform * DAffine2::from_scale(1. / size);
let matrix = format_transform_matrix(matrix); let matrix = format_transform_matrix(matrix);
if !matrix.is_empty() { if !matrix.is_empty() {
attributes.push(ATTR_TRANSFORM, matrix); attributes.push(ATTR_TRANSFORM, matrix);