Simplify memory management for other C++ codecs

This commit is contained in:
Ingvar Stepanyan
2020-05-14 18:08:42 +01:00
committed by Ingvar Stepanyan
parent 97931bad22
commit 93cbe557cd
25 changed files with 171 additions and 257 deletions

View File

@@ -11,9 +11,7 @@
Module.onRuntimeInitialized = async _ => {
console.log('Version:', Module.version().toString(16));
const image = await loadFile('../../example.webp');
const result = Module.decode(image);
const imageData = new ImageData(new Uint8ClampedArray(result.buffer), result.width, result.height);
Module.free_result();
const imageData = Module.decode(image);
const canvas = document.createElement('canvas');
canvas.width = result.width;
canvas.height = result.height;