qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix vga_screen_dump_blank() PPM generation
@ 2009-05-25 21:20 Eduardo Habkost
  0 siblings, 0 replies; only message in thread
From: Eduardo Habkost @ 2009-05-25 21:20 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

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.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/vga.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/vga.c b/hw/vga.c
index 013ff10..18afa2a 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -2584,8 +2584,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");
@@ -2594,7 +2595,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);
-- 
1.6.3.rc4.29.g8146

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-25 21:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-25 21:20 [Qemu-devel] [PATCH] Fix vga_screen_dump_blank() PPM generation Eduardo Habkost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).