Mercurial > hg > xemacs-beta
diff src/glyphs-x.c @ 36:c53a95d3c46d r19-15b101
Import from CVS: tag r19-15b101
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:53:38 +0200 |
parents | d620409f5eb8 |
children | 1a767b41a199 |
line wrap: on
line diff
--- a/src/glyphs-x.c Mon Aug 13 08:53:21 2007 +0200 +++ b/src/glyphs-x.c Mon Aug 13 08:53:38 2007 +0200 @@ -59,6 +59,9 @@ #include <setjmp.h> +/* Set to 1 if you wish to implement this feature */ +# define HAVE_SUBWINDOWS 0 + #define LISP_DEVICE_TO_X_SCREEN(dev) \ XDefaultScreenOfDisplay (DEVICE_X_DISPLAY (XDEVICE (dev))) @@ -140,8 +143,10 @@ } write_c_string (")", printcharfun); break; +#if HAVE_SUBWINDOWS case IMAGE_SUBWINDOW: /* #### implement me */ +#endif default: break; } @@ -202,8 +207,10 @@ if (IMAGE_INSTANCE_X_NPIXELS (p1) != IMAGE_INSTANCE_X_NPIXELS (p2)) return 0; break; +#if HAVE_SUBWINDOWS case IMAGE_SUBWINDOW: /* #### implement me */ +#endif break; default: break; @@ -221,8 +228,10 @@ case IMAGE_COLOR_PIXMAP: case IMAGE_POINTER: return IMAGE_INSTANCE_X_NPIXELS (p); +#if HAVE_SUBWINDOWS case IMAGE_SUBWINDOW: /* #### implement me */ +#endif return 0; default: return 0; @@ -1604,6 +1613,7 @@ return Qnil; } +#if 0 /* We provide our own version of DGifSlurp() because the standardly provided one doesn't handle interlaced GIFs. This is based on code in gif2x11.c. */ @@ -1710,6 +1720,7 @@ return GIF_OK; } +#endif static void gif_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, @@ -1759,10 +1770,12 @@ signal_simple_error ("Unable to decode GIF", build_string (EmacsPrintGifError ())); } -#if 1 +#if 0 if (our_own_dgif_slurp_from_gif2x11_c(unwind.giffile) != GIF_OK) #else - /* DGifSlurp() doesn't handle interlaced files. */ + /* DGifSlurp() doesn't handle interlaced files. */ + /* Actually, it does, sort of. It just sets the Interlace flag + and stores RasterBits in interlaced order. We handle that below. */ if (DGifSlurp (unwind.giffile) != GIF_OK) #endif goto gif_decode_error; @@ -1801,7 +1814,12 @@ int width = unwind.giffile->SWidth; int depth; int bitmap_pad; - int i, j; + int i, j, row, pass, interlace; + /* interlaced gifs have rows in this order: + 0, 8, 16, ..., 4, 12, 20, ..., 2, 6, 10, ..., 1, 3, 5, ... */ + static int InterlacedOffset[] = { 0, 4, 2, 1 }; + static int InterlacedJumps[] = { 8, 8, 4, 2 }; + depth = DefaultDepthOfScreen (scr); @@ -1834,14 +1852,35 @@ optimization routines from XPM (they're in turn mostly copied from the Xlib source code). */ + /* Note: We just use the first image in the file and ignore the rest. + We check here that that image covers the full "screen" size. + I don't know whether that's always the case. + -dkindred@cs.cmu.edu */ + if (unwind.giffile->SavedImages[0].ImageDesc.Height != height + || unwind.giffile->SavedImages[0].ImageDesc.Width != width + || unwind.giffile->SavedImages[0].ImageDesc.Left != 0 + || unwind.giffile->SavedImages[0].ImageDesc.Top != 0) + signal_simple_error ("First image in GIF file is not full size", + instantiator); + + interlace = unwind.giffile->SavedImages[0].ImageDesc.Interlace; + pass = 0; + row = interlace ? InterlacedOffset[pass] : 0; for (i = 0; i < height; i++) - for (j = 0; j < width; j++) - XPutPixel (unwind.ximage, j, i, - unwind.pixels[(unsigned char) - /* incorrect signed declaration - of RasterBits[] */ - (unwind.giffile->SavedImages-> - RasterBits[i * width + j])]); + { + if (interlace && row >= height) + row = InterlacedOffset[++pass]; + + for (j = 0; j < width; j++) + XPutPixel (unwind.ximage, j, row, + unwind.pixels[(unsigned char) + /* incorrect signed declaration + of RasterBits[] */ + (unwind.giffile->SavedImages[0]. + RasterBits[i * width + j])]); + + row += interlace ? InterlacedJumps[pass] : 1; + } } /* 4. Now create the pixmap and set up the image instance */ @@ -3432,6 +3471,7 @@ } +#if HAVE_SUBWINDOWS /************************************************************************/ /* subwindows */ /************************************************************************/ @@ -3707,7 +3747,7 @@ return subwindow; } - +#endif /************************************************************************/ /* initialization */ @@ -3716,6 +3756,7 @@ void syms_of_glyphs_x (void) { +#if HAVE_SUBWINDOWS defsymbol (&Qsubwindowp, "subwindowp"); DEFSUBR (Fmake_subwindow); @@ -3726,6 +3767,7 @@ DEFSUBR (Fsubwindow_xid); DEFSUBR (Fresize_subwindow); DEFSUBR (Fforce_subwindow_map); +#endif defkeyword (&Q_mask_file, ":mask-file"); defkeyword (&Q_mask_data, ":mask-data");