0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

modify stress test (rs) to record video

This commit is contained in:
Belén Albeza 2024-10-22 17:25:42 +02:00
parent f5acfd0787
commit b36c8cd52a
3 changed files with 95 additions and 150 deletions

View file

@ -241,10 +241,10 @@ pub unsafe extern "C" fn draw_shapes(
// create a `Vec<Rect>` from the pointer to the linear memory and length // create a `Vec<Rect>` from the pointer to the linear memory and length
let buf = Vec::<Rect>::from_raw_parts(ptr, len, len); let buf = Vec::<Rect>::from_raw_parts(ptr, len, len);
let mut text_paint = skia::Paint::default(); // let mut text_paint = skia::Paint::default();
text_paint.set_anti_alias(true); // text_paint.set_anti_alias(true);
text_paint.set_style(skia_safe::paint::Style::StrokeAndFill); // text_paint.set_style(skia_safe::paint::Style::StrokeAndFill);
text_paint.set_stroke_width(1.0); // text_paint.set_stroke_width(1.0);
// let mut path_paint = skia::Paint::default(); // let mut path_paint = skia::Paint::default();
// path_paint.set_color(skia_safe::Color::BLACK); // path_paint.set_color(skia_safe::Color::BLACK);
@ -279,13 +279,13 @@ pub unsafe extern "C" fn draw_shapes(
// paint.set_anti_alias(true); // paint.set_anti_alias(true);
// state.surface.canvas().draw_rect(r, &paint); // state.surface.canvas().draw_rect(r, &paint);
state.surface.canvas().draw_text_align( // state.surface.canvas().draw_text_align(
String::from("Lorem ipsum"), // String::from("Lorem ipsum"),
(rect.left, rect.top), // (rect.left, rect.top),
&state.default_font, // &state.default_font,
&paint, // &paint,
skia::utils::text_utils::Align::Left, // skia::utils::text_utils::Align::Left,
); // );
// let mut paint = skia::Paint::default(); // let mut paint = skia::Paint::default();
// paint.set_style(skia::PaintStyle::Fill); // paint.set_style(skia::PaintStyle::Fill);

View file

@ -61,7 +61,7 @@
[vbox zoom] [vbox zoom]
(let [alloc-rects (gobj/get ^js internal-module "_alloc_rects") (let [alloc-rects (gobj/get ^js internal-module "_alloc_rects")
free_rects (gobj/get ^js internal-module "_free_rects") free_rects (gobj/get ^js internal-module "_free_rects")
shape-count 5548 shape-count 10000
heap (gobj/get ^js internal-module "HEAPF32") heap (gobj/get ^js internal-module "HEAPF32")
;; Each F32 are 4 bytes ;; Each F32 are 4 bytes
;; Each rect has: ;; Each rect has:
@ -83,9 +83,9 @@
y2 (+ y1 (rand-int 256))] y2 (+ y1 (rand-int 256))]
(set! shapes-ptr ptr) (set! shapes-ptr ptr)
(set! shapes-size shape-count) (set! shapes-size shape-count)
(.set mem (js/Float32Array. (clj->js [0 0 64 64 255 0 0 1]))) ;; (.set mem (js/Float32Array. (clj->js [0 0 64 64 255 0 0 1])))
;; (.set mem (js/Float32Array. (clj->js [(* index 72) 0 (+ (* index 72) 64) 64 255 0 0 1]))) ;; (.set mem (js/Float32Array. (clj->js [(* index 72) 0 (+ (* index 72) 64) 64 255 0 0 1])))
;; (.set mem (js/Float32Array. (clj->js [x1 y1 x2 y2 (rand-int 255) (rand-int 255) (rand-int 255) 1]))) (.set mem (js/Float32Array. (clj->js [x1 y1 x2 y2 (rand-int 255) (rand-int 255) (rand-int 255) 1])))
))) )))
(draw-canvas vbox zoom nil))) (draw-canvas vbox zoom nil)))

View file

