From c85adb33d222cb80105bc8f79dd3b0001d712561 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Fri, 25 Nov 2016 15:31:54 +0100 Subject: [PATCH] vwebp: make 'd' key toggle the debugging of fragments it actually disables the disposal / blending method and just displays the raw delta values. Useful for debugging. TODO: Outline the refreshed area with a drawn rectangle? Change-Id: I6f8cddd0aad8b953cff78a693ae7e8c31def010c --- README | 1 + examples/vwebp.c | 9 ++++++++- man/vwebp.1 | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README b/README index ba4e8c5d..908e5591 100644 --- a/README +++ b/README @@ -384,6 +384,7 @@ Options are: Keyboard shortcuts: 'c' ................ toggle use of color profile 'i' ................ overlay file information + 'd' ................ disable blending & disposal (debug) 'q' / 'Q' / ESC .... quit Building: diff --git a/examples/vwebp.c b/examples/vwebp.c index 0fddf725..17887f77 100644 --- a/examples/vwebp.c +++ b/examples/vwebp.c @@ -54,6 +54,7 @@ static struct { int done; int decoding_error; int print_info; + int only_deltas; int use_color_profile; int canvas_width, canvas_height; @@ -252,6 +253,9 @@ static void HandleKey(unsigned char key, int pos_x, int pos_y) { // more involved though (need to save the previous frame). if (!kParams.has_animation) ClearPreviousFrame(); glutPostRedisplay(); + } else if (key == 'd') { + kParams.only_deltas = 1 - kParams.only_deltas; + glutPostRedisplay(); } } @@ -314,7 +318,9 @@ static void HandleDisplay(void) { glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ROW_LENGTH, pic->u.RGBA.stride / 4); - if (prev->dispose_method == WEBP_MUX_DISPOSE_BACKGROUND || + if (kParams.only_deltas) { + DrawCheckerBoard(); + } else if (prev->dispose_method == WEBP_MUX_DISPOSE_BACKGROUND || curr->blend_method == WEBP_MUX_NO_BLEND) { // glScissor() takes window coordinates (0,0 at bottom left). int window_x, window_y; @@ -414,6 +420,7 @@ static void Help(void) { "Keyboard shortcuts:\n" " 'c' ................ toggle use of color profile\n" " 'i' ................ overlay file information\n" + " 'd' ................ disable blending & disposal (debug)\n" " 'q' / 'Q' / ESC .... quit\n" ); } diff --git a/man/vwebp.1 b/man/vwebp.1 index a7d5181f..4ec346a3 100644 --- a/man/vwebp.1 +++ b/man/vwebp.1 @@ -1,5 +1,5 @@ .\" Hey, EMACS: -*- nroff -*- -.TH VWEBP 1 "June 23, 2016" +.TH VWEBP 1 "November 25, 2016" .SH NAME vwebp \- decompress a WebP file and display it in a window .SH SYNOPSIS @@ -59,6 +59,9 @@ Toggle use of color profile. .B 'i' Overlay file information. .TP +.B 'd' +Disable blending and disposal process, for debugging purposes. +.TP .B 'q' / 'Q' / ESC Quit.