git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9213
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
# endif/* AMIGA */
#else /* FOR_MSW */
/* FOR_MSW pixel routine */
# endif/* AMIGA */
#else /* FOR_MSW */
/* FOR_MSW pixel routine */
-#ifdef __OS2__
-LFUNC(MSWPutImagePixels, void, (
- HPS hps
-, Display* dc
-, XImage* image
-, unsigned int width
-, unsigned int height
-, unsigned int* pixelindex
-, Pixel* pixels
-));
-#else
LFUNC(MSWPutImagePixels, void, (Display *dc, XImage *image,
unsigned int width, unsigned int height,
unsigned int *pixelindex, Pixel *pixels));
LFUNC(MSWPutImagePixels, void, (Display *dc, XImage *image,
unsigned int width, unsigned int height,
unsigned int *pixelindex, Pixel *pixels));
#endif /* FOR_MSW */
#ifdef NEED_STRCASECMP
#endif /* FOR_MSW */
#ifdef NEED_STRCASECMP
image->data, image_pixels);
# endif
#else /* FOR_MSW */
image->data, image_pixels);
# endif
#else /* FOR_MSW */
-#ifdef __OS2__
- hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC|PU_PELS);
- MSWPutImagePixels(hps, display, ximage, image->width, image->height,
- image->data, image_pixels);
-#else
MSWPutImagePixels(display, ximage, image->width, image->height,
image->data, image_pixels);
MSWPutImagePixels(display, ximage, image->width, image->height,
image->data, image_pixels);
#endif
}
/* create the shape mask image */
#endif
}
/* create the shape mask image */
image->data, mask_pixels);
# endif
#else /* FOR_MSW */
image->data, mask_pixels);
# endif
#else /* FOR_MSW */
-#ifdef __OS2__
- hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC|PU_PELS);
- MSWPutImagePixels(hps, display, shapeimage, image->width, image->height,
- image->data, mask_pixels);
-#else
MSWPutImagePixels(display, shapeimage, image->width, image->height,
image->data, mask_pixels);
MSWPutImagePixels(display, shapeimage, image->width, image->height,
image->data, mask_pixels);
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void MSWPutImagePixels(
#ifdef __OS2__
/* Visual Age cannot deal with old, non-ansi, code */
static void MSWPutImagePixels(
, XImage* image
, unsigned int width
, unsigned int height
, XImage* image
, unsigned int width
, unsigned int height
#ifdef __OS2__
POINTL point;
#ifdef __OS2__
POINTL point;
- obm = GpiSetBitmap(hps, image->bitmap);
+ obm = GpiSetBitmap(*dc, image->bitmap);
#else
obm = SelectObject(*dc, image->bitmap);
#endif
#else
obm = SelectObject(*dc, image->bitmap);
#endif
#ifdef __OS2__
point.x = x;
point.y = y;
#ifdef __OS2__
point.x = x;
point.y = y;
- GpiSetColor(hps, (LONG)pixels[*(data++)]);
- GpiSetPel(hps, &point);
+ GpiSetColor(*dc, (LONG)pixels[*(data++)]);
+ GpiSetPel(*dc, &point);
#else
SetPixel(*dc, x, y, pixels[*(data++)]); /* data is [x+y*width] */
#else
SetPixel(*dc, x, y, pixels[*(data++)]); /* data is [x+y*width] */
- GpiSetBitmap(hps, obm);
+ GpiSetBitmap(*dc, obm);
#else
SelectObject(*dc, obm);
#endif
#else
SelectObject(*dc, obm);
#endif
unsigned int a, x, y;
#ifdef __OS2__
HAB hab;
unsigned int a, x, y;
#ifdef __OS2__
HAB hab;
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
SIZEL sizl = {0, 0};
POINTL point;
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
SIZEL sizl = {0, 0};
POINTL point;
if ( shapeimage ) {
#ifdef __OS2__
shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
if ( shapeimage ) {
#ifdef __OS2__
shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
- hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
- sobm = GpiSetBitmap(hps, shapeimage->bitmap);
+ *dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
+ sobm = GpiSetBitmap(*dc, shapeimage->bitmap);
#else
shapedc = CreateCompatibleDC(*dc);
sobm = SelectObject(shapedc, shapeimage->bitmap);
#else
shapedc = CreateCompatibleDC(*dc);
sobm = SelectObject(shapedc, shapeimage->bitmap);
shapedc = NULL;
}
#ifdef __OS2__
shapedc = NULL;
}
#ifdef __OS2__
- obm = GpiSetBitmap(hps, image->bitmap);
+ obm = GpiSetBitmap(*dc, image->bitmap);
#else
obm = SelectObject(*dc, image->bitmap);
#endif
#else
obm = SelectObject(*dc, image->bitmap);
#endif
shape_pixels[colidx[c] - 1]);
#else
#ifdef __OS2__
shape_pixels[colidx[c] - 1]);
#else
#ifdef __OS2__
- point.x = x;
- point.y = y;
- GpiSetColor(hps, (LONG)image_pixels[colidx[c] - 1]);
- GpiSetPel(hps, &point);
+ point.x = x;
+ point.y = y;
+ GpiSetColor(*dc, (LONG)image_pixels[colidx[c] - 1]);
+ GpiSetPel(*dc, &point);
#else
SetPixel(*dc, x, y, image_pixels[colidx[c] - 1]);
#endif
if (shapedc) {
#ifdef __OS2__
#else
SetPixel(*dc, x, y, image_pixels[colidx[c] - 1]);
#endif
if (shapedc) {
#ifdef __OS2__
- point.x = x;
- point.y = y;
- GpiSetColor(hps, (LONG)shape_pixels[colidx[c] - 1]);
- GpiSetPel(hps, &point);
+ point.x = x;
+ point.y = y;
+ GpiSetColor(*dc, (LONG)shape_pixels[colidx[c] - 1]);
+ GpiSetPel(*dc, &point);
#else
SetPixel(shapedc, x, y, shape_pixels[colidx[c] - 1]);
#endif
#else
SetPixel(shapedc, x, y, shape_pixels[colidx[c] - 1]);
#endif
#ifdef FOR_MSW
if ( shapedc ) {
#ifdef __OS2__
#ifdef FOR_MSW
if ( shapedc ) {
#ifdef __OS2__
- GpiSetBitmap(hps, sobm);
- DevCloseDC(shapedc);
+ GpiSetBitmap(*dc, sobm);
+ GpiDestroyPS(*dc);
+ DevCloseDC(shapedc);
#else
SelectObject(shapedc, sobm);
#else
SelectObject(shapedc, sobm);
- GpiSetBitmap(hps, obm);
+ GpiSetBitmap(*dc, obm);
#else
SelectObject(*dc, obm);
#endif
#else
SelectObject(*dc, obm);
#endif
/* array of pointers malloced by need */
unsigned short *cidx[256];
int char1;
/* array of pointers malloced by need */
unsigned short *cidx[256];
int char1;
+#ifdef __OS2__
+ HDC shapedc;
+#endif
bzero((char *)cidx, 256 * sizeof(unsigned short *)); /* init */
for (a = 0; a < ncolors; a++) {
bzero((char *)cidx, 256 * sizeof(unsigned short *)); /* init */
for (a = 0; a < ncolors; a++) {
shape_pixels[cidx[cc1][cc2] - 1]);
#else
#ifdef __OS2__
shape_pixels[cidx[cc1][cc2] - 1]);
#else
#ifdef __OS2__
- *dc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
- hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
-
- GpiSetBitmap(hps, image->bitmap);
- point.x = x;
- point.y = y;
- GpiSetColor(hps, (LONG)image_pixels[cidx[cc1][cc2] - 1]);
- GpiSetPel(hps, &point);
+ shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
+ *dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
+
+ GpiSetBitmap(*dc, image->bitmap);
+ point.x = x;
+ point.y = y;
+ GpiSetColor(*dc, (LONG)image_pixels[cidx[cc1][cc2] - 1]);
+ GpiSetPel(*dc, &point);
- SelectObject(*dc, image->bitmap);
- SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]);
+ SelectObject(*dc, image->bitmap);
+ SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]);
#endif
if (shapeimage) {
#ifdef __OS2__
#endif
if (shapeimage) {
#ifdef __OS2__
- GpiSetBitmap(hps, shapeimage->bitmap);
- point.x = x;
- point.y = y;
- GpiSetColor(hps, (LONG)shape_pixels[cidx[cc1][cc2] - 1]);
- GpiSetPel(hps, &point);
+ GpiSetBitmap(*dc, shapeimage->bitmap);
+ point.x = x;
+ point.y = y;
+ GpiSetColor(*dc, (LONG)shape_pixels[cidx[cc1][cc2] - 1]);
+ GpiSetPel(*dc, &point);
#else
SelectObject(*dc, shapeimage->bitmap);
SetPixel(*dc, x, y,
#else
SelectObject(*dc, shapeimage->bitmap);
SetPixel(*dc, x, y,
{
char *s;
char buf[BUFSIZ];
{
char *s;
char buf[BUFSIZ];
+#ifdef __OS2__
+ HDC shapedc;
+#endif
buf[cpp] = '\0';
if (USE_HASHTABLE) {
buf[cpp] = '\0';
if (USE_HASHTABLE) {
shape_pixels[HashColorIndex(slot)]);
#else
#ifdef __OS2__
shape_pixels[HashColorIndex(slot)]);
#else
#ifdef __OS2__
- *dc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
- hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
- GpiSetBitmap(hps, image->bitmap);
- point.x = x;
- point.y = y;
- GpiSetColor(hps, (LONG)image_pixels[HashColorIndex(slot)]);
- GpiSetPel(hps, &point);
+ shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
+ *dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
+
+ GpiSetBitmap(*dc, image->bitmap);
+ point.x = x;
+ point.y = y;
+ GpiSetColor(*dc, (LONG)image_pixels[HashColorIndex(slot)]);
+ GpiSetPel(*dc, &point);
#else
SelectObject(*dc, image->bitmap);
SetPixel(*dc, x, y,
#else
SelectObject(*dc, image->bitmap);
SetPixel(*dc, x, y,
#endif
if (shapeimage) {
#ifdef __OS2__
#endif
if (shapeimage) {
#ifdef __OS2__
- GpiSetBitmap(hps, shapeimage->bitmap);
- point.x = x;
- point.y = y;
- GpiSetColor(hps, (LONG)shape_pixels[HashColorIndex(slot)]);
- GpiSetPel(hps, &point);
+ GpiSetBitmap(*dc, shapeimage->bitmap);
+ point.x = x;
+ point.y = y;
+ GpiSetColor(*dc, (LONG)shape_pixels[HashColorIndex(slot)]);
+ GpiSetPel(*dc, &point);
#else
SelectObject(*dc, shapeimage->bitmap);
SetPixel(*dc, x, y,
#else
SelectObject(*dc, shapeimage->bitmap);
SetPixel(*dc, x, y,
XPutPixel(shapeimage, x, y, shape_pixels[a]);
#else
#ifdef __OS2__
XPutPixel(shapeimage, x, y, shape_pixels[a]);
#else
#ifdef __OS2__
- *dc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
- hps = GpiCreatePS(hab, *dc, &sizl, GPIA_ASSOC | PU_PELS);
- GpiSetBitmap(hps, image->bitmap);
- point.x = x;
- point.y = y;
- GpiSetColor(hps, (LONG)image_pixels[a]);
- GpiSetPel(hps, &point);
+ shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
+ *dc = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
+
+ GpiSetBitmap(*dc, image->bitmap);
+ point.x = x;
+ point.y = y;
+ GpiSetColor(*dc, (LONG)image_pixels[a]);
+ GpiSetPel(*dc, &point);
#else
SelectObject(*dc, image->bitmap);
SetPixel(*dc, x, y, image_pixels[a]);
#endif
if (shapeimage) {
#ifdef __OS2__
#else
SelectObject(*dc, image->bitmap);
SetPixel(*dc, x, y, image_pixels[a]);
#endif
if (shapeimage) {
#ifdef __OS2__
- GpiSetBitmap(hps, image->bitmap);
- point.x = x;
- point.y = y;
- GpiSetColor(hps, (LONG)shape_pixels[a]);
- GpiSetPel(hps, &point);
+ GpiSetBitmap(*dc, image->bitmap);
+ point.x = x;
+ point.y = y;
+ GpiSetColor(*dc, (LONG)shape_pixels[a]);
+ GpiSetPel(*dc, &point);
#else
SelectObject(*dc, shapeimage->bitmap);
SetPixel(*dc, x, y, shape_pixels[a]);
#else
SelectObject(*dc, shapeimage->bitmap);
SetPixel(*dc, x, y, shape_pixels[a]);
# endif /* AMIGA */
#else
# endif /* AMIGA */
#else
ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height,
&pmap, storeMaskPixel);
ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height,
&pmap, storeMaskPixel);
-/* calling convention all messed up OS/2 -- figure out later */
-#endif
#endif /* ndef for FOR_MSW */
#endif /* ndef for FOR_MSW */
# endif /* AMIGA */
#else
# endif /* AMIGA */
#else
ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
storePixel);
ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
storePixel);
#else
sprintf(buf, "#%02x%02x%02x",
xcolor->red, xcolor->green, xcolor->blue);
#else
sprintf(buf, "#%02x%02x%02x",
xcolor->red, xcolor->green, xcolor->blue);
color->c_color = (char *) xpmstrdup(buf);
}
if (!color->c_color) {
color->c_color = (char *) xpmstrdup(buf);
}
if (!color->c_color) {
Pixel pixel;
#ifdef __OS2__
HAB hab;
Pixel pixel;
#ifdef __OS2__
HAB hab;
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
SIZEL sizl = {0, 0};
POINTL point;
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
SIZEL sizl = {0, 0};
POINTL point;
iptr = pmap->pixelindex;
#ifdef __OS2__
iptr = pmap->pixelindex;
#ifdef __OS2__
- hps = GpiCreatePS(hab, *display, &sizl, GPIA_ASSOC | PU_PELS);
- GpiSetBitmap(hps, image->bitmap);
+ shapedc = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
+ *display = GpiCreatePS(hab, shapedc, &sizl, GPIA_ASSOC | PU_PELS);
+ GpiSetBitmap(*display, image->bitmap);
#else
SelectObject(*display, image->bitmap);
#endif
#else
SelectObject(*display, image->bitmap);
#endif
#ifdef __OS2__
point.x = x;
point.y = y;
#ifdef __OS2__
point.x = x;
point.y = y;
- pixel = GpiQueryPel(hps, &point);
+ pixel = GpiQueryPel(*display, &point);
#else
pixel = GetPixel(*display, x, y);
#endif
#else
pixel = GetPixel(*display, x, y);
#endif
DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes);
DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel);
b = (int)lBitsPerPixel;
DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes);
DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel);
b = (int)lBitsPerPixel;
+ WinReleasePS(hpsScreen);
#else
b = GetDeviceCaps(*display, BITSPIXEL);
d = GetDeviceCaps(*display, PLANES);
#else
b = GetDeviceCaps(*display, BITSPIXEL);
d = GetDeviceCaps(*display, PLANES);
img->bitmap = CreateCompatibleBitmap(*d, width, height);
} else*/ {
#ifdef __OS2__
img->bitmap = CreateCompatibleBitmap(*d, width, height);
} else*/ {
#ifdef __OS2__
- img->bitmap = GpiCreateBitmap(hps, &bmih, 0L, NULL, NULL);
+ img->bitmap = GpiCreateBitmap(hps, &bmih, 0L, NULL, NULL);
+ WinReleasePS(hps);
#else
img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
depth /* bits per pixel */ , NULL);
#else
img->bitmap = CreateBitmap(width, height, 1 /* plane */ ,
depth /* bits per pixel */ , NULL);
#else
#define INCL_PM
#define INCL_GPI
#else
#define INCL_PM
#define INCL_GPI
#include<os2.h>
typedef unsigned long COLORREF;
#include<os2.h>
typedef unsigned long COLORREF;
// RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def
// RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def
-//#define OS2RGB(r,g,b) ((ULONG ((BYTE) (r) | ((UINT) (g) << 8)) | (((ULONG)(BYTE)(b)) << 16)))
-#define OS2RGB(r,g,b) ((unsigned long)r<<16|(unsigned long)g<<8|(unsigned long)b)
+// #define OS2RGB(r,g,b) ((ULONG ((BYTE) (r) | ((UINT) (g) << 8)) | (((ULONG)(BYTE)(b)) << 16)))
+*/
+#ifndef OS2RGB
+# define OS2RGB(r,g,b) ((unsigned long)r<<16|(unsigned long)g<<8|(unsigned long)b)
+#endif
-#define GetBValue(rgb) ((BYTE)((rgb) >> 16))
-#define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8))
-#define GetRValue(rgb) ((BYTE)(rgb))
-typedef UINT WORD;
+#ifndef GetBValue
+# define GetBValue(rgb) ((BYTE)((rgb) >> 16))
+#endif
+#ifndef GetGValue
+# define GetGValue(rgb) ((BYTE)(((UINT)(rgb)) >> 8))
+#endif
+#ifndef GetRValue
+# define GetRValue(rgb) ((BYTE)(rgb))
+typedef UINT WORD;
+#endif /* else __OS2__ */
/* define MSW types for X window types,
I don't know much about MSW, but the following defines do the job */
/* define MSW types for X window types,
I don't know much about MSW, but the following defines do the job */
typedef HDC Display; /* this should be similar */
typedef HDC Display; /* this should be similar */
+#else
+typedef HPS Display;
+#endif
+
typedef void *Screen; /* not used */
typedef void *Visual; /* not used yet, is for GRAY, COLOR,
* MONO */
typedef void *Screen; /* not used */
typedef void *Visual; /* not used yet, is for GRAY, COLOR,
* MONO */