@ -45,10 +45,6 @@ var ENVIRONMENT_IS_WORKER = false;
var ENVIRONMENT_IS_NODE = false; var ENVIRONMENT_IS_NODE = false;
var ENVIRONMENT_IS_SHELL = false; var ENVIRONMENT_IS_SHELL = false;
if (Module['ENVIRONMENT']) {
throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
}
// --pre-jses are emitted after the Module integration code, so that they can // --pre-jses are emitted after the Module integration code, so that they can
// refer to Module (if they choose; they can also define Module) // refer to Module (if they choose; they can also define Module)
@ -321,11 +317,10 @@ var __ATPOSTRUN__ = []; // functions called after the main() is called
var runtimeInitialized = false; var runtimeInitialized = false;
function preRun() { function preRun() {
if (Module['preRun']) { var preRuns = Module['preRun'];
if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; if (preRuns) {
while (Module['preRun'].length) { if (typeof preRuns == 'function') preRuns = [preRuns];
addOnPreRun(Module['preRun'].shift()); preRuns.forEach(addOnPreRun);
}
} }
callRuntimeCallbacks(__ATPRERUN__); callRuntimeCallbacks(__ATPRERUN__);
} }
@ -354,11 +349,10 @@ function preMain() {
function postRun() { function postRun() {
checkStackCookie(); checkStackCookie();
if (Module['postRun']) { var postRuns = Module['postRun'];
if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; if (postRuns) {
while (Module['postRun'].length) { if (typeof postRuns == 'function') postRuns = [postRuns];
addOnPostRun(Module['postRun'].shift()); postRuns.forEach(addOnPostRun);
}
} }
callRuntimeCallbacks(__ATPOSTRUN__); callRuntimeCallbacks(__ATPOSTRUN__);
@ -720,6 +714,10 @@ var tempI64;
if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)'; if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)';
})(); })();
if (Module['ENVIRONMENT']) {
throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
}
function legacyModuleProp(prop, newName, incoming=true) { function legacyModuleProp(prop, newName, incoming=true) {
if (!Object.getOwnPropertyDescriptor(Module, prop)) { if (!Object.getOwnPropertyDescriptor(Module, prop)) {
Object.defineProperty(Module, prop, { Object.defineProperty(Module, prop, {
@ -758,15 +756,13 @@ function isExportedByForceFilesystem(name) {
* their build, or no symbols that no longer exist. * their build, or no symbols that no longer exist.
*/ */
function hookGlobalSymbolAccess(sym, func) { function hookGlobalSymbolAccess(sym, func) {
if (typeof globalThis != 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) { // In MODULARIZE mode the generated code runs inside a function scope and not
Object.defineProperty(globalThis, sym, { // the global scope, and JavaScript does not provide access to function scopes
configurable: true, // so we cannot dynamically modify the scrope using `defineProperty` in this
get() { // case.
func(); //
return undefined; // In this mode we simply ignore requests for `hookGlobalSymbolAccess`. Since
} // this is a debug-only feature, skipping it is not major issue.
});
}
} }
function missingGlobal(sym, msg) { function missingGlobal(sym, msg) {
@ -836,10 +832,8 @@ function dbg(...args) {
} }
var callRuntimeCallbacks = (callbacks) => { var callRuntimeCallbacks = (callbacks) => {
while (callbacks.length > 0) {
// Pass the module as the first argument. // Pass the module as the first argument.
callbacks.shift()(Module); callbacks.forEach((f) => f(Module));
}
}; };
@ -911,18 +905,18 @@ function dbg(...args) {
* array that contains uint8 values, returns a copy of that string as a * array that contains uint8 values, returns a copy of that string as a
* Javascript String object. * Javascript String object.
* heapOrArray is either a regular array, or a JavaScript typed array view. * heapOrArray is either a regular array, or a JavaScript typed array view.
* @param {number} idx * @param {number=} idx
* @param {number=} maxBytesToRead * @param {number=} maxBytesToRead
* @return {string} * @return {string}
*/ */
var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => { var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => {
var endIdx = idx + maxBytesToRead; var endIdx = idx + maxBytesToRead;
var endPtr = idx; var endPtr = idx;
// TextDecoder needs to know the byte length in advance, it doesn't stop on // TextDecoder needs to know the byte length in advance, it doesn't stop on
// null terminator by itself. Also, use the length info to avoid running tiny // null terminator by itself. Also, use the length info to avoid running tiny
// strings through TextDecoder, since .subarray() allocates garbage. // strings through TextDecoder, since .subarray() allocates garbage.
// (As a tiny code save trick, compare endPtr against endIdx using a negation, // (As a tiny code save trick, compare endPtr against endIdx using a negation,
// so that undefined means Infinity) // so that undefined/NaN means Infinity)
while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
@ -1493,7 +1487,7 @@ function dbg(...args) {
}, },
put_char(tty, val) { put_char(tty, val) {
if (val === null || val === 10) { if (val === null || val === 10) {
out(UTF8ArrayToString(tty.output, 0)); out(UTF8ArrayToString(tty.output));
tty.output = []; tty.output = [];
} else { } else {
if (val != 0) tty.output.push(val); // val == 0 would cut text output off in the middle. if (val != 0) tty.output.push(val); // val == 0 would cut text output off in the middle.
@ -1501,7 +1495,7 @@ function dbg(...args) {
}, },
fsync(tty) { fsync(tty) {
if (tty.output && tty.output.length > 0) { if (tty.output && tty.output.length > 0) {
out(UTF8ArrayToString(tty.output, 0)); out(UTF8ArrayToString(tty.output));
tty.output = []; tty.output = [];
} }
}, },
@ -1530,7 +1524,7 @@ function dbg(...args) {
default_tty1_ops:{ default_tty1_ops:{
put_char(tty, val) { put_char(tty, val) {
if (val === null || val === 10) { if (val === null || val === 10) {
err(UTF8ArrayToString(tty.output, 0)); err(UTF8ArrayToString(tty.output));
tty.output = []; tty.output = [];
} else { } else {
if (val != 0) tty.output.push(val); if (val != 0) tty.output.push(val);
@ -1538,7 +1532,7 @@ function dbg(...args) {
}, },
fsync(tty) { fsync(tty) {
if (tty.output && tty.output.length > 0) { if (tty.output && tty.output.length > 0) {
err(UTF8ArrayToString(tty.output, 0)); err(UTF8ArrayToString(tty.output));
tty.output = []; tty.output = [];
} }
}, },
@ -1548,7 +1542,6 @@ function dbg(...args) {
var zeroMemory = (address, size) => { var zeroMemory = (address, size) => {
HEAPU8.fill(0, address, address + size); HEAPU8.fill(0, address, address + size);
return address;
}; };
var alignMemory = (size, alignment) => { var alignMemory = (size, alignment) => {
@ -1558,8 +1551,8 @@ function dbg(...args) {
var mmapAlloc = (size) => { var mmapAlloc = (size) => {
size = alignMemory(size, 65536); size = alignMemory(size, 65536);
var ptr = _emscripten_builtin_memalign(65536, size); var ptr = _emscripten_builtin_memalign(65536, size);
if (!ptr) return 0; if (ptr) zeroMemory(ptr, size);
return zeroMemory(ptr, size); return ptr;
}; };
var MEMFS = { var MEMFS = {
ops_table:null, ops_table:null,
@ -3211,7 +3204,7 @@ function dbg(...args) {
var buf = new Uint8Array(length); var buf = new Uint8Array(length);
FS.read(stream, buf, 0, length, 0); FS.read(stream, buf, 0, length, 0);
if (opts.encoding === 'utf8') { if (opts.encoding === 'utf8') {
ret = UTF8ArrayToString(buf, 0); ret = UTF8ArrayToString(buf);
} else if (opts.encoding === 'binary') { } else if (opts.encoding === 'binary') {
ret = buf; ret = buf;
} }
@ -8842,16 +8835,12 @@ var wasmImports = {
/** @export */ /** @export */
invoke_ii, invoke_ii,
/** @export */ /** @export */
invoke_iif,
/** @export */
invoke_iiff, invoke_iiff,
/** @export */ /** @export */
invoke_iii, invoke_iii,
/** @export */ /** @export */
invoke_iiii, invoke_iiii,
/** @export */ /** @export */
invoke_iiiiffiii,
/** @export */
invoke_iiiii, invoke_iiiii,
/** @export */ /** @export */
invoke_iiiiid, invoke_iiiiid,
@ -8880,8 +8869,6 @@ var wasmImports = {
/** @export */ /** @export */
invoke_viffff, invoke_viffff,
/** @export */ /** @export */
invoke_viffi,
/** @export */
invoke_vifi, invoke_vifi,
/** @export */ /** @export */
invoke_vii, invoke_vii,
@ -8892,8 +8879,6 @@ var wasmImports = {
/** @export */ /** @export */
invoke_viiii, invoke_viiii,
/** @export */ /** @export */
invoke_viiiiffiii,
/** @export */
invoke_viiiii, invoke_viiiii,
/** @export */ /** @export */
invoke_viiiiii, invoke_viiiiii,
@ -8965,21 +8950,10 @@ var dynCall_iiiiij = Module['dynCall_iiiiij'] = createExportWrapper('dynCall_iii
var dynCall_iiiiijj = Module['dynCall_iiiiijj'] = createExportWrapper('dynCall_iiiiijj', 9); var dynCall_iiiiijj = Module['dynCall_iiiiijj'] = createExportWrapper('dynCall_iiiiijj', 9);
var dynCall_iiiiiijj = Module['dynCall_iiiiiijj'] = createExportWrapper('dynCall_iiiiiijj', 10); var dynCall_iiiiiijj = Module['dynCall_iiiiiijj'] = createExportWrapper('dynCall_iiiiiijj', 10);
function invoke_vii(index,a1,a2) { function invoke_iii(index,a1,a2) {
var sp = stackSave(); var sp = stackSave();
try { try {
getWasmTableEntry(index)(a1,a2); return getWasmTableEntry(index)(a1,a2);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_iiiii(index,a1,a2,a3,a4) {
var sp = stackSave();
try {
return getWasmTableEntry(index)(a1,a2,a3,a4);
} catch(e) { } catch(e) {
stackRestore(sp); stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e; if (!(e instanceof EmscriptenEH)) throw e;
@ -9031,10 +9005,10 @@ function invoke_viii(index,a1,a2,a3) {
} }
} }
function invoke_iii(index,a1,a2) { function invoke_vifi(index,a1,a2,a3) {
var sp = stackSave(); var sp = stackSave();
try { try {
return getWasmTableEntry(index)(a1,a2); getWasmTableEntry(index)(a1,a2,a3);
} catch(e) { } catch(e) {
stackRestore(sp); stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e; if (!(e instanceof EmscriptenEH)) throw e;
@ -9042,10 +9016,21 @@ function invoke_iii(index,a1,a2) {
} }
} }
function invoke_iiiiiii(index,a1,a2,a3,a4,a5,a6) { function invoke_vii(index,a1,a2) {
var sp = stackSave(); var sp = stackSave();
try { try {
return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6); getWasmTableEntry(index)(a1,a2);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_viiii(index,a1,a2,a3,a4) {
var sp = stackSave();
try {
getWasmTableEntry(index)(a1,a2,a3,a4);
} catch(e) { } catch(e) {
stackRestore(sp); stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e; if (!(e instanceof EmscriptenEH)) throw e;
@ -9064,6 +9049,17 @@ function invoke_iiii(index,a1,a2,a3) {
} }
} }
function invoke_iiiiiii(index,a1,a2,a3,a4,a5,a6) {
var sp = stackSave();
try {
return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_i(index) { function invoke_i(index) {
var sp = stackSave(); var sp = stackSave();
try { try {
@ -9086,6 +9082,17 @@ function invoke_iiiiii(index,a1,a2,a3,a4,a5) {
} }
} }
function invoke_iiiii(index,a1,a2,a3,a4) {
var sp = stackSave();
try {
return getWasmTableEntry(index)(a1,a2,a3,a4);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_viif(index,a1,a2,a3) { function invoke_viif(index,a1,a2,a3) {
var sp = stackSave(); var sp = stackSave();
try { try {
@ -9119,72 +9126,6 @@ function invoke_iiff(index,a1,a2,a3) {
} }
} }
function invoke_viiii(index,a1,a2,a3,a4) {
var sp = stackSave();
try {
getWasmTableEntry(index)(a1,a2,a3,a4);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_iif(index,a1,a2) {
var sp = stackSave();
try {
return getWasmTableEntry(index)(a1,a2);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_iiiiffiii(index,a1,a2,a3,a4,a5,a6,a7,a8) {
var sp = stackSave();
try {
return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_viffi(index,a1,a2,a3,a4) {
var sp = stackSave();
try {
getWasmTableEntry(index)(a1,a2,a3,a4);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_viiiiffiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9) {
var sp = stackSave();
try {
getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_vifi(index,a1,a2,a3) {
var sp = stackSave();
try {
getWasmTableEntry(index)(a1,a2,a3);
} catch(e) {
stackRestore(sp);
if (!(e instanceof EmscriptenEH)) throw e;
_setThrew(1, 0);
}
}
function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) { function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) {
var sp = stackSave(); var sp = stackSave();
try { try {
@ -9661,6 +9602,7 @@ unexportedSymbols.forEach(unexportedRuntimeSymbol);
var calledRun; var calledRun;
var calledPrerun;
dependenciesFulfilled = function runCaller() { dependenciesFulfilled = function runCaller() {
// If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false) // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false)
@ -9670,7 +9612,7 @@ dependenciesFulfilled = function runCaller() {
function callMain(args = []) { function callMain(args = []) {
assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'); assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
assert(__ATPRERUN__.length == 0, 'cannot call main when preRun functions remain to be called'); assert(calledPrerun, 'cannot call main without calling preRun first');
var entryFunction = _main; var entryFunction = _main;
@ -9715,19 +9657,22 @@ function run(args = arguments_) {
stackCheckInit(); stackCheckInit();
if (!calledPrerun) {
calledPrerun = 1;
preRun(); preRun();
// a preRun added a dependency, run will be called later // a preRun added a dependency, run will be called later
if (runDependencies > 0) { if (runDependencies > 0) {
return; return;
} }
}
function doRun() { function doRun() {
// run may have just been called through dependencies being fulfilled just in this very frame, // run may have just been called through dependencies being fulfilled just in this very frame,
// or while the async setStatus time below was happening // or while the async setStatus time below was happening
if (calledRun) return; if (calledRun) return;
calledRun = true; calledRun = 1;
Module['calledRun'] = true; Module['calledRun'] = 1;
if (ABORT) return; if (ABORT) return;