From 76510834f382bc82548e72c8e7f6f7672c9484dc Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 3 Aug 2003 17:35:04 +0200 Subject: [PATCH] rnd-20030803-2-src --- Makefile | 4 ++-- src/conftime.h | 2 +- src/libgame/image.c | 12 ++++++++---- src/libgame/pcx.c | 12 ++++++++---- src/libgame/system.c | 4 +++- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 0c22aefb..bdd285b5 100644 --- a/Makefile +++ b/Makefile @@ -49,8 +49,8 @@ CROSS_PATH_WIN32=/usr/local/cross-tools/i386-mingw32msvc SRC_DIR = src MAKE_CMD = $(MAKE) -C $(SRC_DIR) -# DEFAULT_TARGET = x11 -DEFAULT_TARGET = sdl +DEFAULT_TARGET = x11 +# DEFAULT_TARGET = sdl all: @$(MAKE_CMD) TARGET=$(DEFAULT_TARGET) diff --git a/src/conftime.h b/src/conftime.h index 8793f015..2651124b 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-08-03 00:37]" +#define COMPILE_DATE_STRING "[2003-08-03 17:34]" diff --git a/src/libgame/image.c b/src/libgame/image.c index 95e098e2..f06a126e 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -586,9 +586,13 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap, int zoom_factor = src_width / dst_width; /* currently very limited! */ int row_skip, col_skip; + /* adjust source image size to integer multiple of destination image size */ + src_width = dst_width * zoom_factor; + src_height = dst_height * zoom_factor; + /* copy source pixmap to temporary image */ - src_ximage = XGetImage(display, src_pixmap, 0, 0, - src_width, src_height, AllPlanes, ZPixmap); + src_ximage = XGetImage(display, src_pixmap, 0, 0, src_width, src_height, + AllPlanes, ZPixmap); bits_per_pixel = src_ximage->bits_per_pixel; bytes_per_pixel = (bits_per_pixel + 7) / 8; @@ -609,12 +613,12 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap, /* scale image down by scaling factor 'zoom_factor' */ for (y=0; y < src_height; y += zoom_factor, src_ptr += row_skip) for (x=0; x < src_width; x += zoom_factor, src_ptr += col_skip) - for (i=0; i= 0; j--) { - byte bit = (value >> j) & 1; + byte bit; + if (i * 8 + j >= width) /* skip padding bits */ + continue; + + bit = (value >> j) & 1; bitmap_ptr[x++] |= bit << plane; } } @@ -332,6 +336,7 @@ Image *Read_PCX_to_Image(char *filename) #if PCX_DEBUG if (options.verbose) { + printf("\n"); printf("%s is a %dx%d PC Paintbrush image\n", filename, width, height); printf("depth: %d\n", depth); printf("bits_per_pixel: %d\n", pcx.bits_per_pixel); @@ -371,7 +376,6 @@ Image *Read_PCX_to_Image(char *filename) if (pcx_depth == 8) { /* determine number of used colormap entries for 8-bit PCX images */ - image->rgb.used = 0; for (i=0; irgb.color_used[i]) image->rgb.used++; @@ -379,7 +383,7 @@ Image *Read_PCX_to_Image(char *filename) #if PCX_DEBUG if (options.verbose) - printf("Read_PCX_to_Image: %d colors found\n", image->rgb.used); + printf("Read_PCX_to_Image: %d colors in colormap\n", image->rgb.used); #endif return image; diff --git a/src/libgame/system.c b/src/libgame/system.c index 04d06e69..4a4c4d35 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -821,7 +821,7 @@ void CreateBitmapWithSmallBitmaps(Bitmap *src_bitmap) src_height = src_bitmap->height; tmp_width = src_width; - tmp_height = src_height + src_height / 2; + tmp_height = src_height + (src_height + 1) / 2; /* prevent odd height */ tmp_bitmap = CreateBitmap(tmp_width, tmp_height, DEFAULT_DEPTH); @@ -838,9 +838,11 @@ void CreateBitmapWithSmallBitmaps(Bitmap *src_bitmap) FreeBitmap(tmp_bitmap_8); #if defined(TARGET_SDL) + /* !!! what about the old src_bitmap->surface ??? FIX ME !!! */ src_bitmap->surface = tmp_bitmap->surface; tmp_bitmap->surface = NULL; #else + /* !!! see above !!! */ src_bitmap->drawable = tmp_bitmap->drawable; tmp_bitmap->drawable = None; #endif -- 2.34.1