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
This commit is contained in:
Pascal Massimino 2016-11-25 15:31:54 +01:00
parent bc18ebad2e
commit c85adb33d2
3 changed files with 13 additions and 2 deletions

1
README
View File

@ -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:

View File

@ -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"
);
}

View File

@ -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.