Changeset 8753 for trunk/src/user32/oslibres.cpp
- Timestamp:
- Jun 25, 2002, 9:11:10 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibres.cpp
r7943 r8753 1 /* $Id: oslibres.cpp,v 1.3 0 2002-02-18 10:14:56sandervl Exp $ */1 /* $Id: oslibres.cpp,v 1.31 2002-06-25 07:11:10 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 247 247 pixel = 0; 248 248 memcpy(&pixel, os2rgb, increment); 249 if(nrcolors == 0) { 249 if(nrcolors == 0) { 250 250 color[0] = pixel; 251 251 nrcolors = 1; … … 257 257 } 258 258 else { 259 if(color[0] != pixel && color[1] != pixel) 259 if(color[0] != pixel && color[1] != pixel) 260 260 { 261 261 return FALSE; … … 271 271 //****************************************************************************** 272 272 char *colorToMonoBitmap(HBITMAP bmpsrc, BITMAPINFO2 *pBmpDest) 273 { 273 { 274 274 HDC hdcDest = 0; /* device context handle */ 275 275 HPS hpsDest = 0; 276 276 SIZEL sizl = { 0, 0 }; /* use same page size as device */ 277 277 DEVOPENSTRUC dop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L}; 278 LONG lHits; 278 LONG lHits; 279 279 char *bmpbuffer = 0; 280 280 BITMAPINFO2 *bmpinfo = NULL; … … 287 287 /* create memory device context */ 288 288 hdcDest = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE); 289 289 290 290 /* Create the presentation and associate the memory device 291 291 context. */ 292 292 hpsDest = GpiCreatePS(hab, hdcDest, &sizl, PU_PELS | 293 293 GPIT_MICRO | GPIA_ASSOC); 294 if(!hpsDest) goto fail; 294 if(!hpsDest) goto fail; 295 295 296 296 GpiSetBitmap(hpsDest, bmpsrc); … … 322 322 else WriteLogNoEOL("."); 323 323 } 324 else 324 else 325 325 if(j<16) { 326 326 if((*(bmpbuffer+1+i*4)) & (1<<(15-j))) { … … 355 355 free(bmpinfo); 356 356 357 return bmpbuffer; 357 return bmpbuffer; 358 358 359 359 fail: … … 374 374 // Assumes 1 bpp bitmaps have a top left origin and all others have a bottom left origin 375 375 //****************************************************************************** 376 HANDLE OSLibWinCreatePointer(CURSORICONINFO *pInfo, char *pAndBits, BITMAP_W *pAndBmp, char *pXorBits, 376 HANDLE OSLibWinCreatePointer(CURSORICONINFO *pInfo, char *pAndBits, BITMAP_W *pAndBmp, char *pXorBits, 377 377 BITMAP_W *pXorBmp, BOOL fCursor) 378 378 { … … 434 434 } 435 435 } 436 else 436 else 437 437 if(pXorBmp->bmBitsPixel == 16) { 438 438 ConvertRGB555to565(os2rgb, rgb, pXorBmp->bmHeight * pXorBmp->bmWidthBytes); … … 447 447 goto fail; 448 448 } 449 if(fCursor && pXorBmp->bmBitsPixel >= 8) 449 if(fCursor && pXorBmp->bmBitsPixel >= 8) 450 450 { 451 if(fForceMonoCursor || isMonoBitmap(pXorBmp, (PBYTE)os2rgb) == TRUE) 451 if(fForceMonoCursor || isMonoBitmap(pXorBmp, (PBYTE)os2rgb) == TRUE) 452 452 { 453 453 pOS2XorBits = colorToMonoBitmap(hbmColor, pBmpColor); … … 466 466 //SvL: 2*sizeof(RGB2) is enough, but GpiCreateBitmap seems to touch more 467 467 // memory. (Adobe Photoshop 6 running in the debugger) 468 masksize = sizeof(BITMAPINFO2) + (pAndBmp->bmHeight * 2 * pAndBmp->bmWidthBytes) + 16*sizeof(RGB2); 468 //bird: We should reserve the amount required anythingelse is stupid. 469 // Looks like it's reading 3 bytes too much... Hopefully that's due to the 470 // &pBmpMask->argbColor[2] which it assumes is 16 colors long. But no proofs. 471 masksize = sizeof(BITMAPINFO2) + (pAndBmp->bmHeight * 2 * pAndBmp->bmWidthBytes) + (16+2)*sizeof(RGB2); 469 472 pBmpMask = (BITMAPINFO2 *)malloc(masksize); 470 473 if(pBmpMask == NULL) { … … 723 726 //****************************************************************************** 724 727 //****************************************************************************** 725 BOOL WIN32API OSLibWinCreateObject(LPSTR pszPath, LPSTR pszArgs, 726 LPSTR pszWorkDir, LPSTR pszLink, 728 BOOL WIN32API OSLibWinCreateObject(LPSTR pszPath, LPSTR pszArgs, 729 LPSTR pszWorkDir, LPSTR pszLink, 727 730 LPSTR pszDescription, LPSTR pszIcoPath, 728 731 INT iIcoNdx, BOOL fDesktop) … … 748 751 } 749 752 } 750 dprintf(("OSLibWinCreateObject %s %s %s\n %s %s %s %d %d", pszPath, pszArgs, 753 dprintf(("OSLibWinCreateObject %s %s %s\n %s %s %s %d %d", pszPath, pszArgs, 751 754 pszWorkDir, pszName, pszDescription, pszIcoPath, iIcoNdx, fDesktop)); 752 755 dprintf(("Link path %s", pszLink)); … … 761 764 } 762 765 763 pszSetupString = (LPSTR)malloc(128 + strlen(pszPath) + strlen(pszName) + 766 pszSetupString = (LPSTR)malloc(128 + strlen(pszPath) + strlen(pszName) + 764 767 strlen(pszLink) + 2*strlen(szSystemDir) + 765 768 strlen(szWorkDir) + strlen(pszIcoPath) + 766 ((pszArgs) ? strlen(pszArgs) : 0) + 767 ((pszWorkDir) ? strlen(pszWorkDir) : 0)); 769 ((pszArgs) ? strlen(pszArgs) : 0) + 770 ((pszWorkDir) ? strlen(pszWorkDir) : 0)); 768 771 769 772 sprintf(pszSetupString, "PROGTYPE=PM;OBJECTID=<%s>;EXENAME=%s\\PE.EXE;SET BEGINLIBPATH=%s;STARTUPDIR=%s;ICONFILE=%s;PARAMETERS=\"%s\"", pszName, szSystemDir, szSystemDir, szWorkDir, pszIcoPath, pszPath); … … 777 780 dprintf(("Name = %s", pszName)); 778 781 dprintf(("Setup string = %s", pszSetupString)); 779 hObject = WinCreateObject("WPProgram", pszName, pszSetupString, 782 hObject = WinCreateObject("WPProgram", pszName, pszSetupString, 780 783 "<WP_DESKTOP>", CO_REPLACEIFEXISTS); 781 784 } … … 788 791 hObject = WinCreateObject("WPFolder", pszFolder, szWorkDir, 789 792 "<ODINFOLDER>", CO_UPDATEIFEXISTS); 790 hObject = WinCreateObject("WPProgram", pszName, pszSetupString, 793 hObject = WinCreateObject("WPProgram", pszName, pszSetupString, 791 794 temp, CO_REPLACEIFEXISTS); 792 795 } 793 796 // If SysCreateObject("WPProgram", "WarpMix", "<ICHAUDIO>",, 794 // "PROGTYPE=PM;OBJECTID=<WARPMIX>;ICONFILE=WARPMIX.ICO;EXENAME="||bootDrive||"\MMOS2\WARPMIX.EXE") 797 // "PROGTYPE=PM;OBJECTID=<WARPMIX>;ICONFILE=WARPMIX.ICO;EXENAME="||bootDrive||"\MMOS2\WARPMIX.EXE") 795 798 796 799 free(pszSetupString);
Note:
See TracChangeset
for help on using the changeset viewer.