X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea258ad3489638fbcf504a674f8793b1362bd2b5..77611ad4da9df336a0805508276a81b8f4437107:/src/xpm/scan.c?ds=sidebyside diff --git a/src/xpm/scan.c b/src/xpm/scan.c index 93c7f72a1d..c4ee723280 100644 --- a/src/xpm/scan.c +++ b/src/xpm/scan.c @@ -261,24 +261,26 @@ XpmCreateXpmImageFromImage(display, image, shapeimage, /* * scan shape mask if any */ - if (shapeimage) { + if (shapeimage) + { #ifndef FOR_MSW # ifndef AMIGA - ErrorStatus = GetImagePixels1(shapeimage, width, height, &pmap, - storeMaskPixel); + ErrorStatus = GetImagePixels1(shapeimage, width, height, &pmap, + storeMaskPixel); # else - ErrorStatus = AGetImagePixels(shapeimage, width, height, &pmap, - storeMaskPixel); -# endif + ErrorStatus = AGetImagePixels(shapeimage, width, height, &pmap, + storeMaskPixel); +# endif /* AMIGA */ #else #ifndef __OS2__ - ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height, - &pmap, storeMaskPixel); + ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height, + &pmap, storeMaskPixel); /* calling convention all messed up OS/2 -- figure out later */ #endif -#endif +#endif /* ndef for FOR_MSW */ + if (ErrorStatus != XpmSuccess) RETURN(ErrorStatus); } @@ -291,36 +293,40 @@ XpmCreateXpmImageFromImage(display, image, shapeimage, * */ - if (image) { + if (image) + { #ifndef FOR_MSW # ifndef AMIGA - if (((image->bits_per_pixel | image->depth) == 1) && - (image->byte_order == image->bitmap_bit_order)) - ErrorStatus = GetImagePixels1(image, width, height, &pmap, - storePixel); - else if (image->format == ZPixmap) { - if (image->bits_per_pixel == 8) - ErrorStatus = GetImagePixels8(image, width, height, &pmap); - else if (image->bits_per_pixel == 16) - ErrorStatus = GetImagePixels16(image, width, height, &pmap); - else if (image->bits_per_pixel == 32) - ErrorStatus = GetImagePixels32(image, width, height, &pmap); - } else - ErrorStatus = GetImagePixels(image, width, height, &pmap); + if (((image->bits_per_pixel | image->depth) == 1) && + (image->byte_order == image->bitmap_bit_order)) + ErrorStatus = GetImagePixels1(image, width, height, &pmap, + storePixel); + else if (image->format == ZPixmap) + { + if (image->bits_per_pixel == 8) + ErrorStatus = GetImagePixels8(image, width, height, &pmap); + else if (image->bits_per_pixel == 16) + ErrorStatus = GetImagePixels16(image, width, height, &pmap); + else if (image->bits_per_pixel == 32) + ErrorStatus = GetImagePixels32(image, width, height, &pmap); + } + else + ErrorStatus = GetImagePixels(image, width, height, &pmap); # else - ErrorStatus = AGetImagePixels(image, width, height, &pmap, - storePixel); -# endif + ErrorStatus = AGetImagePixels(image, width, height, &pmap, + storePixel); +# endif /* AMIGA */ #else -#ifndef __OS2__ - ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap, - storePixel); +#ifndef __VISAGECPP30__ + ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap, + storePixel); #endif #endif - if (ErrorStatus != XpmSuccess) - RETURN(ErrorStatus); + + if (ErrorStatus != XpmSuccess) + RETURN(ErrorStatus); } /* @@ -644,22 +650,12 @@ static unsigned long Const low_bits_table[] = { * */ -#ifdef __OS2__ -/* Visual Age cannot deal with old, non-ansi, code */ -static int GetImagePixels( - XImage* image -, unsigned int width -, unsigned int height -, PixelsMap* pmap -) -#else static int GetImagePixels(image, width, height, pmap) XImage *image; unsigned int width; unsigned int height; PixelsMap *pmap; -#endif { char *src; char *dst; @@ -757,22 +753,12 @@ GetImagePixels(image, width, height, pmap) static unsigned long byteorderpixel = MSBFirst << 24; #endif -#ifdef __OS2__ -/* Visual Age cannot deal with old, non-ansi, code */ -static int GetImagePixels32( - XImage* image -, unsigned int width -, unsigned int height -, PixelsMap* pmap -) -#else static int GetImagePixels32(image, width, height, pmap) XImage *image; unsigned int width; unsigned int height; PixelsMap *pmap; -#endif { unsigned char *addr; unsigned char *data; @@ -832,22 +818,12 @@ GetImagePixels32(image, width, height, pmap) * scan pixels of a 16-bits Z image data structure */ -#ifdef __OS2__ -/* Visual Age cannot deal with old, non-ansi, code */ -static int GetImagePixels16( - XImage* image -, unsigned int width -, unsigned int height -, PixelsMap* pmap -) -#else static int GetImagePixels16(image, width, height, pmap) XImage *image; unsigned int width; unsigned int height; PixelsMap *pmap; -#endif { unsigned char *addr; unsigned char *data; @@ -888,23 +864,12 @@ GetImagePixels16(image, width, height, pmap) * scan pixels of a 8-bits Z image data structure */ -#ifdef __OS2__ -/* Visual Age cannot deal with old, non-ansi, code */ -static int -GetImagePixels8(image, width, height, pmap) - XImage* image -, unsigned int width -, unsigned int height -, PixelsMap* pmap -) -#else static int GetImagePixels8(image, width, height, pmap) XImage *image; unsigned int width; unsigned int height; PixelsMap *pmap; -#endif { unsigned int *iptr; unsigned char *data; @@ -932,17 +897,6 @@ GetImagePixels8(image, width, height, pmap) * scan pixels of a 1-bit depth Z image data structure */ -#ifdef __OS2__ -/* Visual Age cannot deal with old, non-ansi, code */ -static int -GetImagePixels1( - XImage* image -, unsigned int width -, unsigned int height -, PixelsMap* pmap -, int (*storeFunc) () -) -#else static int GetImagePixels1(image, width, height, pmap, storeFunc) XImage *image; @@ -950,7 +904,6 @@ GetImagePixels1(image, width, height, pmap, storeFunc) unsigned int height; PixelsMap *pmap; int (*storeFunc) (); -#endif { unsigned int *iptr; int x, y; @@ -1034,10 +987,20 @@ AGetImagePixels ( # endif/* AMIGA */ #else /* ndef FOR_MSW */ + #ifdef __OS2__ -/* Visual Age cannot deal with old, non-ansi, code */ -static int -MSWGetImagePixels( + +#ifdef __VISAGECPP30__ +static int MSWGetImagePixels( + Display* display +, XImage* image +, unsigned int width +, unsigned int height +, PixelsMap* pmap +, int (*storeFunc) (Pixel, PixelsMap*, unsigned int*) +) +#else +static int MSWGetImagePixels( Display* display , XImage* image , unsigned int width @@ -1045,6 +1008,8 @@ MSWGetImagePixels( , PixelsMap* pmap , int (*storeFunc) () ) +#endif + #else static int MSWGetImagePixels(display, image, width, height, pmap, storeFunc) @@ -1085,11 +1050,9 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc) #else pixel = GetPixel(*display, x, y); #endif -#ifndef __OS2__ -/* calling convention all messed up under OS/2 */ + if ((*storeFunc) (pixel, pmap, iptr)) return (XpmNoMemory); -#endif } } return (XpmSuccess);