X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cfbe03c9c3ffecd6363dcc63e6fc27b8c6ed70aa..b704229ee25ef8e5765ec09e9c164f59063564e8:/src/xpm/simx.c diff --git a/src/xpm/simx.c b/src/xpm/simx.c index 78bf77b0fc..6b8ef57b91 100644 --- a/src/xpm/simx.c +++ b/src/xpm/simx.c @@ -119,14 +119,21 @@ XDefaultScreen(Display *d) } /* I get only 1 plane but 8 bits per pixel, - so I think BITSPIXEL should be depth */ -int + so I think BITSPIXEL should be depth + + TRS: I assume that all "displays" have the same number of + planes later in the code, which is based on the assumption + that the display variable is ignored below. :) + */ +int XDefaultDepth(Display *display, Screen *screen) { int d, b; +#if !defined(__VISAGECPP__) /* fisme for OS/2 */ b = GetDeviceCaps(*display, BITSPIXEL); d = GetDeviceCaps(*display, PLANES); +#endif return (b); } @@ -138,7 +145,7 @@ XDefaultColormap(Display *display, Screen *screen) /* convert hex color names, wrong digits (not a-f,A-F,0-9) are treated as zero */ -static int +static int hexCharToInt(char c) { int r; @@ -155,7 +162,7 @@ hexCharToInt(char c) return (r); } -static int +static int rgbFromHex(char *hex, int *r, int *g, int *b) { int len; @@ -185,7 +192,7 @@ rgbFromHex(char *hex, int *r, int *g, int *b) } /* Color related functions */ -int +int XParseColor(Display *d, Colormap *cmap, char *name, XColor *color) { int r, g, b; /* only 8 bit values used */ @@ -203,7 +210,9 @@ XParseColor(Display *d, Colormap *cmap, char *name, XColor *color) } if (okay) { +#if !defined(__VISAGECPP__) /* fixme for OS/2 */ color->pixel = RGB(r, g, b); +#endif color->red = (BYTE) r; color->green = (BYTE) g; color->blue = (BYTE) b; @@ -213,14 +222,14 @@ XParseColor(Display *d, Colormap *cmap, char *name, XColor *color) } -int +int XAllocColor(Display *d, Colormap *cmap, XColor *color) { /* colormap not used yet so color->pixel is the real COLORREF (RBG) and not an index in some colormap as in X */ return (1); } -void +void XQueryColors(Display *display, Colormap *colormap, XColor *xcolors, int ncolors) { @@ -229,14 +238,16 @@ XQueryColors(Display *display, Colormap *colormap, XColor *xc = xcolors; int i; +#if !defined(__VISAGECPP__) /* fixme for OS/2 */ for (i = 0; i < ncolors; i++, xc++) { xc->red = GetRValue(xc->pixel); xc->green = GetGValue(xc->pixel); xc->blue = GetBValue(xc->pixel); } +#endif return; } -int +int XFreeColors(Display *d, Colormap cmap, unsigned long pixels[], int npixels, unsigned long planes) { @@ -255,8 +266,14 @@ XCreateImage(Display *d, Visual *v, if (img) { /* *img = CreateCompatibleBitmap(*d, width, height); */ - img->bitmap = CreateBitmap(width, height, 1 /* plane */ , + +#if !defined(__VISAGECPP__) /* fixme for OS/2 */ + /* create the bitmap with the same number of planes as the default display + * (otherwise it wouldn't work for 16 color mode) */ + img->bitmap = CreateBitmap(width, height, + GetDeviceCaps(*d, PLANES), depth /* bits per pixel */ , NULL); +#endif img->width = width; img->height = height; img->depth = depth; @@ -265,18 +282,20 @@ XCreateImage(Display *d, Visual *v, } -void +void XImageFree(XImage *img) { if (img) { XpmFree(img); } } -void +void XDestroyImage(XImage *img) { if (img) { +#if !defined(__VISAGECPP__) /* fixme for OS/2 */ DeleteObject(img->bitmap); /* check return ??? */ +#endif XImageFree(img); } }