drop preview to save memory

This commit is contained in:
Stewart Allen 2021-07-25 00:05:25 -04:00
commit 153b8cef64
5 changed files with 8 additions and 5 deletions

View file

@ -92,7 +92,9 @@
range.min = 0;
range.max = lines.length - 1;
range.oninput = function() {
let lineDV = new DataView(lines[range.value]);
let pdata = lines[range.value];
if (!pdata) return;
let lineDV = new DataView(pdata);
for (let i=0; i<lineDV.byteLength; i++) {
imgDV.setUint32(i*4, lineDV.getUint8(i));
}

View file

@ -107,7 +107,7 @@
slices.push(lines);
// transfer image memory to browser main
// it *should* be sampled to save memory
image = image.buffer;
image = image ? image.buffer : undefined;
online({
progress: (index / layermax) * part1,
message: "image_gen",

View file

@ -341,7 +341,7 @@
writePoly(writer, poly);
}
wasm.render(0, imagelen, 0);
let image = wasm.heap.slice(0, imagelen);
let image = wasm.heap;//.slice(0, imagelen);
let lines = [];
for (let x=0; x<width; x++) {
let y_start = 0;
@ -361,7 +361,8 @@
lastv = v;
}
}
return { image, lines };
return { lines };
// return { image, lines };
}
if (!this.navigator && this.process && this.process.env) {

Binary file not shown.

View file

@ -1,7 +1,7 @@
all: kiri-sla.wasm kiri-geo.wasm kiri-ani.wasm
kiri-sla.wasm: kiri-sla.c
emcc --no-entry -o kiri-sla.wasm kiri-sla.c -O3 -s ERROR_ON_UNDEFINED_SYMBOLS=0
emcc --no-entry -o kiri-sla.wasm kiri-sla.c -O3 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=40mb
kiri-geo.wasm: kiri-geo.cpp
emcc --no-entry -o kiri-geo.wasm clipper.cpp kiri-geo.cpp -Oz -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=40mb