Commit Graph

12 Commits

Author SHA1 Message Date
James Zern
f88666eb47 webp_js/*.html: fix canvas mapping
after:
24d7f9cb Switch code to SDL2.

fixes:
webp_wasm.js:1 Uncaught TypeError: Cannot read properties of null
    (reading 'addEventListener')
    at Object.registerOrRemoveHandler (webp_wasm.js:1:101330)
    at registerMouseEventCallback (webp_wasm.js:1:154227)
    at _emscripten_set_mousemove_callback_on_thread (webp_wasm.js:1:155015)
    ...

The SDL2 port forces the canvas id to '#canvas':
324df6865a/src/video/emscripten/SDL_emscriptenvideo.c (L210)

This change maps '#output_canvas' to this entry in specialHTMLTargets[]:
https://emscripten.org/docs/api_reference/html5.h.html

https://github.com/libsdl-org/SDL/issues/5260 &
https://github.com/emscripten-ports/SDL2/issues/130 may also be related.

Change-Id: I26f4aa22b9d68b0fc45b83edfe6fe074b59a82a7
Test: emscripten 3.1.16
2024-03-29 12:53:05 -07:00
Vincent Rabaud
24d7f9cb6e Switch code to SDL2.
Also simplify wasm html (now that it is suppported by all browsers).

Change-Id: I352b08594b93d3dd7d44832d4328b3546ccc1b90
2023-10-28 23:36:35 +02:00
James Zern
c5e841c417 Merge "extras: WebpToSDL -> WebPToSDL" into main 2022-12-16 20:15:12 +00:00
James Zern
d3e151fc03 doc/api.md,webp_js/README.md: Webp -> WebP
Change-Id: Ib30d008b5750d2e4064aaf478db6f5bc7aa5902e
2022-12-15 18:14:19 -08:00
James Zern
ed92a62649 extras: WebpToSDL -> WebPToSDL
this normalizes the function case to what's more commonly used in the
project

Change-Id: If614cb8eff4afba96b2468e28c52d850651a759b
2022-12-15 18:11:40 -08:00
James Zern
19b1a71c48 webp_js/README.md,cosmetics: reflow some lines
after:
cb90f76b Update wasm instructions.

Change-Id: I8d937d08dba98c23c4a298ba1165e4b1f553fea9
2022-10-06 14:10:03 -07:00
Vincent Rabaud
cb90f76b68 Update wasm instructions.
Also update the quotes in CMake following:
https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-specify-s-options-in-a-cmake-project
https://emscripten.org/docs/getting_started/FAQ.html#why-do-i-get-a-nameerror-or-a-problem-occurred-in-evaluating-content-after-a-s-when-i-use-a-s-option

Change-Id: I9cc0a5aece0019c81e3f435106bf288cd68d0fd0
2022-10-04 16:24:57 +02:00
Maryla
54e61a3864 Markdownify libwebp docs and reorganize them.
Break the main README into into multiple pages in the doc/ directory,
except for the tests, swig and webp_js docs which are in the corresponding
directories.
The webp mux doc is merged into the API doc and the tools doc.

Change-Id: Ia407617dd88094f4662841d37947cfef80799914
2022-02-15 15:31:56 +00:00
skal
6878d42720 fix memory leak in SDL_Init()
we use a static guard to only call SDL_Init() once.

Another option would be to call SDL_Quit(), but it doesn't seem to be
doing anything.

Also, fix the HTML code and add 'use strict' directive.

BUG=webp:354

Change-Id: I3c6421e2c1c8cc200556cd4092a0ead9a8b054ef
2017-07-31 12:47:02 -07:00
Pascal Massimino
134e314fd8 WASM support
demo page: webp_js/index_wasm.html

Change-Id: I9e6bde205c2730f96c5f30ec01f4bfacf1f5d128
2017-03-21 14:07:22 +01:00
Pascal Massimino
027151ca6c don't erase the surface before blitting.
It's done at HTML level with canvas.clearRect()

BUG=webp:261

Change-Id: I83c73791f5922cd1f426f19faf856fa1cf8f0311
2017-02-08 16:07:08 +00:00
Pascal Massimino
ca9f7b7dd6 WebP-JS: emscripten-based Javascript decoder
The build is based on CMake.

There is a demo HTML page under webp_js/index.html

See README.webp_js file.

BUG=webp:261

Change-Id: I6612378b89907efd7b863720c6becf98385fc406
2017-02-07 11:02:42 +00:00