Changeset 10488 for trunk/src/user32/oslibres.cpp
- Timestamp:
- Feb 27, 2004, 8:51:56 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibres.cpp
r9889 r10488 1 /* $Id: oslibres.cpp,v 1.3 7 2003-03-03 16:36:26 sandervl Exp $ */1 /* $Id: oslibres.cpp,v 1.38 2004-02-27 19:51:56 sandervl Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 388 388 hps = WinGetScreenPS(HWND_DESKTOP); 389 389 390 if(pXorBits )390 if(pXorBits && pXorBmp->bmBitsPixel > 1) 391 391 {//color bitmap present 392 392 RGBQUAD *rgb; … … 398 398 399 399 colorsize = sizeof(BITMAPINFO2) + (pXorBmp->bmHeight * pXorBmp->bmWidthBytes) + rgbsize; 400 pBmpColor = (BITMAPINFO2 *) malloc(colorsize);400 pBmpColor = (BITMAPINFO2 *)calloc(colorsize, 1); 401 401 if(pBmpColor == NULL) { 402 402 DebugInt3(); 403 403 return 0; 404 404 } 405 memset(pBmpColor, 0, colorsize);406 405 pBmpColor->cbFix = sizeof(BITMAPINFOHEADER2); 407 406 pBmpColor->cx = (USHORT)pXorBmp->bmWidth; … … 415 414 rgb = (RGBQUAD *)(pXorBits); 416 415 417 #if 0418 if(pXorBmp->bmBitsPixel == 1) {419 os2rgb->bRed = os2rgb->bBlue = os2rgb->bGreen = 0;420 os2rgb++;421 os2rgb->bRed = os2rgb->bBlue = os2rgb->bGreen = 0xff;422 os2rgb++;423 }424 else425 #endif426 416 if(pXorBmp->bmBitsPixel <= 8) { 427 417 for(i=0;i<(1<<pXorBmp->bmBitsPixel);i++) { … … 434 424 } 435 425 436 if(pXorBmp->bmBitsPixel == 1) {437 //copy Xor bits (must reverse scanlines because origin is top left instead of bottom left)438 src = (char *)rgb;439 dest = ((char *)os2rgb) + (pXorBmp->bmHeight - 1) * pXorBmp->bmWidthBytes;440 for(i=0;i<pXorBmp->bmHeight;i++) {441 memcpy(dest, src, pXorBmp->bmWidthBytes);442 dest -= pXorBmp->bmWidthBytes;443 src += pXorBmp->bmWidthBytes;444 }445 }446 else447 426 if(pXorBmp->bmBitsPixel == 16) { 448 427 ConvertRGB555to565(os2rgb, rgb, pXorBmp->bmHeight * pXorBmp->bmWidthBytes); … … 480 459 // &pBmpMask->argbColor[2] which it assumes is 16 colors long. But no proofs. 481 460 masksize = sizeof(BITMAPINFO2) + (pAndBmp->bmHeight * 2 * pAndBmp->bmWidthBytes) + (16+2)*sizeof(RGB2); 482 pBmpMask = (BITMAPINFO2 *) malloc(masksize);461 pBmpMask = (BITMAPINFO2 *)calloc(masksize, 1); 483 462 if(pBmpMask == NULL) { 484 463 DebugInt3(); 485 464 return 0; 486 465 } 487 memset(pBmpMask, 0, masksize);488 466 pBmpMask->cbFix = sizeof(BITMAPINFOHEADER2); 489 467 pBmpMask->cx = (USHORT)pAndBmp->bmWidth; … … 493 471 pBmpMask->ulCompression = BCA_UNCOMP; 494 472 pBmpMask->ulColorEncoding = BCE_RGB; 495 memset(&pBmpMask->argbColor[0], 0 , sizeof(RGB2));473 memset(&pBmpMask->argbColor[0], 0x00, sizeof(RGB)); //not the reserved byte 496 474 memset(&pBmpMask->argbColor[1], 0xff, sizeof(RGB)); //not the reserved byte 497 if(pOS2XorBits) { 498 dest = ((char *)&pBmpMask->argbColor[2]); 499 memcpy(dest, pOS2XorBits, pAndBmp->bmWidthBytes*pAndBmp->bmHeight); 500 free(pOS2XorBits); 501 pOS2XorBits = NULL; 475 476 // The mono XOR bitmap must be first in the pointer bitmap 477 if(pOS2XorBits || pXorBmp->bmBitsPixel == 1) 478 { 479 if(pXorBmp->bmBitsPixel == 1) 480 { 481 pOS2XorBits = (char *)calloc(pXorBmp->bmHeight, pXorBmp->bmWidthBytes); 482 483 //copy Xor bits (must reverse scanlines because origin is top left instead of bottom left) 484 src = (char *)pXorBits; 485 dest = ((char *)pOS2XorBits) + (pXorBmp->bmHeight - 1) * pXorBmp->bmWidthBytes; 486 for(i=0;i<pXorBmp->bmHeight;i++) { 487 memcpy(dest, src, pXorBmp->bmWidthBytes); 488 dest -= pXorBmp->bmWidthBytes; 489 src += pXorBmp->bmWidthBytes; 490 } 491 } 492 //else converted bitmap (created by colorToMonoBitmap) 493 494 dest = ((char *)&pBmpMask->argbColor[2]); 495 memcpy(dest, pOS2XorBits, pAndBmp->bmWidthBytes*pAndBmp->bmHeight); 496 free(pOS2XorBits); 497 pOS2XorBits = NULL; 502 498 } 503 499 // else Xor bits are already 0
Note:
See TracChangeset
for help on using the changeset viewer.