Commit 41fc00e 1 parent afa3282 commit 41fc00e Copy full SHA for 41fc00e
File tree 2 files changed +29
-9
lines changed
2 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -388,11 +388,12 @@ impl super::Queue {
388
388
const UNPACK_PREMULTIPLY_ALPHA_WEBGL : u32 = 0x9241 ;
389
389
390
390
unsafe {
391
- gl. pixel_store_i32 ( UNPACK_FLIP_Y_WEBGL , src. flip_y as i32 ) ;
392
- gl. pixel_store_i32 (
393
- UNPACK_PREMULTIPLY_ALPHA_WEBGL ,
394
- dst_premultiplication as i32 ,
395
- ) ;
391
+ if src. flip_y {
392
+ gl. pixel_store_bool ( UNPACK_FLIP_Y_WEBGL , true ) ;
393
+ }
394
+ if dst_premultiplication {
395
+ gl. pixel_store_bool ( UNPACK_PREMULTIPLY_ALPHA_WEBGL , true ) ;
396
+ }
396
397
}
397
398
398
399
unsafe { gl. bind_texture ( dst_target, Some ( dst) ) } ;
@@ -492,8 +493,12 @@ impl super::Queue {
492
493
}
493
494
494
495
unsafe {
495
- gl. pixel_store_i32 ( UNPACK_FLIP_Y_WEBGL , 0 ) ;
496
- gl. pixel_store_i32 ( UNPACK_PREMULTIPLY_ALPHA_WEBGL , 0 ) ;
496
+ if src. flip_y {
497
+ gl. pixel_store_bool ( UNPACK_FLIP_Y_WEBGL , false ) ;
498
+ }
499
+ if dst_premultiplication {
500
+ gl. pixel_store_bool ( UNPACK_PREMULTIPLY_ALPHA_WEBGL , false ) ;
501
+ }
497
502
}
498
503
}
499
504
C :: CopyTextureToTexture {
Original file line number Diff line number Diff line change @@ -18,9 +18,24 @@ async fn image_bitmap_import() {
18
18
let blob = web_sys:: Blob :: new_with_u8_array_sequence ( & array) . unwrap ( ) ;
19
19
20
20
// Parse the image from the blob
21
- let image_bitmap_promise = web_sys:: window ( )
21
+ let image_bitmap_function : js_sys :: Function = web_sys:: window ( )
22
22
. unwrap ( )
23
- . create_image_bitmap_with_blob ( & blob)
23
+ . get ( "createImageBitmap" )
24
+ . unwrap ( )
25
+ . dyn_into ( )
26
+ . unwrap ( ) ;
27
+
28
+ let options_arg = js_sys:: Object :: new ( ) ;
29
+ js_sys:: Reflect :: set (
30
+ & options_arg,
31
+ & wasm_bindgen:: JsValue :: from_str ( "premultiplyAlpha" ) ,
32
+ & wasm_bindgen:: JsValue :: from_str ( "none" ) ,
33
+ )
34
+ . unwrap ( ) ;
35
+ let image_bitmap_promise: js_sys:: Promise = image_bitmap_function
36
+ . call2 ( & wasm_bindgen:: JsValue :: UNDEFINED , & blob, & options_arg)
37
+ . unwrap ( )
38
+ . dyn_into ( )
24
39
. unwrap ( ) ;
25
40
26
41
// Wait for the parsing to be done
You can’t perform that action at this time.
0 commit comments