diff --git a/extras/webp_to_sdl.c b/extras/webp_to_sdl.c index 461d4c72..3dabc46b 100755 --- a/extras/webp_to_sdl.c +++ b/extras/webp_to_sdl.c @@ -28,6 +28,7 @@ #include #endif +static int init_ok = 0; int WebpToSDL(const char* data, unsigned int data_size) { int ok = 0; VP8StatusCode status; @@ -42,7 +43,10 @@ int WebpToSDL(const char* data, unsigned int data_size) { return 1; } - SDL_Init(SDL_INIT_VIDEO); + if (!init_ok) { + SDL_Init(SDL_INIT_VIDEO); + init_ok = 1; + } status = WebPGetFeatures((uint8_t*)data, (size_t)data_size, &config.input); if (status != VP8_STATUS_OK) goto Error; @@ -97,6 +101,7 @@ int WebpToSDL(const char* data, unsigned int data_size) { Error: SDL_FreeSurface(surface); SDL_FreeSurface(screen); + WebPFreeDecBuffer(output); return ok; } diff --git a/webp_js/index.html b/webp_js/index.html index 3ac9325f..10873a98 100644 --- a/webp_js/index.html +++ b/webp_js/index.html @@ -12,12 +12,15 @@ - +

WebP in JavaScript demo -

diff --git a/webp_js/index_wasm.html b/webp_js/index_wasm.html index 21950632..b77c22c4 100644 --- a/webp_js/index_wasm.html +++ b/webp_js/index_wasm.html @@ -11,6 +11,11 @@ - +

WebP demo using Web-Assembly -