don't erase the surface before blitting.

It's done at HTML level with canvas.clearRect()

BUG=webp:261

Change-Id: I83c73791f5922cd1f426f19faf856fa1cf8f0311
This commit is contained in:
Pascal Massimino 2017-02-08 16:34:57 +01:00
parent 4105d565d3
commit 027151ca6c
2 changed files with 7 additions and 4 deletions

View File

@ -60,6 +60,7 @@ int WebpToSDL(const char* data, unsigned int data_size) {
0x0000ff00u, // G mask
0x00ff0000u, // B mask
0xff000000u); // A mask
if (surface == NULL) {
fprintf(stderr, "Unable to create %dx%d RGBA surface!\n",
input->width, input->height);
@ -86,8 +87,7 @@ int WebpToSDL(const char* data, unsigned int data_size) {
}
if (SDL_MUSTLOCK(surface)) SDL_UnlockSurface(surface);
if (SDL_FillRect(screen, &screen->clip_rect, 0xffffffff) ||
SDL_BlitSurface(surface, NULL, screen, NULL) ||
if (SDL_BlitSurface(surface, NULL, screen, NULL) ||
SDL_Flip(screen)) {
goto Error;
}

View File

@ -21,8 +21,11 @@ function init() {
function decode(webp_data, canvas_id) {
// get the canvas to decode into
Module.canvas = document.getElementById(canvas_id);
if (Module.canvas == null) return;
var canvas = document.getElementById(canvas_id);
if (canvas == null) return;
// clear previous picture (if any)
Module.canvas = canvas;
canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height);
// decode and measure timing
start = new Date();
var ret = WebpToCanvas(webp_data, webp_data.length);