@@ -15,10 +15,10 @@ use gpu_types::{PrimitiveInstanceData, RasterizationSpace, GlyphInstance};
15
15
use gpu_types:: { PrimitiveHeader , PrimitiveHeaderIndex , TransformPaletteId , TransformPalette } ;
16
16
use internal_types:: { FastHashMap , SavedTargetIndex , TextureSource } ;
17
17
use picture:: { Picture3DContext , PictureCompositeMode , PicturePrimitive , PictureSurface } ;
18
- use prim_store:: { BrushKind , BrushPrimitive , DeferredResolve , PrimitiveTemplateKind , PrimitiveDataStore } ;
18
+ use prim_store:: { DeferredResolve , PrimitiveTemplateKind , PrimitiveDataStore } ;
19
19
use prim_store:: { EdgeAaSegmentMask , ImageSource , PrimitiveInstanceKind } ;
20
20
use prim_store:: { VisibleGradientTile , PrimitiveInstance , PrimitiveOpacity , SegmentInstanceIndex } ;
21
- use prim_store:: { BrushSegment , ClipMaskKind , ClipTaskIndex , PrimitiveDetails } ;
21
+ use prim_store:: { BrushSegment , ClipMaskKind , ClipTaskIndex } ;
22
22
use render_task:: { RenderTaskAddress , RenderTaskId , RenderTaskTree } ;
23
23
use renderer:: { BlendMode , ImageBufferKind , ShaderColorMode } ;
24
24
use renderer:: BLOCKS_PER_UV_RECT ;
@@ -902,13 +902,13 @@ impl AlphaBatchBuilder {
902
902
PrimitiveInstanceKind :: Picture { pic_index } => pic_index,
903
903
PrimitiveInstanceKind :: LineDecoration { .. } |
904
904
PrimitiveInstanceKind :: TextRun { .. } |
905
- PrimitiveInstanceKind :: LegacyPrimitive { .. } |
906
905
PrimitiveInstanceKind :: NormalBorder { .. } |
907
906
PrimitiveInstanceKind :: ImageBorder { .. } |
908
907
PrimitiveInstanceKind :: Rectangle { .. } |
909
908
PrimitiveInstanceKind :: YuvImage { .. } |
910
909
PrimitiveInstanceKind :: Image { .. } |
911
910
PrimitiveInstanceKind :: LinearGradient { .. } |
911
+ PrimitiveInstanceKind :: RadialGradient { .. } |
912
912
PrimitiveInstanceKind :: Clear => {
913
913
unreachable ! ( ) ;
914
914
}
@@ -1400,104 +1400,6 @@ impl AlphaBatchBuilder {
1400
1400
}
1401
1401
}
1402
1402
}
1403
- (
1404
- PrimitiveInstanceKind :: LegacyPrimitive { prim_index } ,
1405
- PrimitiveTemplateKind :: Unused ,
1406
- ) => {
1407
- let prim = & ctx. prim_store . primitives [ prim_index. 0 ] ;
1408
-
1409
- // If the primitive is internally decomposed into multiple sub-primitives we may not
1410
- // use some of the per-primitive data and get it from each sub-primitive instead.
1411
- let is_multiple_primitives = match prim. details {
1412
- PrimitiveDetails :: Brush ( ref brush) => {
1413
- match brush. kind {
1414
- BrushKind :: RadialGradient { visible_tiles_range, .. } => !visible_tiles_range. is_empty ( ) ,
1415
- }
1416
- }
1417
- } ;
1418
-
1419
- let specified_blend_mode = BlendMode :: PremultipliedAlpha ;
1420
-
1421
- match prim. details {
1422
- PrimitiveDetails :: Brush ( ref brush) => {
1423
- let non_segmented_blend_mode = if !brush. opacity . is_opaque ||
1424
- prim_instance. clip_task_index != ClipTaskIndex :: INVALID ||
1425
- transform_kind == TransformedRectKind :: Complex
1426
- {
1427
- specified_blend_mode
1428
- } else {
1429
- BlendMode :: None
1430
- } ;
1431
-
1432
- let prim_cache_address = if is_multiple_primitives {
1433
- GpuCacheAddress :: invalid ( )
1434
- } else {
1435
- gpu_cache. get_address ( & brush. gpu_location )
1436
- } ;
1437
-
1438
- let prim_header = PrimitiveHeader {
1439
- local_rect : prim. local_rect ,
1440
- local_clip_rect : prim_instance. combined_local_clip_rect ,
1441
- task_address,
1442
- specific_prim_address : prim_cache_address,
1443
- clip_task_address,
1444
- transform_id,
1445
- } ;
1446
-
1447
- if prim_instance. is_chased ( ) {
1448
- println ! ( "\t task target {:?}" , self . target_rect) ;
1449
- println ! ( "\t {:?}" , prim_header) ;
1450
- }
1451
-
1452
- match brush. kind {
1453
- BrushKind :: RadialGradient { ref stops_handle, visible_tiles_range, .. } if !visible_tiles_range. is_empty ( ) => {
1454
- let visible_tiles = & ctx. scratch . gradient_tiles [ visible_tiles_range] ;
1455
-
1456
- add_gradient_tiles (
1457
- visible_tiles,
1458
- stops_handle,
1459
- BrushBatchKind :: RadialGradient ,
1460
- specified_blend_mode,
1461
- bounding_rect,
1462
- clip_task_address,
1463
- gpu_cache,
1464
- & mut self . batch_list ,
1465
- & prim_header,
1466
- prim_headers,
1467
- z_id,
1468
- ) ;
1469
- }
1470
- _ => {
1471
- if let Some ( params) = brush. get_batch_params (
1472
- gpu_cache,
1473
- ) {
1474
- let prim_header_index = prim_headers. push ( & prim_header, z_id, params. prim_user_data ) ;
1475
- if prim_instance. is_chased ( ) {
1476
- println ! ( "\t {:?} {:?}, task relative bounds {:?}" ,
1477
- params. batch_kind, prim_header_index, bounding_rect) ;
1478
- }
1479
-
1480
- self . add_segmented_prim_to_batch (
1481
- brush. segment_desc . as_ref ( ) . map ( |desc| desc. segments . as_slice ( ) ) ,
1482
- brush. opacity ,
1483
- & params,
1484
- specified_blend_mode,
1485
- non_segmented_blend_mode,
1486
- prim_header_index,
1487
- clip_task_address,
1488
- bounding_rect,
1489
- transform_kind,
1490
- render_tasks,
1491
- z_id,
1492
- prim_instance. clip_task_index ,
1493
- ctx,
1494
- ) ;
1495
- }
1496
- }
1497
- }
1498
- }
1499
- }
1500
- }
1501
1403
(
1502
1404
PrimitiveInstanceKind :: ImageBorder { .. } ,
1503
1405
PrimitiveTemplateKind :: ImageBorder { request, brush_segments, .. }
@@ -1964,6 +1866,89 @@ impl AlphaBatchBuilder {
1964
1866
) ;
1965
1867
}
1966
1868
}
1869
+ (
1870
+ PrimitiveInstanceKind :: RadialGradient { visible_tiles_range, .. } ,
1871
+ PrimitiveTemplateKind :: RadialGradient { stops_handle, ref brush_segments, .. }
1872
+ ) => {
1873
+ let specified_blend_mode = BlendMode :: PremultipliedAlpha ;
1874
+
1875
+ let mut prim_header = PrimitiveHeader {
1876
+ local_rect : prim_data. prim_rect ,
1877
+ local_clip_rect : prim_instance. combined_local_clip_rect ,
1878
+ task_address,
1879
+ specific_prim_address : GpuCacheAddress :: invalid ( ) ,
1880
+ clip_task_address,
1881
+ transform_id,
1882
+ } ;
1883
+
1884
+ if visible_tiles_range. is_empty ( ) {
1885
+ let non_segmented_blend_mode = if !prim_data. opacity . is_opaque ||
1886
+ prim_instance. clip_task_index != ClipTaskIndex :: INVALID ||
1887
+ transform_kind == TransformedRectKind :: Complex
1888
+ {
1889
+ specified_blend_mode
1890
+ } else {
1891
+ BlendMode :: None
1892
+ } ;
1893
+
1894
+ let batch_params = BrushBatchParameters :: shared (
1895
+ BrushBatchKind :: RadialGradient ,
1896
+ BatchTextures :: no_texture ( ) ,
1897
+ [
1898
+ stops_handle. as_int ( gpu_cache) ,
1899
+ 0 ,
1900
+ 0 ,
1901
+ ] ,
1902
+ 0 ,
1903
+ ) ;
1904
+
1905
+ prim_header. specific_prim_address = gpu_cache. get_address ( & prim_data. gpu_cache_handle ) ;
1906
+
1907
+ let prim_header_index = prim_headers. push (
1908
+ & prim_header,
1909
+ z_id,
1910
+ batch_params. prim_user_data ,
1911
+ ) ;
1912
+
1913
+ let segments = if brush_segments. is_empty ( ) {
1914
+ None
1915
+ } else {
1916
+ Some ( brush_segments. as_slice ( ) )
1917
+ } ;
1918
+
1919
+ self . add_segmented_prim_to_batch (
1920
+ segments,
1921
+ prim_data. opacity ,
1922
+ & batch_params,
1923
+ specified_blend_mode,
1924
+ non_segmented_blend_mode,
1925
+ prim_header_index,
1926
+ clip_task_address,
1927
+ bounding_rect,
1928
+ transform_kind,
1929
+ render_tasks,
1930
+ z_id,
1931
+ prim_instance. clip_task_index ,
1932
+ ctx,
1933
+ ) ;
1934
+ } else {
1935
+ let visible_tiles = & ctx. scratch . gradient_tiles [ * visible_tiles_range] ;
1936
+
1937
+ add_gradient_tiles (
1938
+ visible_tiles,
1939
+ stops_handle,
1940
+ BrushBatchKind :: RadialGradient ,
1941
+ specified_blend_mode,
1942
+ bounding_rect,
1943
+ clip_task_address,
1944
+ gpu_cache,
1945
+ & mut self . batch_list ,
1946
+ & prim_header,
1947
+ prim_headers,
1948
+ z_id,
1949
+ ) ;
1950
+ }
1951
+ }
1967
1952
_ => {
1968
1953
unreachable ! ( ) ;
1969
1954
}
@@ -2295,28 +2280,6 @@ impl BrushBatchParameters {
2295
2280
}
2296
2281
}
2297
2282
2298
- impl BrushPrimitive {
2299
- fn get_batch_params (
2300
- & self ,
2301
- gpu_cache : & mut GpuCache ,
2302
- ) -> Option < BrushBatchParameters > {
2303
- match self . kind {
2304
- BrushKind :: RadialGradient { ref stops_handle, .. } => {
2305
- Some ( BrushBatchParameters :: shared (
2306
- BrushBatchKind :: RadialGradient ,
2307
- BatchTextures :: no_texture ( ) ,
2308
- [
2309
- stops_handle. as_int ( gpu_cache) ,
2310
- 0 ,
2311
- 0 ,
2312
- ] ,
2313
- 0 ,
2314
- ) )
2315
- }
2316
- }
2317
- }
2318
- }
2319
-
2320
2283
impl PrimitiveInstance {
2321
2284
pub fn is_cacheable (
2322
2285
& self ,
@@ -2337,14 +2300,14 @@ impl PrimitiveInstance {
2337
2300
_ => unreachable ! ( ) ,
2338
2301
}
2339
2302
}
2340
- PrimitiveInstanceKind :: LegacyPrimitive { .. } |
2341
2303
PrimitiveInstanceKind :: Picture { .. } |
2342
2304
PrimitiveInstanceKind :: TextRun { .. } |
2343
2305
PrimitiveInstanceKind :: LineDecoration { .. } |
2344
2306
PrimitiveInstanceKind :: NormalBorder { .. } |
2345
2307
PrimitiveInstanceKind :: ImageBorder { .. } |
2346
2308
PrimitiveInstanceKind :: Rectangle { .. } |
2347
2309
PrimitiveInstanceKind :: LinearGradient { .. } |
2310
+ PrimitiveInstanceKind :: RadialGradient { .. } |
2348
2311
PrimitiveInstanceKind :: Clear => {
2349
2312
return true ;
2350
2313
}
0 commit comments