X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgfxloader.c;h=9a28f43541d85a40420b30655833bf729c820dff;hb=ab0879a8bcb3e816912bc89b8e21c22cc2a4c0c2;hp=d0bd1cbae59fb299998e9b8c26c3c456344590fd;hpb=b7d31643c9c84104fb3ebef778e545928610ff65;p=rocksndiamonds.git diff --git a/src/gfxloader.c b/src/gfxloader.c index d0bd1cba..9a28f435 100644 --- a/src/gfxloader.c +++ b/src/gfxloader.c @@ -14,6 +14,19 @@ #include "gfxloader.h" + + + + + +extern Window window; +extern void Delay(long); + + + + + + #ifdef DEBUG /* #define DEBUG_GIF @@ -63,12 +76,22 @@ static int Read_GIF_to_Pixmap_or_Bitmap(Display *, char *, Pixmap *, int); int Read_GIF_to_Bitmap(Display *display, char *filename, Pixmap *pixmap) { + printf("Read_GIF_to_Bitmap\n"); + + + + return(Read_GIF_to_Pixmap_or_Bitmap(display, filename, pixmap, READ_GIF_TO_BITMAP)); } int Read_GIF_to_Pixmap(Display *display, char *filename, Pixmap *pixmap) { + printf("Read_GIF_to_Pixmap\n"); + + + + return(Read_GIF_to_Pixmap_or_Bitmap(display, filename, pixmap, READ_GIF_TO_PIXMAP)); } @@ -141,6 +164,22 @@ int Read_GIF_to_Pixmap_or_Bitmap(Display *display, char *filename, gcv.background = WhitePixel(display,screen); gc = XCreateGC(display, root, GCForeground | GCBackground, &gcv); XPutImage(display,new_pixmap,gc,image,0,0,0,0,width,height); + + + + + + + Delay(1000000); + + XPutImage(display,window,gc,image,0,0,0,0,width,height); + + Delay(3000000); + + + + + XFreeGC(display, gc); } @@ -770,19 +809,54 @@ static int ConvertXImageDepth(Display *display, XImage **image) int screen = DefaultScreen(display); int depth = DefaultDepth(display, screen); + + + + + + printf("ConvertXImageDepth:\n"); + printf("(*image)->depth == %d\n", + (*image)->depth); + printf("DefaultDepth(display, screen) == %d\n", + DefaultDepth(display, screen)); + + + + if ((*image)->depth != depth) { XImage *old_image, *new_image; + /* Visual *visual = DefaultVisual(display,screen); + */ int width = (*image)->width; int height = (*image)->height; register int dwx, dwy; byte *data; - data = (byte *)malloc(width * height); + + + + + printf("ConvertXImageDepth: ---------> CONVERTING...\n"); + + + + + + + data = (byte *)malloc(width * height * depth); old_image = *image; + + /* new_image = XCreateImage(display,visual,depth, ZPixmap,0,data,width,height,8,0); + */ + + new_image = XGetImage(display,RootWindow(display,screen), + 0,0,width,height,0xffffffff,ZPixmap); + + if (!new_image) return(GIF_NoMemory); @@ -811,13 +885,17 @@ static int ConvertXImageDepth(Display *display, XImage **image) } else /* other format change than 8 bit -> 4 bit */ { - register unsigned long pixel_value; + unsigned long pixel_value; for (dwx=0; dwx 0xff) + printf("pixel = %lx", pixel_value); + XPutPixel(new_image, dwx, dwy, pixel_value); } } @@ -901,6 +979,15 @@ int Read_ILBM_to_Bitmap(Display *display, char *filename, Pixmap *pixmap) int bytes_per_line, bitmap_size; FILE *file; + + + + + printf("Read_ILBM_to_Bitmap\n"); + + + + if (!(file = fopen(filename,"r"))) return(ILBM_OpenFailed);