@@ -47,11 +47,11 @@ struct CropperPrograms {
47
47
sub_quad_tex : Program ,
48
48
}
49
49
50
- struct CroppingContext < T > {
50
+ struct CroppingContext {
51
51
started : Instant ,
52
52
delta : Duration ,
53
53
54
- snap : T ,
54
+ snap : Screenshot ,
55
55
snap_tex : SrgbTexture2d ,
56
56
57
57
region : Option < Rectangle < f64 > > ,
@@ -126,15 +126,15 @@ impl Cropper {
126
126
} )
127
127
}
128
128
129
- pub fn apply ( & mut self , snap : impl Screenshot ) -> Result < bool , CropperError > {
129
+ pub fn apply ( & mut self , snap : Screenshot ) -> Result < bool , CropperError > {
130
130
self . display
131
131
. gl_window ( )
132
132
. window ( )
133
- . set_max_dimensions ( Some ( snap. dimensions ( ) . into ( ) ) ) ;
133
+ . set_max_dimensions ( Some ( snap. dimensions . into ( ) ) ) ;
134
134
self . display
135
135
. gl_window ( )
136
136
. window ( )
137
- . set_min_dimensions ( Some ( snap. dimensions ( ) . into ( ) ) ) ;
137
+ . set_min_dimensions ( Some ( snap. dimensions . into ( ) ) ) ;
138
138
self . display
139
139
. gl_window ( )
140
140
. window ( )
@@ -153,7 +153,7 @@ impl Cropper {
153
153
154
154
snap_tex : SrgbTexture2d :: with_mipmaps (
155
155
& self . display ,
156
- RawImage2d :: from_raw_rgb ( snap. data ( ) . into ( ) , snap. dimensions ( ) ) ,
156
+ RawImage2d :: from_raw_rgb ( snap. data . clone ( ) , snap. dimensions ) ,
157
157
MipmapsOption :: NoMipmap ,
158
158
) ?,
159
159
snap : snap,
@@ -257,8 +257,8 @@ impl Cropper {
257
257
ModifiersState { shift : true , .. } => {
258
258
context. region = context
259
259
. snap
260
- . windows ( )
261
- . into_iter ( )
260
+ . windows
261
+ . iter ( )
262
262
. find ( |w| w. content_bounds . contains ( x as u32 , y as u32 ) )
263
263
. map ( |w| Rectangle {
264
264
x : w. content_bounds . x as f64 ,
@@ -306,7 +306,7 @@ impl Cropper {
306
306
fn render (
307
307
& mut self ,
308
308
frame : & mut glium:: Frame ,
309
- ctx : & mut CroppingContext < impl Screenshot > ,
309
+ ctx : & mut CroppingContext ,
310
310
) -> Result < ( ) , CropperError > {
311
311
if let ( Some ( areg) , Some ( reg) ) = ( ctx. animated_region , ctx. region ) {
312
312
let delta_s = ctx. delta . as_millis ( ) as f64 / 1000.0 ;
@@ -363,10 +363,10 @@ impl Cropper {
363
363
200.0f32
364
364
) ,
365
365
bounds: [
366
- ( areg. x as f32 ) / ( ctx. snap. dimensions( ) . 0 as f32 ) ,
367
- 1.0 - ( areg. y as f32 ) / ( ctx. snap. dimensions( ) . 1 as f32 ) ,
368
- ( areg. w as f32 ) / ( ctx. snap. dimensions( ) . 0 as f32 ) ,
369
- -( areg. h as f32 ) / ( ctx. snap. dimensions( ) . 1 as f32 )
366
+ ( areg. x as f32 ) / ( ctx. snap. dimensions. 0 as f32 ) ,
367
+ 1.0 - ( areg. y as f32 ) / ( ctx. snap. dimensions. 1 as f32 ) ,
368
+ ( areg. w as f32 ) / ( ctx. snap. dimensions. 0 as f32 ) ,
369
+ -( areg. h as f32 ) / ( ctx. snap. dimensions. 1 as f32 )
370
370
] ,
371
371
} ;
372
372
0 commit comments