@@ -280,7 +280,7 @@ pub const TILE_SIZE_SCROLLBAR_VERTICAL: DeviceIntSize = DeviceIntSize {
280
280
281
281
/// The maximum size per axis of a surface,
282
282
/// in WorldPixel coordinates.
283
- const MAX_SURFACE_SIZE : f32 = 4096.0 ;
283
+ const MAX_SURFACE_SIZE : usize = 4096 ;
284
284
/// Maximum size of a compositor surface.
285
285
const MAX_COMPOSITOR_SURFACES_SIZE : f32 = 8192.0 ;
286
286
@@ -4433,8 +4433,6 @@ impl PicturePrimitive {
4433
4433
pub fn take_context (
4434
4434
& mut self ,
4435
4435
pic_index : PictureIndex ,
4436
- surface_spatial_node_index : SpatialNodeIndex ,
4437
- raster_spatial_node_index : SpatialNodeIndex ,
4438
4436
parent_surface_index : Option < SurfaceIndex > ,
4439
4437
parent_subpixel_mode : SubpixelMode ,
4440
4438
frame_state : & mut FrameBuildingState ,
@@ -4451,27 +4449,11 @@ impl PicturePrimitive {
4451
4449
4452
4450
profile_scope ! ( "take_context" ) ;
4453
4451
4454
- // Extract the raster and surface spatial nodes from the raster
4455
- // config, if this picture establishes a surface. Otherwise just
4456
- // pass in the spatial node indices from the parent context.
4457
- let ( raster_spatial_node_index, surface_spatial_node_index, surface_index) = match self . raster_config {
4458
- Some ( ref raster_config) => {
4459
- let surface = & frame_state. surfaces [ raster_config. surface_index . 0 ] ;
4460
-
4461
- (
4462
- surface. raster_spatial_node_index ,
4463
- self . spatial_node_index ,
4464
- raster_config. surface_index ,
4465
- )
4466
- }
4467
- None => {
4468
- (
4469
- raster_spatial_node_index,
4470
- surface_spatial_node_index,
4471
- parent_surface_index. expect ( "bug: no parent" ) ,
4472
- )
4473
- }
4452
+ let surface_index = match self . raster_config {
4453
+ Some ( ref raster_config) => raster_config. surface_index ,
4454
+ None => parent_surface_index. expect ( "bug: no parent" ) ,
4474
4455
} ;
4456
+ let surface_spatial_node_index = frame_state. surfaces [ surface_index. 0 ] . surface_spatial_node_index ;
4475
4457
4476
4458
let map_pic_to_world = SpaceMapper :: new_with_target (
4477
4459
frame_context. root_spatial_node_index ,
@@ -4809,7 +4791,8 @@ impl PicturePrimitive {
4809
4791
tile_cache. current_tile_size . to_f32 ( ) ,
4810
4792
content_origin,
4811
4793
surface_spatial_node_index,
4812
- raster_spatial_node_index,
4794
+ // raster == surface implicitly for picture cache tiles
4795
+ surface_spatial_node_index,
4813
4796
device_pixel_scale,
4814
4797
Some ( tile_key) ,
4815
4798
Some ( scissor_rect) ,
@@ -4950,18 +4933,27 @@ impl PicturePrimitive {
4950
4933
self . prev_local_rect = local_rect;
4951
4934
}
4952
4935
4936
+ let max_surface_size = frame_context
4937
+ . fb_config
4938
+ . max_surface_override
4939
+ . unwrap_or ( MAX_SURFACE_SIZE ) as f32 ;
4940
+
4953
4941
let surface_rects = match get_surface_rects (
4954
4942
raster_config. surface_index ,
4955
4943
& raster_config. composite_mode ,
4956
4944
parent_surface_index,
4957
4945
& mut frame_state. surfaces ,
4958
4946
frame_context. spatial_tree ,
4947
+ max_surface_size,
4959
4948
) {
4960
4949
Some ( rects) => rects,
4961
4950
None => return None ,
4962
4951
} ;
4963
4952
4964
- let device_pixel_scale = frame_state. surfaces [ raster_config. surface_index . 0 ] . device_pixel_scale ;
4953
+ let ( raster_spatial_node_index, device_pixel_scale) = {
4954
+ let surface = & frame_state. surfaces [ surface_index. 0 ] ;
4955
+ ( surface. raster_spatial_node_index , surface. device_pixel_scale )
4956
+ } ;
4965
4957
let cmd_buffer_builder = CommandBufferBuilder :: new_simple (
4966
4958
surface_rects. clipped_local ,
4967
4959
) ;
@@ -5412,7 +5404,7 @@ impl PicturePrimitive {
5412
5404
let context = PictureContext {
5413
5405
pic_index,
5414
5406
apply_local_clip_rect : self . apply_local_clip_rect ,
5415
- raster_spatial_node_index,
5407
+ raster_spatial_node_index : frame_state . surfaces [ surface_index . 0 ] . raster_spatial_node_index ,
5416
5408
surface_spatial_node_index,
5417
5409
surface_index,
5418
5410
dirty_region_count,
@@ -6762,6 +6754,7 @@ fn get_surface_rects(
6762
6754
parent_surface_index : SurfaceIndex ,
6763
6755
surfaces : & mut [ SurfaceInfo ] ,
6764
6756
spatial_tree : & SpatialTree ,
6757
+ max_surface_size : f32 ,
6765
6758
) -> Option < SurfaceAllocInfo > {
6766
6759
let parent_surface = & surfaces[ parent_surface_index. 0 ] ;
6767
6760
@@ -6871,19 +6864,19 @@ fn get_surface_rects(
6871
6864
6872
6865
let task_size_f = clipped. size ( ) ;
6873
6866
6874
- if task_size_f. width > MAX_SURFACE_SIZE || task_size_f. height > MAX_SURFACE_SIZE {
6867
+ if task_size_f. width > max_surface_size || task_size_f. height > max_surface_size {
6875
6868
let max_dimension = clipped_local. width ( ) . max ( clipped_local. height ( ) ) . ceil ( ) ;
6876
6869
6877
6870
surface. raster_spatial_node_index = surface. surface_spatial_node_index ;
6878
- surface. device_pixel_scale = Scale :: new ( MAX_SURFACE_SIZE / max_dimension) ;
6871
+ surface. device_pixel_scale = Scale :: new ( max_surface_size / max_dimension) ;
6879
6872
6880
6873
clipped = ( clipped_local. cast_unit ( ) * surface. device_pixel_scale ) . round ( ) ;
6881
6874
unclipped = unclipped_local. cast_unit ( ) * surface. device_pixel_scale ;
6882
6875
}
6883
6876
6884
6877
let task_size = clipped. size ( ) . to_i32 ( ) ;
6885
- debug_assert ! ( task_size. width <= MAX_SURFACE_SIZE as i32 ) ;
6886
- debug_assert ! ( task_size. height <= MAX_SURFACE_SIZE as i32 ) ;
6878
+ debug_assert ! ( task_size. width <= max_surface_size as i32 ) ;
6879
+ debug_assert ! ( task_size. height <= max_surface_size as i32 ) ;
6887
6880
6888
6881
let uv_rect_kind = calculate_uv_rect_kind (
6889
6882
clipped,
@@ -6990,5 +6983,6 @@ fn test_large_surface_scale_1() {
6990
6983
SurfaceIndex ( 0 ) ,
6991
6984
& mut surfaces,
6992
6985
& spatial_tree,
6986
+ MAX_SURFACE_SIZE as f32 ,
6993
6987
) ;
6994
6988
}
0 commit comments