File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -1986,13 +1986,17 @@ impl Window {
1986
1986
1987
1987
#[ doc( alias = "SDL_GetWindowGammaRamp" ) ]
1988
1988
pub fn gamma_ramp_arrays ( & self ) -> Result < [ [ u16 ; 256 ] ; 3 ] , String > {
1989
- let mut ret = mem:: MaybeUninit :: < [ [ u16 ; 256 ] ; 3 ] > :: uninit ( ) ;
1990
- let ptr = ret. as_mut_ptr ( ) . cast :: < u16 > ( ) ;
1989
+ let [ mut red, mut green, mut blue] = [ mem:: MaybeUninit :: < [ u16 ; 256 ] > :: uninit ( ) ; 3 ] ;
1991
1990
let result = unsafe {
1992
- sys:: SDL_GetWindowGammaRamp ( self . context . raw , ptr, ptr. add ( 256 ) , ptr. add ( 512 ) )
1991
+ sys:: SDL_GetWindowGammaRamp (
1992
+ self . context . raw ,
1993
+ red. as_mut_ptr ( ) . cast :: < u16 > ( ) ,
1994
+ green. as_mut_ptr ( ) . cast :: < u16 > ( ) ,
1995
+ blue. as_mut_ptr ( ) . cast :: < u16 > ( ) ,
1996
+ )
1993
1997
} ;
1994
1998
if result == 0 {
1995
- Ok ( unsafe { ret . assume_init ( ) } )
1999
+ Ok ( unsafe { [ red . assume_init ( ) , green . assume_init ( ) , blue . assume_init ( ) ] } )
1996
2000
} else {
1997
2001
Err ( get_error ( ) )
1998
2002
}
You can’t perform that action at this time.
0 commit comments