@@ -16,10 +16,6 @@ pub struct Backend {
1616
1717 #[ cfg( feature = "svg" ) ]
1818 vector_pipeline : crate :: vector:: Pipeline ,
19-
20- last_primitives : Vec < Primitive > ,
21- last_background_color : Color ,
22- last_size : Size < u32 > ,
2319}
2420
2521impl Backend {
@@ -34,10 +30,6 @@ impl Backend {
3430
3531 #[ cfg( feature = "svg" ) ]
3632 vector_pipeline : crate :: vector:: Pipeline :: new ( ) ,
37-
38- last_primitives : Vec :: new ( ) ,
39- last_background_color : Color :: BLACK ,
40- last_size : Size :: new ( 0 , 0 ) ,
4133 }
4234 }
4335
@@ -47,31 +39,13 @@ impl Backend {
4739 clip_mask : & mut tiny_skia:: Mask ,
4840 primitives : & [ Primitive ] ,
4941 viewport : & Viewport ,
42+ damage : & [ Rectangle ] ,
5043 background_color : Color ,
5144 overlay : & [ T ] ,
52- ) -> bool {
45+ ) {
5346 let physical_size = viewport. physical_size ( ) ;
54-
55- let damage = if self . last_background_color == background_color
56- && self . last_size == physical_size
57- {
58- Primitive :: damage_list ( & self . last_primitives , primitives)
59- } else {
60- vec ! [ Rectangle :: with_size( viewport. logical_size( ) ) ]
61- } ;
62-
63- if damage. is_empty ( ) {
64- return false ;
65- }
66-
67- self . last_primitives = primitives. to_vec ( ) ;
68- self . last_background_color = background_color;
69- self . last_size = physical_size;
70-
7147 let scale_factor = viewport. scale_factor ( ) as f32 ;
7248
73- let damage = group_damage ( damage, scale_factor, physical_size) ;
74-
7549 if !overlay. is_empty ( ) {
7650 let path = tiny_skia:: PathBuilder :: from_rect (
7751 tiny_skia:: Rect :: from_xywh (
@@ -99,7 +73,7 @@ impl Backend {
9973 ) ;
10074 }
10175
102- for region in damage {
76+ for & region in damage {
10377 let path = tiny_skia:: PathBuilder :: from_rect (
10478 tiny_skia:: Rect :: from_xywh (
10579 region. x ,
@@ -164,8 +138,6 @@ impl Backend {
164138
165139 #[ cfg( feature = "svg" ) ]
166140 self . vector_pipeline . trim_cache ( ) ;
167-
168- true
169141 }
170142
171143 fn draw_primitive (
@@ -629,52 +601,6 @@ fn adjust_clip_mask(clip_mask: &mut tiny_skia::Mask, bounds: Rectangle) {
629601 ) ;
630602}
631603
632- fn group_damage (
633- mut damage : Vec < Rectangle > ,
634- scale_factor : f32 ,
635- bounds : Size < u32 > ,
636- ) -> Vec < Rectangle > {
637- use std:: cmp:: Ordering ;
638-
639- const AREA_THRESHOLD : f32 = 20_000.0 ;
640-
641- let bounds = Rectangle {
642- x : 0.0 ,
643- y : 0.0 ,
644- width : bounds. width as f32 ,
645- height : bounds. height as f32 ,
646- } ;
647-
648- damage. sort_by ( |a, b| {
649- a. x . partial_cmp ( & b. x )
650- . unwrap_or ( Ordering :: Equal )
651- . then_with ( || a. y . partial_cmp ( & b. y ) . unwrap_or ( Ordering :: Equal ) )
652- } ) ;
653-
654- let mut output = Vec :: new ( ) ;
655- let mut scaled = damage
656- . into_iter ( )
657- . filter_map ( |region| ( region * scale_factor) . intersection ( & bounds) )
658- . filter ( |region| region. width >= 1.0 && region. height >= 1.0 ) ;
659-
660- if let Some ( mut current) = scaled. next ( ) {
661- for region in scaled {
662- let union = current. union ( & region) ;
663-
664- if union. area ( ) - current. area ( ) - region. area ( ) <= AREA_THRESHOLD {
665- current = union;
666- } else {
667- output. push ( current) ;
668- current = region;
669- }
670- }
671-
672- output. push ( current) ;
673- }
674-
675- output
676- }
677-
678604impl iced_graphics:: Backend for Backend {
679605 fn trim_measurements ( & mut self ) {
680606 self . text_pipeline . trim_measurement_cache ( ) ;
0 commit comments