@@ -4183,6 +4183,8 @@ struct SurfaceAllocInfo {
4183
4183
// Only used for SVGFEGraph currently, this is the source pixels needed to
4184
4184
// render the pixels in clipped.
4185
4185
source : DeviceRect ,
4186
+ // Only used for SVGFEGraph, this is the same as clipped before rounding.
4187
+ clipped_notsnapped : DeviceRect ,
4186
4188
clipped_local : PictureRect ,
4187
4189
uv_rect_kind : UvRectKind ,
4188
4190
}
@@ -6378,6 +6380,14 @@ impl PicturePrimitive {
6378
6380
)
6379
6381
) ;
6380
6382
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
+
6381
6391
// Produce the target pixels, this is the result of the
6382
6392
// composite op
6383
6393
let filter_task_id = request_render_task (
@@ -6396,8 +6406,10 @@ impl PicturePrimitive {
6396
6406
source_subregion. cast_unit ( ) ,
6397
6407
target_subregion. cast_unit ( ) ,
6398
6408
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,
6401
6413
)
6402
6414
}
6403
6415
) ;
@@ -8151,6 +8163,7 @@ fn get_surface_rects(
8151
8163
clipped : clipped_snapped,
8152
8164
unclipped,
8153
8165
source,
8166
+ clipped_notsnapped : clipped,
8154
8167
clipped_local,
8155
8168
uv_rect_kind,
8156
8169
} )
0 commit comments