X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0240e8b1aa935d43689b0b8ec36de3c06c1a4758..9082f1a970e72765544a23b6f0b3481011ddca15:/src/mac/xpm/simx.c diff --git a/src/mac/xpm/simx.c b/src/mac/xpm/simx.c index eac5bd39bd..7b6638fb2e 100644 --- a/src/mac/xpm/simx.c +++ b/src/mac/xpm/simx.c @@ -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); }