more xpm fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6040 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2000-02-15 15:31:34 +00:00
parent c1d139da69
commit 4b41f6bc00
2 changed files with 45 additions and 83 deletions

View File

@@ -261,7 +261,8 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
/* /*
* scan shape mask if any * scan shape mask if any
*/ */
if (shapeimage) { if (shapeimage)
{
#ifndef FOR_MSW #ifndef FOR_MSW
# ifndef AMIGA # ifndef AMIGA
ErrorStatus = GetImagePixels1(shapeimage, width, height, &pmap, ErrorStatus = GetImagePixels1(shapeimage, width, height, &pmap,
@@ -269,7 +270,7 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
# else # else
ErrorStatus = AGetImagePixels(shapeimage, width, height, &pmap, ErrorStatus = AGetImagePixels(shapeimage, width, height, &pmap,
storeMaskPixel); storeMaskPixel);
# endif # endif /* AMIGA */
#else #else
#ifndef __OS2__ #ifndef __OS2__
@@ -278,7 +279,8 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
/* calling convention all messed up OS/2 -- figure out later */ /* calling convention all messed up OS/2 -- figure out later */
#endif #endif
#endif #endif /* ndef for FOR_MSW */
if (ErrorStatus != XpmSuccess) if (ErrorStatus != XpmSuccess)
RETURN(ErrorStatus); RETURN(ErrorStatus);
} }
@@ -291,34 +293,40 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
* *
*/ */
if (image) { if (image)
{
#ifndef FOR_MSW #ifndef FOR_MSW
# ifndef AMIGA # ifndef AMIGA
if (((image->bits_per_pixel | image->depth) == 1) && if (((image->bits_per_pixel | image->depth) == 1) &&
(image->byte_order == image->bitmap_bit_order)) (image->byte_order == image->bitmap_bit_order))
ErrorStatus = GetImagePixels1(image, width, height, &pmap, ErrorStatus = GetImagePixels1(image, width, height, &pmap,
storePixel); storePixel);
else if (image->format == ZPixmap) { else if (image->format == ZPixmap)
{
if (image->bits_per_pixel == 8) if (image->bits_per_pixel == 8)
ErrorStatus = GetImagePixels8(image, width, height, &pmap); ErrorStatus = GetImagePixels8(image, width, height, &pmap);
else if (image->bits_per_pixel == 16) else if (image->bits_per_pixel == 16)
ErrorStatus = GetImagePixels16(image, width, height, &pmap); ErrorStatus = GetImagePixels16(image, width, height, &pmap);
else if (image->bits_per_pixel == 32) else if (image->bits_per_pixel == 32)
ErrorStatus = GetImagePixels32(image, width, height, &pmap); ErrorStatus = GetImagePixels32(image, width, height, &pmap);
} else }
else
ErrorStatus = GetImagePixels(image, width, height, &pmap); ErrorStatus = GetImagePixels(image, width, height, &pmap);
# else # else
ErrorStatus = AGetImagePixels(image, width, height, &pmap, ErrorStatus = AGetImagePixels(image, width, height, &pmap,
storePixel); storePixel);
# endif # endif /* AMIGA */
#else #else
#ifndef __OS2__ #ifndef __OS2__
ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap, ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
storePixel); storePixel);
/* calling convention all messed up OS/2 -- figure out later */
#endif #endif
#endif #endif
if (ErrorStatus != XpmSuccess) if (ErrorStatus != XpmSuccess)
RETURN(ErrorStatus); RETURN(ErrorStatus);
} }
@@ -644,22 +652,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 static int
GetImagePixels(image, width, height, pmap) GetImagePixels(image, width, height, pmap)
XImage *image; XImage *image;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
#endif
{ {
char *src; char *src;
char *dst; char *dst;
@@ -757,22 +755,12 @@ GetImagePixels(image, width, height, pmap)
static unsigned long byteorderpixel = MSBFirst << 24; static unsigned long byteorderpixel = MSBFirst << 24;
#endif #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 static int
GetImagePixels32(image, width, height, pmap) GetImagePixels32(image, width, height, pmap)
XImage *image; XImage *image;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
#endif
{ {
unsigned char *addr; unsigned char *addr;
unsigned char *data; unsigned char *data;
@@ -832,22 +820,12 @@ GetImagePixels32(image, width, height, pmap)
* scan pixels of a 16-bits Z image data structure * 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 static int
GetImagePixels16(image, width, height, pmap) GetImagePixels16(image, width, height, pmap)
XImage *image; XImage *image;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
#endif
{ {
unsigned char *addr; unsigned char *addr;
unsigned char *data; unsigned char *data;
@@ -888,23 +866,12 @@ GetImagePixels16(image, width, height, pmap)
* scan pixels of a 8-bits Z image data structure * 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 static int
GetImagePixels8(image, width, height, pmap) GetImagePixels8(image, width, height, pmap)
XImage *image; XImage *image;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
#endif
{ {
unsigned int *iptr; unsigned int *iptr;
unsigned char *data; unsigned char *data;
@@ -932,17 +899,6 @@ GetImagePixels8(image, width, height, pmap)
* scan pixels of a 1-bit depth Z image data structure * 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 static int
GetImagePixels1(image, width, height, pmap, storeFunc) GetImagePixels1(image, width, height, pmap, storeFunc)
XImage *image; XImage *image;
@@ -950,7 +906,6 @@ GetImagePixels1(image, width, height, pmap, storeFunc)
unsigned int height; unsigned int height;
PixelsMap *pmap; PixelsMap *pmap;
int (*storeFunc) (); int (*storeFunc) ();
#endif
{ {
unsigned int *iptr; unsigned int *iptr;
int x, y; int x, y;
@@ -1034,6 +989,7 @@ AGetImagePixels (
# endif/* AMIGA */ # endif/* AMIGA */
#else /* ndef FOR_MSW */ #else /* ndef FOR_MSW */
#ifdef __OS2__ #ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */ /* Visual Age cannot deal with old, non-ansi, code */
static int static int
@@ -1085,6 +1041,7 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
#else #else
pixel = GetPixel(*display, x, y); pixel = GetPixel(*display, x, y);
#endif #endif
#ifndef __OS2__ #ifndef __OS2__
/* calling convention all messed up under OS/2 */ /* calling convention all messed up under OS/2 */
if ((*storeFunc) (pixel, pmap, iptr)) if ((*storeFunc) (pixel, pmap, iptr))

View File

@@ -101,6 +101,11 @@ typedef unsigned long Pixel; /* Index into colormap */
# endif # endif
#endif #endif
/* DW: bug in makefile seems to not want to define these, but they are needed! */
/* Guillermo, maybe you can look at it */
# define FUNC(f, t, p) extern t f p
# define LFUNC(f, t, p) static t f p
/* Return ErrorStatus codes: /* Return ErrorStatus codes:
* null if full success * null if full success