From 46e18c0a256c486cfd5360f556a90a5f6463c4d9 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Fri, 23 Oct 2015 00:01:24 -0700 Subject: [PATCH] vwebp: fix incorrect clipping w/NO_BLEND when the previous frame does not specify dispose to background only the current frame's rectangle should be cleared related to bug #245 (cherry picked from commit 469ba2cdfdcaaabbc0993994243646c257b3526c) Change-Id: I2fc4f5be99057e0bf87d8fedec57b06859b070bd --- examples/vwebp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/vwebp.c b/examples/vwebp.c index b515b27a..f5aaa6d6 100644 --- a/examples/vwebp.c +++ b/examples/vwebp.c @@ -308,19 +308,24 @@ static void HandleDisplay(void) { // they will be incorrect if the window is resized. // glScissor() takes window coordinates (0,0 at bottom left). int window_x, window_y; + int frame_w, frame_h; if (prev->dispose_method == WEBP_MUX_DISPOSE_BACKGROUND) { // Clear the previous frame rectangle. window_x = prev->x_offset; window_y = kParams.canvas_height - prev->y_offset - prev->height; + frame_w = prev->width; + frame_h = prev->height; } else { // curr->blend_method == WEBP_MUX_NO_BLEND. // We simulate no-blending behavior by first clearing the current frame // rectangle (to a checker-board) and then alpha-blending against it. window_x = curr->x_offset; window_y = kParams.canvas_height - curr->y_offset - curr->height; + frame_w = curr->width; + frame_h = curr->height; } glEnable(GL_SCISSOR_TEST); // Only update the requested area, not the whole canvas. - glScissor(window_x, window_y, prev->width, prev->height); + glScissor(window_x, window_y, frame_w, frame_h); glClear(GL_COLOR_BUFFER_BIT); // use clear color DrawCheckerBoard();