Skip to content
Snippets Groups Projects
Commit 41de90f3 authored by Eduardo Habkost's avatar Eduardo Habkost Committed by Anthony Liguori
Browse files

Fix vga_screen_dump_blank() PPM generation


vga_screen_dump_blank() was not generating a valid PPM file: the width of the
image made no sense (why it was multiplied by sizeof(uint32_t)?), and there was
only one sample per pixel, instead of three.

(cherry picked from commit 77d4db01)

Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 3e6b53eb
No related branches found
No related tags found
No related merge requests found
......@@ -2606,8 +2606,9 @@ static void vga_screen_dump_blank(VGAState *s, const char *filename)
{
FILE *f;
unsigned int y, x, w, h;
unsigned char blank_sample[3] = { 0, 0, 0 };
w = s->last_scr_width * sizeof(uint32_t);
w = s->last_scr_width;
h = s->last_scr_height;
f = fopen(filename, "wb");
......@@ -2616,7 +2617,7 @@ static void vga_screen_dump_blank(VGAState *s, const char *filename)
fprintf(f, "P6\n%d %d\n%d\n", w, h, 255);
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
fputc(0, f);
fwrite(blank_sample, 3, 1, f);
}
}
fclose(f);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment