summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2009-05-25 18:20:05 -0300
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-16 15:52:38 -0500
commit77d4db015c99ce7083fd5b33f0c650176fe8bc98 (patch)
tree0354f19d12c65fa1275b6361a766130a570723b3 /hw
parentaea2a33c73f28ecd8f10b242ecadddcc79c1c28b (diff)
downloadhqemu-77d4db015c99ce7083fd5b33f0c650176fe8bc98.zip
hqemu-77d4db015c99ce7083fd5b33f0c650176fe8bc98.tar.gz
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. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/vga.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/vga.c b/hw/vga.c
index 97bf1b6..134ad16 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);
OpenPOWER on IntegriCloud