File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed
Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 1- [build ]
1+ [target .x86_64-unknown-linux-gnu ]
2+ rustflags = [" -C" , " target-cpu=native" ]
3+
4+ [target .aarch64-unknown-linux-gnu ]
5+ rustflags = [" -C" , " target-cpu=native" ]
6+
7+ [target .x86_64-apple-darwin ]
8+ rustflags = [" -C" , " target-cpu=native" ]
9+
10+ [target .aarch64-apple-darwin ]
211rustflags = [" -C" , " target-cpu=native" ]
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ lto = "fat"
3333codegen-units = 1
3434panic = " abort"
3535
36- [dependencies .mimalloc ]
36+ [target . 'cfg(not(target_arch = "wasm32"))' . dependencies .mimalloc ]
3737version = " 0.1"
3838default-features = false
3939
40- [dependencies .rayon ]
40+ [target . 'cfg(not(target_arch = "wasm32"))' . dependencies .rayon ]
4141version = " 1.10"
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use std::{
33 path:: { Path , PathBuf } ,
44} ;
55
6+ #[ cfg( not( target_arch = "wasm32" ) ) ]
67#[ global_allocator]
78static GLOBAL : mimalloc:: MiMalloc = mimalloc:: MiMalloc ;
89
Original file line number Diff line number Diff line change 11use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
22
33use image:: { Rgba , RgbaImage } ;
4+ #[ cfg( not( target_arch = "wasm32" ) ) ]
45use rayon:: prelude:: * ;
56
67use crate :: {
@@ -93,10 +94,12 @@ impl Render {
9394 let row_stride = out_w * 4 ;
9495 let out_raw = self . out . as_mut ( ) ;
9596
96- out_raw
97- . par_chunks_mut ( row_stride)
98- . enumerate ( )
99- . for_each ( |( y, row) | {
97+ #[ cfg( not( target_arch = "wasm32" ) ) ]
98+ let iter = out_raw. par_chunks_mut ( row_stride) . enumerate ( ) ;
99+ #[ cfg( target_arch = "wasm32" ) ]
100+ let iter = out_raw. chunks_mut ( row_stride) . enumerate ( ) ;
101+
102+ iter. for_each ( |( y, row) | {
100103 let map_y_base = ( y as i32 + off) as u32 ;
101104 if map_y_base >= mapping. map1 . height ( ) || map_y_base >= mapping. map2 . height ( ) {
102105 return ;
You can’t perform that action at this time.
0 commit comments