@@ -34,7 +34,7 @@ use spatial_node::{StickyFrameInfo};
34
34
use std:: { f32, mem} ;
35
35
use std:: collections:: vec_deque:: VecDeque ;
36
36
use tiling:: { CompositeOps } ;
37
- use util:: { MaxRect } ;
37
+ use util:: { MaxRect , VecHelper } ;
38
38
39
39
#[ derive( Debug , Copy , Clone ) ]
40
40
struct ClipNode {
@@ -1114,23 +1114,24 @@ impl<'a> DisplayListFlattener<'a> {
1114
1114
} ;
1115
1115
1116
1116
// Add picture for this actual stacking context contents to render into.
1117
- let prim_list = PrimitiveList :: new (
1118
- stacking_context. primitives ,
1119
- & self . resources . prim_interner ,
1120
- ) ;
1121
- let leaf_picture = PicturePrimitive :: new_image (
1122
- leaf_composite_mode,
1123
- leaf_context_3d,
1124
- stacking_context. pipeline_id ,
1125
- leaf_output_pipeline_id,
1126
- true ,
1127
- stacking_context. requested_raster_space ,
1128
- prim_list,
1129
- stacking_context. spatial_node_index ,
1130
- max_clip,
1131
- & self . clip_store ,
1117
+ let leaf_pic_index = PictureIndex ( self . prim_store . pictures
1118
+ . alloc ( )
1119
+ . init ( PicturePrimitive :: new_image (
1120
+ leaf_composite_mode,
1121
+ leaf_context_3d,
1122
+ stacking_context. pipeline_id ,
1123
+ leaf_output_pipeline_id,
1124
+ true ,
1125
+ stacking_context. requested_raster_space ,
1126
+ PrimitiveList :: new (
1127
+ stacking_context. primitives ,
1128
+ & self . resources . prim_interner ,
1129
+ ) ,
1130
+ stacking_context. spatial_node_index ,
1131
+ max_clip,
1132
+ & self . clip_store ,
1133
+ ) )
1132
1134
) ;
1133
- let leaf_pic_index = self . prim_store . create_picture ( leaf_picture) ;
1134
1135
1135
1136
// Create a chain of pictures based on presence of filters,
1136
1137
// mix-blend-mode and/or 3d rendering context containers.
@@ -1153,56 +1154,56 @@ impl<'a> DisplayListFlattener<'a> {
1153
1154
if let Picture3DContext :: In { root_data : Some ( mut prims) , ancestor_index } = stacking_context. context_3d {
1154
1155
prims. push ( cur_instance. clone ( ) ) ;
1155
1156
1156
- let prim_list = PrimitiveList :: new (
1157
- prims,
1158
- & self . resources . prim_interner ,
1159
- ) ;
1160
-
1161
1157
// This is the acttual picture representing our 3D hierarchy root.
1162
- let container_picture = PicturePrimitive :: new_image (
1163
- None ,
1164
- Picture3DContext :: In {
1165
- root_data : Some ( Vec :: new ( ) ) ,
1166
- ancestor_index,
1167
- } ,
1168
- stacking_context. pipeline_id ,
1169
- stacking_context. frame_output_pipeline_id ,
1170
- true ,
1171
- stacking_context. requested_raster_space ,
1172
- prim_list,
1173
- stacking_context. spatial_node_index ,
1174
- max_clip,
1175
- & self . clip_store ,
1158
+ current_pic_index = PictureIndex ( self . prim_store . pictures
1159
+ . alloc ( )
1160
+ . init ( PicturePrimitive :: new_image (
1161
+ None ,
1162
+ Picture3DContext :: In {
1163
+ root_data : Some ( Vec :: new ( ) ) ,
1164
+ ancestor_index,
1165
+ } ,
1166
+ stacking_context. pipeline_id ,
1167
+ stacking_context. frame_output_pipeline_id ,
1168
+ true ,
1169
+ stacking_context. requested_raster_space ,
1170
+ PrimitiveList :: new (
1171
+ prims,
1172
+ & self . resources . prim_interner ,
1173
+ ) ,
1174
+ stacking_context. spatial_node_index ,
1175
+ max_clip,
1176
+ & self . clip_store ,
1177
+ ) )
1176
1178
) ;
1177
1179
1178
- current_pic_index = self . prim_store . create_picture ( container_picture) ;
1179
-
1180
1180
cur_instance. kind = PrimitiveInstanceKind :: Picture { pic_index : current_pic_index } ;
1181
1181
}
1182
1182
1183
1183
// For each filter, create a new image with that composite mode.
1184
1184
for filter in & stacking_context. composite_ops . filters {
1185
1185
let filter = filter. sanitize ( ) ;
1186
- let prim_list = PrimitiveList :: new (
1187
- vec ! [ cur_instance. clone( ) ] ,
1188
- & self . resources . prim_interner ,
1189
- ) ;
1190
1186
1191
- let filter_picture = PicturePrimitive :: new_image (
1192
- Some ( PictureCompositeMode :: Filter ( filter) ) ,
1193
- Picture3DContext :: Out ,
1194
- stacking_context. pipeline_id ,
1195
- None ,
1196
- true ,
1197
- stacking_context. requested_raster_space ,
1198
- prim_list,
1199
- stacking_context. spatial_node_index ,
1200
- max_clip,
1201
- & self . clip_store ,
1187
+ let filter_pic_index = PictureIndex ( self . prim_store . pictures
1188
+ . alloc ( )
1189
+ . init ( PicturePrimitive :: new_image (
1190
+ Some ( PictureCompositeMode :: Filter ( filter) ) ,
1191
+ Picture3DContext :: Out ,
1192
+ stacking_context. pipeline_id ,
1193
+ None ,
1194
+ true ,
1195
+ stacking_context. requested_raster_space ,
1196
+ PrimitiveList :: new (
1197
+ vec ! [ cur_instance. clone( ) ] ,
1198
+ & self . resources . prim_interner ,
1199
+ ) ,
1200
+ stacking_context. spatial_node_index ,
1201
+ max_clip,
1202
+ & self . clip_store ,
1203
+ ) )
1202
1204
) ;
1203
- let filter_pic_index = self . prim_store . create_picture ( filter_picture) ;
1204
- current_pic_index = filter_pic_index;
1205
1205
1206
+ current_pic_index = filter_pic_index;
1206
1207
cur_instance. kind = PrimitiveInstanceKind :: Picture { pic_index : current_pic_index } ;
1207
1208
1208
1209
if cur_instance. is_chased ( ) {
@@ -1216,26 +1217,26 @@ impl<'a> DisplayListFlattener<'a> {
1216
1217
1217
1218
// Same for mix-blend-mode.
1218
1219
if let Some ( mix_blend_mode) = stacking_context. composite_ops . mix_blend_mode {
1219
- let prim_list = PrimitiveList :: new (
1220
- vec ! [ cur_instance. clone( ) ] ,
1221
- & self . resources . prim_interner ,
1220
+ let blend_pic_index = PictureIndex ( self . prim_store . pictures
1221
+ . alloc ( )
1222
+ . init ( PicturePrimitive :: new_image (
1223
+ Some ( PictureCompositeMode :: MixBlend ( mix_blend_mode) ) ,
1224
+ Picture3DContext :: Out ,
1225
+ stacking_context. pipeline_id ,
1226
+ None ,
1227
+ true ,
1228
+ stacking_context. requested_raster_space ,
1229
+ PrimitiveList :: new (
1230
+ vec ! [ cur_instance. clone( ) ] ,
1231
+ & self . resources . prim_interner ,
1232
+ ) ,
1233
+ stacking_context. spatial_node_index ,
1234
+ max_clip,
1235
+ & self . clip_store ,
1236
+ ) )
1222
1237
) ;
1223
1238
1224
- let blend_picture = PicturePrimitive :: new_image (
1225
- Some ( PictureCompositeMode :: MixBlend ( mix_blend_mode) ) ,
1226
- Picture3DContext :: Out ,
1227
- stacking_context. pipeline_id ,
1228
- None ,
1229
- true ,
1230
- stacking_context. requested_raster_space ,
1231
- prim_list,
1232
- stacking_context. spatial_node_index ,
1233
- max_clip,
1234
- & self . clip_store ,
1235
- ) ;
1236
- let blend_pic_index = self . prim_store . create_picture ( blend_picture) ;
1237
1239
current_pic_index = blend_pic_index;
1238
-
1239
1240
cur_instance. kind = PrimitiveInstanceKind :: Picture { pic_index : blend_pic_index } ;
1240
1241
1241
1242
if cur_instance. is_chased ( ) {
@@ -1553,31 +1554,31 @@ impl<'a> DisplayListFlattener<'a> {
1553
1554
// No point in adding a shadow here if there were no primitives
1554
1555
// added to the shadow.
1555
1556
if !prims. is_empty ( ) {
1556
- let prim_list = PrimitiveList :: new (
1557
- prims,
1558
- & self . resources . prim_interner ,
1559
- ) ;
1560
-
1561
1557
// Create a picture that the shadow primitives will be added to. If the
1562
1558
// blur radius is 0, the code in Picture::prepare_for_render will
1563
1559
// detect this and mark the picture to be drawn directly into the
1564
1560
// parent picture, which avoids an intermediate surface and blur.
1565
1561
let blur_filter = FilterOp :: Blur ( std_deviation) . sanitize ( ) ;
1566
- let mut shadow_pic = PicturePrimitive :: new_image (
1567
- Some ( PictureCompositeMode :: Filter ( blur_filter) ) ,
1568
- Picture3DContext :: Out ,
1569
- pipeline_id,
1570
- None ,
1571
- is_passthrough,
1572
- raster_space,
1573
- prim_list,
1574
- pending_shadow. clip_and_scroll . spatial_node_index ,
1575
- max_clip,
1576
- & self . clip_store ,
1577
- ) ;
1578
1562
1579
1563
// Create the primitive to draw the shadow picture into the scene.
1580
- let shadow_pic_index = self . prim_store . create_picture ( shadow_pic) ;
1564
+ let shadow_pic_index = PictureIndex ( self . prim_store . pictures
1565
+ . alloc ( )
1566
+ . init ( PicturePrimitive :: new_image (
1567
+ Some ( PictureCompositeMode :: Filter ( blur_filter) ) ,
1568
+ Picture3DContext :: Out ,
1569
+ pipeline_id,
1570
+ None ,
1571
+ is_passthrough,
1572
+ raster_space,
1573
+ PrimitiveList :: new (
1574
+ prims,
1575
+ & self . resources . prim_interner ,
1576
+ ) ,
1577
+ pending_shadow. clip_and_scroll . spatial_node_index ,
1578
+ max_clip,
1579
+ & self . clip_store ,
1580
+ ) )
1581
+ ) ;
1581
1582
1582
1583
let shadow_prim_key = PrimitiveKey :: new (
1583
1584
true ,
@@ -2203,26 +2204,25 @@ impl FlattenedStackingContext {
2203
2204
Picture3DContext :: Out => panic ! ( "Unexpected out of 3D context" ) ,
2204
2205
} ;
2205
2206
2206
- let prim_list = PrimitiveList :: new (
2207
- mem:: replace ( & mut self . primitives , Vec :: new ( ) ) ,
2208
- prim_interner,
2209
- ) ;
2210
-
2211
- let container_picture = PicturePrimitive :: new_image (
2212
- Some ( PictureCompositeMode :: Blit ) ,
2213
- flat_items_context_3d,
2214
- self . pipeline_id ,
2215
- None ,
2216
- true ,
2217
- self . requested_raster_space ,
2218
- prim_list,
2219
- self . spatial_node_index ,
2220
- LayoutRect :: max_rect ( ) ,
2221
- clip_store,
2207
+ let pic_index = PictureIndex ( prim_store. pictures
2208
+ . alloc ( )
2209
+ . init ( PicturePrimitive :: new_image (
2210
+ Some ( PictureCompositeMode :: Blit ) ,
2211
+ flat_items_context_3d,
2212
+ self . pipeline_id ,
2213
+ None ,
2214
+ true ,
2215
+ self . requested_raster_space ,
2216
+ PrimitiveList :: new (
2217
+ mem:: replace ( & mut self . primitives , Vec :: new ( ) ) ,
2218
+ prim_interner,
2219
+ ) ,
2220
+ self . spatial_node_index ,
2221
+ LayoutRect :: max_rect ( ) ,
2222
+ clip_store,
2223
+ ) )
2222
2224
) ;
2223
2225
2224
- let pic_index = prim_store. create_picture ( container_picture) ;
2225
-
2226
2226
Some ( PrimitiveInstance :: new (
2227
2227
PrimitiveInstanceKind :: Picture { pic_index } ,
2228
2228
self . primitive_data_handle ,
0 commit comments