diff options
Diffstat (limited to 'src/PutImage.c')
-rw-r--r-- | src/PutImage.c | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/src/PutImage.c b/src/PutImage.c index 8c13a097..3ae375d2 100644 --- a/src/PutImage.c +++ b/src/PutImage.c @@ -24,26 +24,26 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/X11/PutImage.c,v 3.11 2002/12/09 04:10:56 tsi Exp $ */ #include "Xlibint.h" #include "Xutil.h" #include <stdio.h> -#ifdef __STDC__ -#define Const const -#else -#define Const /**/ -#endif #if defined(__STDC__) && ((defined(sun) && defined(SVR4)) || defined(WIN32)) #define RConst /**/ #else -#define RConst Const +#define RConst const +#endif + +#if defined(Lynx) && defined(ROUNDUP) +#undef ROUNDUP #endif /* assumes pad is a power of 2 */ #define ROUNDUP(nbytes, pad) (((nbytes) + ((pad) - 1)) & ~(long)((pad) - 1)) -static unsigned char Const _reverse_byte[0x100] = { +static unsigned char const _reverse_byte[0x100] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, @@ -78,7 +78,7 @@ static unsigned char Const _reverse_byte[0x100] = { 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff }; -static unsigned char Const _reverse_nibs[0x100] = { +static unsigned char const _reverse_nibs[0x100] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, @@ -113,7 +113,7 @@ static unsigned char Const _reverse_nibs[0x100] = { 0x8f, 0x9f, 0xaf, 0xbf, 0xcf, 0xdf, 0xef, 0xff }; - +int _XReverse_Bytes (bpt, nb) register unsigned char *bpt; register int nb; @@ -282,7 +282,7 @@ SwapNibbles (src, dest, srclen, srcinc, destinc, height) unsigned int height; { register long h, n; - register Const unsigned char *rev = _reverse_nibs; + register const unsigned char *rev = _reverse_nibs; srcinc -= srclen; destinc -= srclen; @@ -329,7 +329,7 @@ SwapBits (src, dest, srclen, srcinc, destinc, height, half_order) int half_order; { register long h, n; - register Const unsigned char *rev = _reverse_byte; + register const unsigned char *rev = _reverse_byte; srcinc -= srclen; destinc -= srclen; @@ -343,10 +343,11 @@ SwapBitsAndTwoBytes (src, dest, srclen, srcinc, destinc, height, half_order) register unsigned char *src, *dest; long srclen, srcinc, destinc; unsigned int height; + int half_order; { long length = ROUNDUP(srclen, 2); register long h, n; - register Const unsigned char *rev = _reverse_byte; + register const unsigned char *rev = _reverse_byte; srcinc -= length; destinc -= length; @@ -374,7 +375,7 @@ SwapBitsAndFourBytes (src, dest, srclen, srcinc, destinc, height, half_order) { long length = ROUNDUP(srclen, 4); register long h, n; - register Const unsigned char *rev = _reverse_byte; + register const unsigned char *rev = _reverse_byte; srcinc -= length; destinc -= length; @@ -410,7 +411,7 @@ SwapBitsAndWords (src, dest, srclen, srcinc, destinc, height, half_order) { long length = ROUNDUP(srclen, 4); register long h, n; - register Const unsigned char *rev = _reverse_byte; + register const unsigned char *rev = _reverse_byte; srcinc -= length; destinc -= length; @@ -529,7 +530,7 @@ static void (* RConst (SwapFunction[12][12]))() = { * * Defines whether the first half of a unit has the first half of the data */ -static int Const HalfOrder[12] = { +static int const HalfOrder[12] = { LSBFirst, /* 1Mm */ LSBFirst, /* 2Mm */ LSBFirst, /* 4Mm */ @@ -550,7 +551,7 @@ static int Const HalfOrder[12] = { * NoSwap or SwapBits) in addition to changing the desired ones. */ -static int Const HalfOrderWord[12] = { +static int const HalfOrderWord[12] = { MSBFirst, /* 1Mm */ MSBFirst, /* 2Mm */ MSBFirst, /* 4Mm */ @@ -904,6 +905,16 @@ PutSubImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y, } } +extern void _XInitImageFuncPtrs(); + +#ifdef USE_DYNAMIC_XCURSOR +void +_XNoticePutBitmap (Display *dpy, + Drawable draw, + XImage *image); +#endif + +int XPutImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width, req_height) register Display *dpy; @@ -951,7 +962,6 @@ XPutImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width, if (dest_bits_per_pixel != image->bits_per_pixel) { XImage img; register long i, j; - extern void _XInitImageFuncPtrs(); /* XXX slow, but works */ img.width = width; img.height = height; @@ -994,5 +1004,15 @@ XPutImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width, UnlockDisplay(dpy); SyncHandle(); +#ifdef USE_DYNAMIC_XCURSOR + if (image->bits_per_pixel == 1 && + x == 0 && y == 0 && + width == image->width && height == image->height && + gc->values.function == GXcopy && + (gc->values.plane_mask & 1)) + { + _XNoticePutBitmap (dpy, d, image); + } +#endif return 0; } |