]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/xpm/simx.c
Removed TABs that had gotten in to the source
[wxWidgets.git] / src / mac / xpm / simx.c
index eac5bd39bd5538c9274b2da96ab5af1922db5b3c..7b6638fb2eb243a13c96e4599beb5cb206f0ecfd 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "xpm.h"
 #include "xpmi.h"                      /* for XpmMalloc */
-
+#include "rgbtab.h"
 #ifdef FOR_MSW
 
 /*
@@ -173,7 +173,7 @@ rgbFromHex(char *hex, int *r, int *g, int *b)
                *r = hexCharToInt(hex[1]);
                *g = hexCharToInt(hex[2]);
                *b = hexCharToInt(hex[3]);
-               #ifdef macintosh
+               #if defined(macintosh) || defined(__APPLE__)
                *r <<= 12 ;
                *g <<= 12 ;
                *b <<= 12 ;
@@ -183,7 +183,7 @@ rgbFromHex(char *hex, int *r, int *g, int *b)
                *r = hexCharToInt(hex[1]) * 16 + hexCharToInt(hex[2]);
                *g = hexCharToInt(hex[3]) * 16 + hexCharToInt(hex[4]);
                *b = hexCharToInt(hex[5]) * 16 + hexCharToInt(hex[6]);
-               #ifdef macintosh
+               #if defined(macintosh) || defined(__APPLE__)
                *r <<= 8 ;
                *g <<= 8 ;
                *b <<= 8 ;
@@ -191,7 +191,7 @@ rgbFromHex(char *hex, int *r, int *g, int *b)
     } else if (len == 12 + 1) 
     {
                /* it's like c #32329999CCCC */
-               #ifdef macintosh
+               #if defined(macintosh) || defined(__APPLE__)
                *r = hexCharToInt(hex[1]) * 0x1000 + hexCharToInt(hex[2]) *0x0100 + hexCharToInt(hex[3]) *0x0010 + hexCharToInt(hex[4]) ;
                *g = hexCharToInt(hex[5]) * 0x1000 + hexCharToInt(hex[6]) *0x0100 + hexCharToInt(hex[7]) *0x0010 + hexCharToInt(hex[8]);
                *b =hexCharToInt(hex[9]) * 0x1000 + hexCharToInt(hex[10]) *0x0100 + hexCharToInt(hex[11]) *0x0010 + hexCharToInt(hex[12]);
@@ -232,7 +232,7 @@ XParseColor(Display *d, Colormap *cmap, char *name, XColor *color)
                        color->red = (BYTE) r;
                        color->green = (BYTE) g;
                        color->blue = (BYTE) b;
-       #elif macintosh
+       #elif defined(macintosh) || defined(__APPLE__)
                color->pixel.red = r ;
                color->pixel.green = g ;
                color->pixel.blue = b ;
@@ -273,7 +273,7 @@ XQueryColors(Display *display, Colormap *colormap,
 }
 int 
 XFreeColors(Display *d, Colormap cmap,
-           unsigned long pixels[], int npixels, unsigned long planes)
+           Pixel *pixels, int npixels, unsigned long planes)
 {
     /* no colormap yet */
     return (0);                                /* correct ??? */
@@ -302,7 +302,7 @@ XCreateImage(Display *d, Visual *v,
            img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
                                       depth /* bits per pixel */ , NULL);
                }
-       #elif macintosh
+       #elif defined(macintosh) || defined(__APPLE__)
                Rect rect ;
                
                rect.left= rect.top = 0 ;
@@ -310,6 +310,7 @@ XCreateImage(Display *d, Visual *v,
                rect.bottom = height ;
                
                NewGWorld( &img->gworldptr , depth , &rect , NULL , NULL , 0 ) ;
+               LockPixels( GetGWorldPixMap( img->gworldptr ) ) ;
                if (img->gworldptr == NULL)
                {
                XDestroyImage (img);
@@ -345,9 +346,12 @@ XDestroyImage(XImage *img)
     if (img) {
     #if FOR_MSW
        DeleteObject(img->bitmap);      /* check return ??? */
-       #elif macintosh
+       #elif defined(macintosh) || defined(__APPLE__)
        if ( img->gworldptr )
+       {
+               UnlockPixels( GetGWorldPixMap( img->gworldptr ) ) ;
                DisposeGWorld( img->gworldptr ) ;
+       }
        #endif
        XImageFree(img);
     }