File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @undecaf/zbar-wasm" ,
3- "version" : " 0.9.9 " ,
3+ "version" : " 0.9.10 " ,
44 "description" : " A WebAssembly build of the C/C++ ZBar barcode reader" ,
55 "type" : " module" ,
66 "main" : " ./dist/main.cjs" ,
Original file line number Diff line number Diff line change @@ -42,12 +42,15 @@ export class ZBarImage extends CppObject {
4242 if ( len * 4 !== data . byteLength ) {
4343 throw Error ( 'dataBuf does not match width and height' ) ;
4444 }
45- const buf = inst . _malloc ( len ) ;
46- for ( let i = 0 ; i < len ; ++ i ) {
47- const r = data [ i * 4 ] ;
48- const g = data [ i * 4 + 1 ] ;
49- const b = data [ i * 4 + 2 ] ;
50- heap [ buf + i ] = ( r * 19595 + g * 38469 + b * 7472 ) >> 16 ;
45+ const
46+ buf = inst . _malloc ( len ) ,
47+ bufEnd = buf + len ;
48+ for ( let i = buf , j = 0 ; i < bufEnd ; i ++ , j += 4 ) {
49+ heap [ i ] = (
50+ data [ j ] * 19595 +
51+ data [ j + 1 ] * 38469 +
52+ data [ j + 2 ] * 7472
53+ ) >> 16 ;
5154 }
5255 const ptr = inst . _Image_create (
5356 width ,
You can’t perform that action at this time.
0 commit comments