]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xpm/scan.c
minor fix for OS/2
[wxWidgets.git] / src / xpm / scan.c
index f3c7f49d8d838fa24b794dbfceeb16a0326ef084..4390a0d6123dcbd2e6c2e3a72c92cbba09cf1aa3 100644 (file)
@@ -273,11 +273,8 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
 # endif /* AMIGA */
 #else
 
-#ifndef __OS2__
            ErrorStatus = MSWGetImagePixels(display, shapeimage, width, height,
                                        &pmap, storeMaskPixel);
-/* calling convention all messed up OS/2 -- figure out later */
-#endif
 
 #endif /* ndef for FOR_MSW */
 
@@ -316,6 +313,7 @@ XpmCreateXpmImageFromImage(display, image, shapeimage,
            ErrorStatus = AGetImagePixels(image, width, height, &pmap,
                                      storePixel);
 # endif /* AMIGA */
+#else
 
            ErrorStatus = MSWGetImagePixels(display, image, width, height, &pmap,
                                        storePixel);
@@ -503,7 +501,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
        return (XpmNoMemory);
 
     for (i = 0, i2 = mask, color = colors, xcolor = xcolors;
-        i < ncolors; i++, i2++, color++, xcolor++, pixels++) {
+        i < (unsigned)ncolors; i++, i2++, color++, xcolor++, pixels++) {
 
        if (!(s = color->string = (char *) XpmMalloc(cpp + 1))) {
            XpmFree(xcolors);
@@ -546,7 +544,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
     }
 /* end 3.2 bc */
 
-    for (i = 0, color = colors, xcolor = xcolors; i < ncolors;
+    for (i = 0, color = colors, xcolor = xcolors; i < (unsigned)ncolors;
                                                  i++, color++, xcolor++) {
 
        /* look for related info from the attributes if any */
@@ -598,7 +596,7 @@ ScanOtherColors(display, colors, ncolors, pixels, mask, cpp, attributes)
 #else
                sprintf(buf, "#%02x%02x%02x",
                        xcolor->red, xcolor->green, xcolor->blue);
-#endif                 
+#endif
                color->c_color = (char *) xpmstrdup(buf);
            }
            if (!color->c_color) {
@@ -1023,7 +1021,7 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
     Pixel pixel;
 #ifdef __OS2__
      HAB          hab;
-     HPS          hps;
+     HDC          shapedc;
      DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
      SIZEL        sizl = {0, 0};
      POINTL       point;
@@ -1032,8 +1030,9 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
     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
@@ -1043,7 +1042,7 @@ MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
 #ifdef __OS2__
      point.x = x;
      point.y = y;
-     pixel = GpiQueryPel(hps, &point);
+     pixel = GpiQueryPel(*display, &point);
 #else
            pixel = GetPixel(*display, x, y);
 #endif