@@ -137,12 +137,6 @@ async fn render<'a: 'n>(
137137 let RenderIntermediate { ty, mut metadata, contains_artboard } = data;
138138 metadata. apply_transform ( footprint. transform ) ;
139139
140- let surface_handle = if cfg ! ( all( feature = "vello" , target_family = "wasm" ) ) {
141- _surface_handle. eval ( None ) . await
142- } else {
143- None
144- } ;
145-
146140 let data = match ( render_params. render_output_type , & ty) {
147141 ( RenderOutputTypeRequest :: Svg , RenderIntermediateType :: Svg ( svg_data) ) => {
148142 let mut svg_renderer = SvgRender :: new ( ) ;
@@ -175,14 +169,23 @@ async fn render<'a: 'n>(
175169 } ;
176170 let ( child, context) = Arc :: as_ref ( vello_data) ;
177171
178- let scale_transform = glam:: DAffine2 :: from_scale ( glam:: DVec2 :: splat ( render_params. scale ) ) ;
172+ let surface_handle = if cfg ! ( all( feature = "vello" , target_family = "wasm" ) ) {
173+ _surface_handle. eval ( None ) . await
174+ } else {
175+ None
176+ } ;
177+
178+ // When rendering to a surface, we do not want to apply the scale
179+ let scale = if surface_handle. is_none ( ) { render_params. scale } else { 1. } ;
180+
181+ let scale_transform = glam:: DAffine2 :: from_scale ( glam:: DVec2 :: splat ( scale) ) ;
179182 let footprint_transform = scale_transform * footprint. transform ;
180183 let footprint_transform_vello = vello:: kurbo:: Affine :: new ( footprint_transform. to_cols_array ( ) ) ;
181184
182185 let mut scene = vello:: Scene :: new ( ) ;
183186 scene. append ( child, Some ( footprint_transform_vello) ) ;
184187
185- let resolution = ( footprint. resolution . as_dvec2 ( ) * render_params . scale ) . as_uvec2 ( ) ;
188+ let resolution = ( footprint. resolution . as_dvec2 ( ) * scale) . as_uvec2 ( ) ;
186189
187190 // We now replace all transforms which are supposed to be infinite with a transform which covers the entire viewport
188191 // See <https://xi.zulipchat.com/#narrow/channel/197075-vello/topic/Full.20screen.20color.2Fgradients/near/538435044> for more detail
@@ -199,8 +202,6 @@ async fn render<'a: 'n>(
199202 background = Color :: WHITE ;
200203 }
201204
202- let resolution = ( footprint. resolution . as_dvec2 ( ) * render_params. scale ) . as_uvec2 ( ) ;
203-
204205 if let Some ( surface_handle) = surface_handle {
205206 exec. render_vello_scene ( & scene, & surface_handle, resolution, context, background)
206207 . await
0 commit comments