From 6c8223f606cb199e9ddecfd48eb28e16a458fe6e Mon Sep 17 00:00:00 2001 From: TimeServ Date: Tue, 31 Oct 2006 04:12:20 +0000 Subject: [PATCH] fix PNG screenshots under AMD64, fix 8bpp screenshots under X git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2437 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/image.c | 2 +- engine/sw/vid_x.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/client/image.c b/engine/client/image.c index 9e013629b..4cf19af34 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -719,7 +719,7 @@ int Image_WritePNG (char *filename, int compression, qbyte *pixels, int width, i png_set_IHDR(png_ptr, info_ptr, width, height, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); png_write_info(png_ptr, info_ptr); - row_pointers = BZ_Malloc (4 * height); + row_pointers = BZ_Malloc (sizeof(png_byte *) * height); for (i = 0; i < height; i++) row_pointers[height - i - 1] = pixels + i * width * 3; png_write_image(png_ptr, row_pointers); diff --git a/engine/sw/vid_x.c b/engine/sw/vid_x.c index dce6b4c2a..35aab1d92 100644 --- a/engine/sw/vid_x.c +++ b/engine/sw/vid_x.c @@ -404,7 +404,7 @@ void ResetFrameBuffer(void) if (!x_framebuffer[0]) Sys_Error("VID: XCreateImage failed\n"); - vid.buffer = (qbyte*) (x_framebuffer[0]); + vid.buffer = (qbyte*) (x_framebuffer[0]->data); vid.conbuffer = vid.buffer; } @@ -806,8 +806,6 @@ void SWVID_SetPalette(unsigned char *palette) if (x_visinfo->class == PseudoColor && x_visinfo->depth == 8) { - if (palette != vid_curpal) - memcpy(vid_curpal, palette, 768); for (i=0 ; i<256 ; i++) { colors[i].pixel = i; @@ -819,6 +817,8 @@ void SWVID_SetPalette(unsigned char *palette) XStoreColors(vid_dpy, x_cmap, colors, 256); } + if (palette != vid_curpal) + memcpy(vid_curpal, palette, 768); } // Called at shutdown