Changeset 9429 for trunk/src/gdi32/blit.cpp
- Timestamp:
- Nov 26, 2002, 11:53:12 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r9355 r9429 1 /* $Id: blit.cpp,v 1.4 0 2002-10-28 12:21:51sandervl Exp $ */1 /* $Id: blit.cpp,v 1.41 2002-11-26 10:53:06 sandervl Exp $ */ 2 2 3 3 /* … … 47 47 rc = dsect->BitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, 48 48 nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, dwRop); 49 dprintf(("GDI32: StretchBlt returned %d", rc));50 49 return rc; 51 50 } … … 330 329 } 331 330 return rc; 332 333 //SvL: Breaks startup bitmap of Acrobat Reader 4.05334 #if 0335 else336 if(info->bmiHeader.biBitCount == 8 && info->bmiHeader.biCompression == 0 && !(GetDeviceCaps( hdc, RASTERCAPS ) & RC_PALETTE)) {337 INT rc = 0;338 // convert 8bit to 24bit339 340 BITMAPINFO newInfo;341 newInfo.bmiHeader = info->bmiHeader;342 newInfo.bmiHeader.biBitCount = 24;343 long lLineByte24 = ((newInfo.bmiHeader.biWidth * 24 + 31) / 32) * 4;344 long lLineByte8 = ((newInfo.bmiHeader.biWidth * 8 + 31) / 32) * 4;345 long lHeight = newInfo.bmiHeader.biHeight;346 if(lHeight < 0) lHeight = -lHeight;347 348 char *newBits = (char *)malloc( lLineByte24 * lHeight );349 if(newBits) {350 //351 // Get Palette Entries352 //353 PALETTEENTRY aEntries[256];354 LOGPALETTE *pLog = (LOGPALETTE *)malloc( sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * 256 );355 pLog->palVersion = 0x300;356 pLog->palNumEntries = 256;357 358 HPALETTE hPaletteDummy = CreatePalette( pLog );359 free( pLog );360 HPALETTE hPalette = SelectPalette( hdc, hPaletteDummy, FALSE );361 GetPaletteEntries( hPalette, 0, 255, aEntries );362 SelectPalette( hdc, hPalette, FALSE );363 DeleteObject( hPaletteDummy );364 365 //366 // convert 8bit to 24bit367 //368 if(newInfo.bmiHeader.biHeight > 0) {369 unsigned char *pbSrc = (unsigned char *)bits;370 unsigned char *pbDst = (unsigned char *)newBits;371 for(int y = 0; y < lHeight; y++) {372 for(int x = 0; x < newInfo.bmiHeader.biWidth; x++) {373 PALETTEENTRY src = aEntries[pbSrc[x]];374 pbDst[x * 3 + 0] = src.peBlue;375 pbDst[x * 3 + 1] = src.peGreen;376 pbDst[x * 3 + 2] = src.peRed;377 }378 pbDst += lLineByte24;379 pbSrc += lLineByte8;380 }381 } else {382 // upside down383 newInfo.bmiHeader.biHeight = -info->bmiHeader.biHeight;384 unsigned char *pbSrc = (unsigned char *)bits + lLineByte8 * (lHeight - 1);385 unsigned char *pbDst = (unsigned char *)newBits;386 for(int y = 0; y < lHeight; y++) {387 for(int x = 0; x < newInfo.bmiHeader.biWidth; x++) {388 PALETTEENTRY src = aEntries[pbSrc[x]];389 pbDst[x * 3 + 0] = src.peBlue;390 pbDst[x * 3 + 1] = src.peGreen;391 pbDst[x * 3 + 2] = src.peRed;392 }393 pbDst += lLineByte24;394 pbSrc -= lLineByte8;395 }396 }397 rc = SetDIBitsToDevice_( hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (void *)newBits, &newInfo, DIB_RGB_COLORS );398 free( newBits );399 }400 return rc;401 }402 #endif403 331 } 404 332 //****************************************************************************** … … 427 355 } 428 356 } 429 430 dprintf(("GDI32: PatBlt hdc %x (%d,%d) (%d,%d) returned %d\n",hdc, nXLeft,nYLeft,nWidth,nHeight,rc));431 357 return(rc); 432 358 } … … 435 361 BOOL WIN32API MaskBlt( HDC arg1, int arg2, int arg3, int arg4, int arg5, HDC arg6, int arg7, int arg8, HBITMAP arg9, int arg10, int arg11, DWORD arg12) 436 362 { 437 dprintf(("GDI32: MaskBlt"));438 363 return O32_MaskBlt(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); 439 364 } … … 541 466 xSrc, ySrc)/sizeof(WORD); 542 467 newbits = (WORD *) HeapAlloc(GetProcessHeap(), 0, imgsize); 468 //bugbug (too much) 469 //bugbug 543 470 if(CPUFeatures & CPUID_MMX) { 544 471 RGB555to565MMX(newbits, (WORD *)bits+offset, imgsize/sizeof(WORD)); … … 548 475 bits = newbits; 549 476 } 550 //SvL: Ignore BI_BITFIELDS type (S etDIBitsToDevicefails otherwise)477 //SvL: Ignore BI_BITFIELDS type (StretchDIBits fails otherwise) 551 478 if(info->bmiHeader.biCompression == BI_BITFIELDS) { 552 479 ((BITMAPINFO *)info)->bmiHeader.biCompression = 0; … … 629 556 int WIN32API SetStretchBltMode( HDC arg1, int arg2) 630 557 { 631 dprintf(("GDI32: SetStretchBltMode 0x%08X, 0x%08X\n",arg1, arg2));632 633 558 if(DIBSection::getSection() != NULL) 634 559 { … … 645 570 int WIN32API GetStretchBltMode( HDC arg1) 646 571 { 647 dprintf(("GDI32: GetStretchBltMode"));648 572 return O32_GetStretchBltMode(arg1); 649 573 }
Note:
See TracChangeset
for help on using the changeset viewer.