diff --git a/webp_js/index.html b/webp_js/index.html index 33cacb4c..e7c3b652 100644 --- a/webp_js/index.html +++ b/webp_js/index.html @@ -29,6 +29,8 @@ function decode(webp_data, canvas_id) { // clear previous picture (if any) Module.canvas = canvas; canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height); + // Map this canvas to the default selector used by emscripten/SDL2. + specialHTMLTargets["#canvas"] = Module.canvas; // decode and measure timing var start = new Date(); var ret = WebpToCanvas(webp_data, webp_data.length); diff --git a/webp_js/index_wasm.html b/webp_js/index_wasm.html index 7a9b362a..29933aba 100644 --- a/webp_js/index_wasm.html +++ b/webp_js/index_wasm.html @@ -30,6 +30,8 @@ function decode(webp_data, canvas_id) { // clear previous picture (if any) Module.canvas = canvas; canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height); + // Map this canvas to the default selector used by emscripten/SDL2. + specialHTMLTargets["#canvas"] = Module.canvas; // decode and measure timing var start = new Date(); var ret = WebpToCanvas(webp_data, webp_data.length);