]> git.proxmox.com Git - qemu.git/commitdiff
Fix vga_screen_dump_blank() PPM generation
authorEduardo Habkost <ehabkost@redhat.com>
Mon, 25 May 2009 21:20:05 +0000 (18:20 -0300)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 16 Jun 2009 22:46:59 +0000 (17:46 -0500)
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 77d4db015c99ce7083fd5b33f0c650176fe8bc98)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/vga.c

index 709d6bb9917df0a4eb52422d20abcba48bee4c02..00a7ae5a13d8517c3e5faacfdc1dc7348eeed479 100644 (file)
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -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);