pzData = (char *)zBits; // const_cast is harmless
}
+ if (nDepth > 24)
+ nDepth = 24; // MAX supported in PM
memset(&vHeader, '\0', 16);
vHeader.cbFix = 16;
vHeader.cx = (USHORT)nWidth;
hDCScreen = ::GpiQueryDevice(hPSScreen);
::DevQueryCaps(hDCScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitCount);
+ if (lBitCount > 24)
+ lBitCount = 24;
+
memset(&vHeader, '\0', 16);
vHeader.cbFix = 16;
vHeader.cx = nW;
//
BITMAPINFOHEADER2 vHeader;
BITMAPINFO2 vInfo;
+ LONG alFormats[24]; // Max formats OS/2 PM supports
+ ULONG ulBitcount;
//
// Fill in the DIB header
vHeader.cPlanes = 1L;
vHeader.cBitCount = 24;
- memset(&vInfo, '\0', 16);
- vInfo.cbFix = 16;
- vInfo.cx = (ULONG)nWidth;
- vInfo.cy = (ULONG)nHeight;
- vInfo.cPlanes = 1L;
- vInfo.cBitCount = 24;
//
// Memory for DIB data
//
HBITMAP hBmp;
HBITMAP hBmpOld;
+ ::GpiQueryDeviceBitmapFormats(hPS, 24, alFormats);
+ ulBitcount = alFormats[1]; // the best one for the device
+ if (ulBitcount > 24)
+ ulBitcount = 24; // MAX bits supported by PM
+ memset(&vInfo, '\0', 16);
+ vInfo.cbFix = 16;
+ vInfo.cx = (ULONG)nWidth;
+ vInfo.cy = (ULONG)nHeight;
+ vInfo.cPlanes = 1;
+ vInfo.cBitCount = ulBitcount;
+
hBmp = ::GpiCreateBitmap( hPS
,&vHeader
,0L
// Have to do something similar to WIN32's StretchDIBits, use GpiBitBlt
// in combination with setting the bits into the selected bitmap
//
- vInfo.cBitCount = 16;
if ((lScans = ::GpiSetBitmapBits( hPS
,0 // Start at the bottom
,(LONG)nHeight // One line per scan
sError = wxPMErrorToStr(vError);
}
- //
- // for debugging----
- //
-LONG alFormats[24];
-::GpiQueryDeviceBitmapFormats(hPS, 24, alFormats);
-if ((lScans = ::GpiQueryBitmapBits( hPS
- ,0L
- ,(LONG)nHeight
- ,(PBYTE)pucBits
- ,&vInfo
- )) == GPI_ALTERROR)
-{
- ERRORID vError;
- wxString sError;
-
- vError = ::WinGetLastError(vHabmain);
- sError = wxPMErrorToStr(vError);
-}
-
hPSScreen = ::GpiCreatePS( vHabmain
,hDCScreen
,&vSize
//
::GpiSetBitmap(hPS, NULLHANDLE);
::GpiDestroyPS(hPS);
+ ::DevCloseDC(hDCScreen);
::DevCloseDC(hDC);
free(pucBits);
return TRUE;
DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
SIZEL vSizlPage = {0,0};
HDC hDCMem;
+ LONG alFormats[24]; // 24 is MAX formats supported
+ ULONG ulBitcount;
+ ::GpiQueryDeviceBitmapFormats(hPS, 24, alFormats);
+ ulBitcount = alFormats[1]; // the best one
+ if (ulBitcount > 24) // PM supports a max of 24
+ ulBitcount = 24;
vImage.Create( nWidth
,nHeight
);
vDIBInfo.cx = nWidth;
vDIBInfo.cy = nHeight;
vDIBInfo.cPlanes = 1;
- vDIBInfo.cBitCount = 24;
+ vDIBInfo.cBitCount = ulBitcount;
lpBits = (unsigned char *)malloc(nBytePerLine * nHeight);
if (!lpBits)