diff options
-rw-r--r-- | doc/Makefile.am | 1 | ||||
-rw-r--r-- | doc/README.AMIGA | 10 | ||||
-rw-r--r-- | include/X11/xpm.h | 24 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/WrFFrI.c | 11 | ||||
-rw-r--r-- | src/XpmI.h | 4 | ||||
-rw-r--r-- | src/amigax.c | 385 | ||||
-rw-r--r-- | src/amigax.h | 151 | ||||
-rw-r--r-- | src/create.c | 90 | ||||
-rw-r--r-- | src/scan.c | 71 |
10 files changed, 17 insertions, 732 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am index 5119700..4e8e8f9 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,6 +1,5 @@ EXTRA_DIST = \ xpm.PS.gz \ FAQ.html \ - README.AMIGA \ README.html \ README.MSW diff --git a/doc/README.AMIGA b/doc/README.AMIGA deleted file mode 100644 index 7a40137..0000000 --- a/doc/README.AMIGA +++ /dev/null @@ -1,10 +0,0 @@ -The XPM library for Amiga works best with AmigaOS 3.x, but will work -(with limited color support) with earlier OS versions too. It can be -compiled with both SAS/C and GCC (makefiles are included). - -All functions except the Xpm*Pixmap* functions are supported. - -I have also written some Amiga-specific utility functions (not -included). Contact me if you would like to have them too. - --Lorens Younes (d93-hyo@nada.kth.se) diff --git a/include/X11/xpm.h b/include/X11/xpm.h index a490b52..32eb3b8 100644 --- a/include/X11/xpm.h +++ b/include/X11/xpm.h @@ -37,11 +37,6 @@ * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94 */ -/* - * The code related to AMIGA has been added by - * Lorens Younes (d93-hyo@nada.kth.se) 4/96 - */ - #ifndef XPM_h #define XPM_h @@ -70,13 +65,9 @@ # include "simx.h" /* defines some X stuff using MSW types */ #define NEED_STRCASECMP /* at least for MSVC++ */ #else /* FOR_MSW */ -# ifdef AMIGA -# include "amigax.h" -# else /* not AMIGA */ -# include <X11/Xfuncproto.h> -# include <X11/Xlib.h> -# include <X11/Xutil.h> -# endif /* not AMIGA */ +# include <X11/Xfuncproto.h> +# include <X11/Xlib.h> +# include <X11/Xutil.h> #endif /* FOR_MSW */ /* let's define Pixel if it is not done yet */ @@ -292,9 +283,8 @@ typedef struct { _XFUNCPROTOBEGIN /* FOR_MSW, all ..Pixmap.. are excluded, only the ..XImage.. are used */ -/* Same for Amiga! */ -#if !defined(FOR_MSW) && !defined(AMIGA) +#ifndef FOR_MSW FUNC(XpmCreatePixmapFromData, int, (Display *display, Drawable d, char **data, @@ -351,7 +341,7 @@ _XFUNCPROTOBEGIN XImage **image_return, XImage **shapemask_return, XpmAttributes *attributes)); -#if !defined(FOR_MSW) && !defined(AMIGA) +#ifndef FOR_MSW FUNC(XpmCreatePixmapFromBuffer, int, (Display *display, Drawable d, char *buffer, @@ -395,7 +385,7 @@ _XFUNCPROTOBEGIN FUNC(XpmWriteFileFromXpmImage, int, (const char *filename, XpmImage *image, XpmInfo *info)); -#if !defined(FOR_MSW) && !defined(AMIGA) +#ifndef FOR_MSW FUNC(XpmCreatePixmapFromXpmImage, int, (Display *display, Drawable d, XpmImage *image, @@ -414,7 +404,7 @@ _XFUNCPROTOBEGIN XImage *shapeimage, XpmImage *xpmimage, XpmAttributes *attributes)); -#if !defined(FOR_MSW) && !defined(AMIGA) +#ifndef FOR_MSW FUNC(XpmCreateXpmImageFromPixmap, int, (Display *display, Pixmap pixmap, Pixmap shapemask, diff --git a/src/Makefile.am b/src/Makefile.am index 297d310..acca24b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -40,4 +40,4 @@ libXpm_la_SOURCES = \ rgbtab.h \ scan.c -EXTRA_DIST = amigax.c amigax.h simx.c simx.h +EXTRA_DIST = simx.c simx.h diff --git a/src/WrFFrI.c b/src/WrFFrI.c index 4c3ecac..f48a93b 100644 --- a/src/WrFFrI.c +++ b/src/WrFFrI.c @@ -32,11 +32,6 @@ * Developed by Arnaud Le Hors * \*****************************************************************************/ -/* - * The code related to AMIGA has been added by - * Lorens Younes (d93-hyo@nada.kth.se) 4/96 - */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -124,11 +119,7 @@ XpmWriteFileFromXpmImage( #ifdef VMS name = filename; #else - if (!(name = strrchr(filename, '/')) -#ifdef AMIGA - && !(name = strrchr(filename, ':')) -#endif - ) + if (!(name = strrchr(filename, '/'))) name = filename; else name++; @@ -188,7 +188,7 @@ HFUNC(xpmSetInfo, void, (XpmInfo *info, XpmAttributes *attributes)); HFUNC(xpmSetAttributes, void, (XpmAttributes *attributes, XpmImage *image, XpmInfo *info)); -#if !defined(FOR_MSW) && !defined(AMIGA) +#ifndef FOR_MSW HFUNC(xpmCreatePixmapFromImage, int, (Display *display, Drawable d, XImage *ximage, Pixmap *pixmap_return)); @@ -263,7 +263,6 @@ HFUNC(xpmFreeRgbNames, void, (xpmRgbName *rgbn, int rgbn_max)); HFUNC(xpmGetRGBfromName,int, (char *name, int *r, int *g, int *b)); #endif -#ifndef AMIGA HFUNC(xpm_xynormalizeimagebits, void, (register unsigned char *bp, register XImage *img)); HFUNC(xpm_znormalizeimagebits, void, (register unsigned char *bp, @@ -311,7 +310,6 @@ HFUNC(xpm_znormalizeimagebits, void, (register unsigned char *bp, #define ZINDEX8(x, y, img) ((y) * img->bytes_per_line) + (x) #define ZINDEX1(x, y, img) ((y) * img->bytes_per_line) + ((x) >> 3) -#endif /* not AMIGA */ #ifdef NEED_STRDUP HFUNC(xpmstrdup, char *, (char *s1)); diff --git a/src/amigax.c b/src/amigax.c deleted file mode 100644 index f163960..0000000 --- a/src/amigax.c +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Copyright (C) 19896 Lorens Younes - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * Lorens Younes BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Lorens Younes shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Lorens Younes. - */ - -/*****************************************************************************\ -* amigax.c: * -* * -* XPM library * -* Emulates some Xlib functionality for Amiga. * -* * -* Developed by Lorens Younes (d93-hyo@nada.kth.se) 7/95 * -* Revised 4/96 * -\*****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include "XpmI.h" -#include "amigax.h" - -#include <graphics/gfxbase.h> -#include <intuition/screens.h> - -#include <proto/exec.h> - - -static struct RastPort * -AllocRastPort (unsigned int, unsigned int, unsigned int); -static void -FreeRastPort (struct RastPort *, unsigned int,unsigned int); - - -static struct RastPort * -AllocRastPort ( - unsigned int width, - unsigned int height, - unsigned int depth) -{ - struct RastPort *rp; - - rp = XpmMalloc (sizeof (*rp)); - if (rp != NULL) - { - InitRastPort (rp); - if (GfxBase->LibNode.lib_Version >= 39) - { - rp->BitMap = AllocBitMap (width, height, depth, BMF_CLEAR, NULL); - if (rp->BitMap == NULL) - { - FreeRastPort (rp, width, height); - return NULL; - } - } - else - { - unsigned int i; - - rp->BitMap = XpmMalloc (sizeof (*rp->BitMap)); - if (rp->BitMap == NULL) - { - FreeRastPort (rp, width, height); - return NULL; - } - - InitBitMap (rp->BitMap, depth, width, height); - for (i = 0; i < depth; ++i) - rp->BitMap->Planes[i] = NULL; - for (i = 0; i < depth; ++i) - { - rp->BitMap->Planes[i] = (PLANEPTR)AllocRaster (width, height); - if (rp->BitMap->Planes[i] == NULL) - { - FreeRastPort (rp, width, height); - return NULL; - } - } - } - } - - return rp; -} - - -static void -FreeRastPort ( - struct RastPort *rp, - unsigned int width, - unsigned int height) -{ - if (rp != NULL) - { - if (rp->BitMap != NULL) - { - WaitBlit (); - if (GfxBase->LibNode.lib_Version >= 39) - FreeBitMap (rp->BitMap); - else - { - unsigned int i; - - for (i = 0; i < rp->BitMap->Depth; ++i) - { - if (rp->BitMap->Planes[i] != NULL) - FreeRaster (rp->BitMap->Planes[i], width, height); - } - XpmFree (rp->BitMap); - } - } - XpmFree (rp); - } -} - - -XImage * -AllocXImage ( - unsigned int width, - unsigned int height, - unsigned int depth) -{ - XImage *img; - - img = XpmMalloc (sizeof (*img)); - if (img != NULL) - { - img->width = width; - img->height = height; - img->rp = AllocRastPort (img->width, img->height, depth); - if (img->rp == NULL) - { - FreeXImage (img); - return NULL; - } - } - - return img; -} - - -int -FreeXImage ( - XImage *ximage) -{ - if (ximage != NULL) - { - FreeRastPort (ximage->rp, ximage->width, ximage->height); - XpmFree (ximage); - } - - return Success; -} - - -int -XPutPixel ( - XImage *ximage, - int x, - int y, - unsigned long pixel) -{ - SetAPen (ximage->rp, pixel); - WritePixel (ximage->rp, x, y); - - return Success; -} - - -Status -AllocBestPen ( - Colormap colormap, - XColor *screen_in_out, - unsigned long precision, - Bool fail_if_bad) -{ - if (GfxBase->LibNode.lib_Version >= 39) - { - unsigned long r, g, b; - - r = screen_in_out->red * 0x00010001; - g = screen_in_out->green * 0x00010001; - b = screen_in_out->blue * 0x00010001; - screen_in_out->pixel = ObtainBestPen (colormap, r, g, b, - OBP_Precision, precision, - OBP_FailIfBad, fail_if_bad, - TAG_DONE); - if (screen_in_out->pixel == -1) - return False; - - QueryColor (colormap, screen_in_out); - } - else - { - XColor nearest, trial; - long nearest_delta, trial_delta; - int num_cells, i; - - num_cells = colormap->Count; - nearest.pixel = 0; - QueryColor (colormap, &nearest); - nearest_delta = ((((screen_in_out->red >> 8) - (nearest.red >> 8)) - * ((screen_in_out->red >> 8) - (nearest.red >> 8))) - + - (((screen_in_out->green >> 8) - (nearest.green >> 8)) - * ((screen_in_out->green >> 8) - (nearest.green >> 8))) - + - (((screen_in_out->blue >> 8) - (nearest.blue >> 8)) - * ((screen_in_out->blue >> 8) - (nearest.blue >> 8)))); - for (i = 1; i < num_cells; i++) - { - /* precision and fail_if_bad is ignored under pre V39 */ - trial.pixel = i; - QueryColor (colormap, &trial); - trial_delta = ((((screen_in_out->red >> 8) - (trial.red >> 8)) - * ((screen_in_out->red >> 8) - (trial.red >> 8))) - + - (((screen_in_out->green >> 8) - (trial.green >> 8)) - * ((screen_in_out->green >> 8) - (trial.green >> 8))) - + - (((screen_in_out->blue >> 8) - (trial.blue >> 8)) - * ((screen_in_out->blue >> 8) - (trial.blue >> 8)))); - if (trial_delta < nearest_delta) - { - nearest = trial; - nearest_delta = trial_delta; - } - } - screen_in_out->pixel = nearest.pixel; - screen_in_out->red = nearest.red; - screen_in_out->green = nearest.green; - screen_in_out->blue = nearest.blue; - } - - return True; -} - - -int -FreePens ( - Colormap colormap, - unsigned long *pixels, - int npixels) -{ - if (GfxBase->LibNode.lib_Version >= 39) - { - int i; - - for (i = 0; i < npixels; i++) - ReleasePen (colormap, pixels[i]); - } - - return Success; -} - - -Status -ParseColor ( - char *spec, - XColor *exact_def_return) -{ - int spec_length; - - if (spec == 0) - return False; - - spec_length = strlen(spec); - if (spec[0] == '#') - { - int hexlen; - char hexstr[10]; - - hexlen = (spec_length - 1) / 3; - if (hexlen < 1 || hexlen > 4 || hexlen * 3 != spec_length - 1) - return False; - - hexstr[hexlen] = '\0'; - strncpy (hexstr, spec + 1, hexlen); - exact_def_return->red = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen); - strncpy (hexstr, spec + 1 + hexlen, hexlen); - exact_def_return->green = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen); - strncpy (hexstr, spec + 1 + 2 * hexlen, hexlen); - exact_def_return->blue = strtoul (hexstr, NULL, 16) << (16 - 4*hexlen); - - return True; - } - else - { - FILE *rgbf; - int items, red, green, blue; - char line[512], name[512]; - Bool success = False; - - rgbf = fopen ("LIBS:rgb.txt", "r"); - if (rgbf == NULL) - return False; - - while (fgets(line, sizeof (line), rgbf) && !success) - { - items = sscanf (line, "%d %d %d %[^\n]\n", - &red, &green, &blue, name); - if (items != 4) - continue; - - if (red < 0 || red > 0xFF - || green < 0 || green > 0xFF - || blue < 0 || blue > 0xFF) - { - continue; - } - - if (0 == xpmstrcasecmp (spec, name)) - { - exact_def_return->red = red * 0x0101; - exact_def_return->green = green * 0x0101; - exact_def_return->blue = blue * 0x0101; - success = True; - } - } - fclose (rgbf); - - return success; - } -} - - -int -QueryColor ( - Colormap colormap, - XColor *def_in_out) -{ - if (GfxBase->LibNode.lib_Version >= 39) - { - unsigned long rgb[3]; - - GetRGB32 (colormap, def_in_out->pixel, 1, rgb); - def_in_out->red = rgb[0] >> 16; - def_in_out->green = rgb[1] >> 16; - def_in_out->blue = rgb[2] >> 16; - } - else - { - unsigned short rgb; - - rgb = GetRGB4 (colormap, def_in_out->pixel); - def_in_out->red = ((rgb >> 8) & 0xF) * 0x1111; - def_in_out->green = ((rgb >> 4) & 0xF) * 0x1111; - def_in_out->blue = (rgb & 0xF) * 0x1111; - } - - return Success; -} - - -int -QueryColors ( - Colormap colormap, - XColor *defs_in_out, - int ncolors) -{ - int i; - - for (i = 0; i < ncolors; i++) - QueryColor (colormap, &defs_in_out[i]); - - return Success; -} diff --git a/src/amigax.h b/src/amigax.h deleted file mode 100644 index 213ed76..0000000 --- a/src/amigax.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (C) 1996 Lorens Younes - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * Lorens Younes BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Lorens Younes shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Lorens Younes. - */ - -/*****************************************************************************\ -* amigax.h: * -* * -* XPM library * -* Emulates some Xlib functionality for Amiga. * -* * -* Developed by Lorens Younes (d93-hyo@nada.kth.se) 7/95 * -* Revised 4/96 * -\*****************************************************************************/ - -#ifndef AMIGA_X -#define AMIGA_X - - -#include <intuition/screens.h> - -#include <proto/exec.h> -#include <proto/graphics.h> - - -#define Success 0 - -/* really never used */ -#define ZPixmap 2 - -#define Bool int -#define Status int -#define True 1 -#define False 0 - -typedef struct ColorMap *Colormap; - -typedef void *Visual; - -typedef struct { - int width, height; - struct RastPort *rp; -} XImage; - -typedef struct { - unsigned long pixel; - unsigned short red, green, blue; -} XColor; - -typedef struct Screen Display; - - -#define XGrabServer(dpy) (Forbid ()) -#define XUngrabServer(dpy) (Permit ()) - -#define XDefaultScreen(dpy) (0) -#define XDefaultVisual(dpy, scr) (NULL) -#define XDefaultColormap(dpy, scr) (dpy->ViewPort.ColorMap) -#define XDefaultDepth(dpy, scr) (dpy->RastPort.BitMap->Depth) - -#define XCreateImage(dpy, vi, depth, format, offset, data, width, height, pad, bpl) \ - (AllocXImage (width, height, depth)) -#define XDestroyImage(img) (FreeXImage (img)) - -#define XAllocColor(dpy, cm, xc) \ - (AllocBestPen (cm, xc, PRECISION_EXACT, True)) -#define XFreeColors(dpy, cm, pixels, npixels, planes) \ - (FreePens (cm, pixels, npixels)) -#define XParseColor(dpy, cm, spec, exact_def_return) \ - (ParseColor (spec, exact_def_return)) -#define XQueryColor(dpy, cm, def_in_out) \ - (QueryColor(cm, def_in_out)) -#define XQueryColors(dpy, cm, defs_in_out, ncolors) \ - (QueryColors(cm, defs_in_out, ncolors)) - - -XImage * -AllocXImage ( - unsigned int width, - unsigned int height, - unsigned int depth); - - -int -FreeXImage ( - XImage *ximage); - - -int -XPutPixel ( - XImage *ximage, - int x, - int y, - unsigned long pixel); - - -Status -AllocBestPen ( - Colormap colormap, - XColor *screen_in_out, - unsigned long precision, - Bool fail_if_bad); - - -int -FreePens ( - Colormap colormap, - unsigned long *pixels, - int npixels); - - -Status -ParseColor ( - char *spec, - XColor *exact_def_return); - - -int -QueryColor ( - Colormap colormap, - XColor *def_in_out); - - -int -QueryColors ( - Colormap colormap, - XColor *defs_in_out, - int ncolors); - - -#endif /* AMIGA_X */ diff --git a/src/create.c b/src/create.c index b8c80d2..5dd0d29 100644 --- a/src/create.c +++ b/src/create.c @@ -38,11 +38,6 @@ * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94 */ -/* - * The code related to AMIGA has been added by - * Lorens Younes (d93-hyo@nada.kth.se) 4/96 - */ - /* October 2004, source code review by Thomas Biege <thomas@suse.de> */ #ifdef HAVE_CONFIG_H @@ -106,7 +101,6 @@ LFUNC(ParseAndPutPixels, int, (Display *dc, xpmData *data, unsigned int width, #endif #ifndef FOR_MSW -# ifndef AMIGA /* XImage pixel routines */ LFUNC(PutImagePixels, void, (XImage *image, unsigned int width, unsigned int height, unsigned int *pixelindex, @@ -141,11 +135,6 @@ LFUNC(PutPixel8, int, (XImage *ximage, int x, int y, unsigned long pixel)); LFUNC(PutPixel1MSB, int, (XImage *ximage, int x, int y, unsigned long pixel)); LFUNC(PutPixel1LSB, int, (XImage *ximage, int x, int y, unsigned long pixel)); -# else /* AMIGA */ -LFUNC(APutImagePixels, void, (XImage *ximage, unsigned int width, - unsigned int height, unsigned int *pixelindex, - Pixel *pixels)); -# endif/* AMIGA */ #else /* FOR_MSW */ /* FOR_MSW pixel routine */ LFUNC(MSWPutImagePixels, void, (Display *dc, XImage *image, @@ -187,7 +176,6 @@ static int xpmVisualType(Visual *visual) { #ifndef FOR_MSW -# ifndef AMIGA switch (visual->class) { case StaticGray: case GrayScale: @@ -202,10 +190,6 @@ xpmVisualType(Visual *visual) default: return (XPM_COLOR); } -# else - /* set the key explicitly in the XpmAttributes to override this */ - return (XPM_COLOR); -# endif #else /* there should be a similar switch for MSW */ return (XPM_COLOR); @@ -586,11 +570,7 @@ CreateColors( #endif unsigned int i; -#ifndef AMIGA ncols = visual->map_entries; -#else - ncols = colormap->Count; -#endif cols = (XColor *) XpmCalloc(ncols, sizeof(XColor)); for (i = 0; i < ncols; ++i) cols[i].pixel = i; @@ -860,8 +840,6 @@ XpmCreateImageFromXpmImage( RETURN(ErrorStatus); #ifndef FOR_MSW -# ifndef AMIGA - /* * set the ximage data using optimized functions for ZPixmap */ @@ -882,10 +860,6 @@ XpmCreateImageFromXpmImage( else PutImagePixels(ximage, image->width, image->height, image->data, image_pixels); -# else /* AMIGA */ - APutImagePixels(ximage, image->width, image->height, - image->data, image_pixels); -# endif #else /* FOR_MSW */ MSWPutImagePixels(display, ximage, image->width, image->height, image->data, image_pixels); @@ -899,13 +873,8 @@ XpmCreateImageFromXpmImage( RETURN(ErrorStatus); #ifndef FOR_MSW -# ifndef AMIGA PutImagePixels1(shapeimage, image->width, image->height, image->data, mask_pixels); -# else /* AMIGA */ - APutImagePixels(shapeimage, image->width, image->height, - image->data, mask_pixels); -# endif #else /* FOR_MSW */ MSWPutImagePixels(display, shapeimage, image->width, image->height, image->data, mask_pixels); @@ -991,7 +960,7 @@ CreateXImage( if (!*image_return) return (XpmNoMemory); -#if !defined(FOR_MSW) && !defined(AMIGA) +#ifndef FOR_MSW if (height != 0 && (*image_return)->bytes_per_line >= INT_MAX / height) { XDestroyImage(*image_return); *image_return = NULL; @@ -1017,13 +986,12 @@ CreateXImage( return (XpmNoMemory); } #else - /* under FOR_MSW and AMIGA XCreateImage has done it all */ + /* under FOR_MSW XCreateImage has done it all */ #endif return (XpmSuccess); } #ifndef FOR_MSW -# ifndef AMIGA /* * The functions below are written from X11R5 MIT's code (XImUtil.c) * @@ -1705,50 +1673,6 @@ XpmCreatePixmapFromXpmImage( return (ErrorStatus); } -# else /* AMIGA */ - -static void -APutImagePixels ( - XImage *image, - unsigned int width, - unsigned int height, - unsigned int *pixelindex, - Pixel *pixels) -{ - unsigned int *data = pixelindex; - unsigned int x, y; - unsigned char *array; - XImage *tmp_img; - BOOL success = FALSE; - - array = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*array)); - if (array != NULL) - { - tmp_img = AllocXImage ((((width+15)>>4)<<4), 1, - image->rp->BitMap->Depth); - if (tmp_img != NULL) - { - for (y = 0; y < height; ++y) - { - for (x = 0; x < width; ++x) - array[x] = pixels[*(data++)]; - WritePixelLine8 (image->rp, 0, y, width, array, tmp_img->rp); - } - FreeXImage (tmp_img); - success = TRUE; - } - XpmFree (array); - } - - if (!success) - { - for (y = 0; y < height; ++y) - for (x = 0; x < width; ++x) - XPutPixel (image, x, y, pixels[*(data++)]); - } -} - -# endif/* AMIGA */ #else /* FOR_MSW part follows */ static void MSWPutImagePixels( @@ -1776,7 +1700,7 @@ MSWPutImagePixels( -#if !defined(FOR_MSW) && !defined(AMIGA) +#ifndef FOR_MSW static int PutPixel1( @@ -1994,7 +1918,7 @@ PutPixel1LSB( return 1; } -#endif /* not FOR_MSW && not AMIGA */ +#endif /* not FOR_MSW */ /* * This function parses an Xpm file or data and directly create an XImage @@ -2161,7 +2085,7 @@ xpmParseDataAndCreate( if (ErrorStatus != XpmSuccess) RETURN(ErrorStatus); -#if !defined(FOR_MSW) && !defined(AMIGA) +#ifndef FOR_MSW /* * set the XImage pointer function, to be used with XPutPixel, @@ -2195,7 +2119,7 @@ xpmParseDataAndCreate( ximage->f.put_pixel = PutPixel1; else ximage->f.put_pixel = PutPixel; -#endif /* not FOR_MSW && not AMIGA */ +#endif /* not FOR_MSW */ } /* create the shape mask image */ @@ -2205,7 +2129,7 @@ xpmParseDataAndCreate( if (ErrorStatus != XpmSuccess) RETURN(ErrorStatus); -#if !defined(FOR_MSW) && !defined(AMIGA) +#ifndef FOR_MSW if (shapeimage->bitmap_bit_order == MSBFirst) shapeimage->f.put_pixel = PutPixel1MSB; else @@ -37,11 +37,6 @@ * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94 */ -/* - * The code related to AMIGA has been added by - * Lorens Younes (d93-hyo@nada.kth.se) 4/96 - */ - /* October 2004, source code review by Thomas Biege <thomas@suse.de> */ #ifdef HAVE_CONFIG_H @@ -82,7 +77,6 @@ typedef int (*storeFuncPtr)(Pixel pixel, PixelsMap *pmap, unsigned int *index_return); #ifndef FOR_MSW -# ifndef AMIGA LFUNC(GetImagePixels, int, (XImage *image, unsigned int width, unsigned int height, PixelsMap *pmap)); @@ -98,11 +92,6 @@ LFUNC(GetImagePixels8, int, (XImage *image, unsigned int width, LFUNC(GetImagePixels1, int, (XImage *image, unsigned int width, unsigned int height, PixelsMap *pmap, storeFuncPtr storeFunc)); -# else /* AMIGA */ -LFUNC(AGetImagePixels, int, (XImage *image, unsigned int width, - unsigned int height, PixelsMap *pmap, - storeFuncPtr storeFunc)); -# endif/* AMIGA */ #else /* ndef FOR_MSW */ LFUNC(MSWGetImagePixels, int, (Display *d, XImage *image, unsigned int width, unsigned int height, PixelsMap *pmap, @@ -256,13 +245,8 @@ XpmCreateXpmImageFromImage( */ if (shapeimage) { #ifndef FOR_MSW -# ifndef AMIGA ErrorStatus = GetImagePixels1(shapeimage, width, height, &pmap, storeMaskPixel); -# else - ErrorStatus = AGetImagePixels(shapeimage, width, height, &pmap, - storeMaskPixel); -# endif #else ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height, &pmap, storeMaskPixel); @@ -281,7 +265,6 @@ XpmCreateXpmImageFromImage( 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, @@ -295,10 +278,6 @@ XpmCreateXpmImageFromImage( ErrorStatus = GetImagePixels32(image, width, height, &pmap); } else ErrorStatus = GetImagePixels(image, width, height, &pmap); -# else - ErrorStatus = AGetImagePixels(image, width, height, &pmap, - storePixel); -# endif #else ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap, storePixel); @@ -579,7 +558,6 @@ ScanOtherColors( } #ifndef FOR_MSW -# ifndef AMIGA /* * The functions below are written from X11R5 MIT's code (XImUtil.c) * @@ -903,53 +881,6 @@ GetImagePixels1( return (XpmSuccess); } -# else /* AMIGA */ - -#define CLEAN_UP(status) \ -do {\ - if (pixels) XpmFree (pixels);\ - if (tmp_img) FreeXImage (tmp_img);\ - return (status);\ -} while(0) - -static int -AGetImagePixels ( - XImage *image, - unsigned int width, - unsigned int height, - PixelsMap *pmap, - int (*storeFunc) (Pixel, PixelsMap *, unsigned int *)) -{ - unsigned int *iptr; - unsigned int x, y; - unsigned char *pixels; - XImage *tmp_img; - - pixels = XpmMalloc ((((width+15)>>4)<<4)*sizeof (*pixels)); - if (pixels == NULL) - return XpmNoMemory; - - tmp_img = AllocXImage ((((width+15)>>4)<<4), 1, image->rp->BitMap->Depth); - if (tmp_img == NULL) - CLEAN_UP (XpmNoMemory); - - iptr = pmap->pixelindex; - for (y = 0; y < height; ++y) - { - ReadPixelLine8 (image->rp, 0, y, width, pixels, tmp_img->rp); - for (x = 0; x < width; ++x, ++iptr) - { - if ((*storeFunc) (pixels[x], pmap, iptr)) - CLEAN_UP (XpmNoMemory); - } - } - - CLEAN_UP (XpmSuccess); -} - -#undef CLEAN_UP - -# endif/* AMIGA */ #else /* ndef FOR_MSW */ static int MSWGetImagePixels( @@ -980,7 +911,6 @@ MSWGetImagePixels( #endif #ifndef FOR_MSW -# ifndef AMIGA int XpmCreateXpmImageFromPixmap( Display *display, @@ -1020,5 +950,4 @@ XpmCreateXpmImageFromPixmap( return (ErrorStatus); } -# endif/* not AMIGA */ #endif /* ndef FOR_MSW */ |