@@ -4183,6 +4183,8 @@ struct SurfaceAllocInfo {
41834183 // Only used for SVGFEGraph currently, this is the source pixels needed to
41844184 // render the pixels in clipped.
41854185 source : DeviceRect ,
4186+ // Only used for SVGFEGraph, this is the same as clipped before rounding.
4187+ clipped_notsnapped : DeviceRect ,
41864188 clipped_local : PictureRect ,
41874189 uv_rect_kind : UvRectKind ,
41884190}
@@ -6378,6 +6380,14 @@ impl PicturePrimitive {
63786380 )
63796381 ) ;
63806382
6383+ // Determine the local space to device pixel scaling in the most robust
6384+ // way, this accounts for local to device transform and
6385+ // device_pixel_scale (if the task is shrunk in get_surface_rects).
6386+ let subregion_to_device_scale_x = surface_rects. clipped_notsnapped . width ( ) / surface_rects. clipped_local . width ( ) ;
6387+ let subregion_to_device_scale_y = surface_rects. clipped_notsnapped . height ( ) / surface_rects. clipped_local . height ( ) ;
6388+ let subregion_to_device_offset_x = surface_rects. clipped_notsnapped . min . x - ( surface_rects. clipped_local . min . x * subregion_to_device_scale_x) . floor ( ) ;
6389+ let subregion_to_device_offset_y = surface_rects. clipped_notsnapped . min . y - ( surface_rects. clipped_local . min . y * subregion_to_device_scale_y) . floor ( ) ;
6390+
63816391 // Produce the target pixels, this is the result of the
63826392 // composite op
63836393 let filter_task_id = request_render_task (
@@ -6396,8 +6406,10 @@ impl PicturePrimitive {
63966406 source_subregion. cast_unit ( ) ,
63976407 target_subregion. cast_unit ( ) ,
63986408 prim_subregion. cast_unit ( ) ,
6399- surface_rects. clipped . cast_unit ( ) ,
6400- surface_rects. clipped_local . cast_unit ( ) ,
6409+ subregion_to_device_scale_x,
6410+ subregion_to_device_scale_y,
6411+ subregion_to_device_offset_x,
6412+ subregion_to_device_offset_y,
64016413 )
64026414 }
64036415 ) ;
@@ -8151,6 +8163,7 @@ fn get_surface_rects(
81518163 clipped : clipped_snapped,
81528164 unclipped,
81538165 source,
8166+ clipped_notsnapped : clipped,
81548167 clipped_local,
81558168 uv_rect_kind,
81568169 } )
0 commit comments