- Timestamp:
- Aug 30, 2000, 8:05:25 PM (25 years ago)
- Location:
- trunk/src/gdi32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r4034 r4127 1 /* $Id: blit.cpp,v 1.1 6 2000-08-18 18:14:56sandervl Exp $ */1 /* $Id: blit.cpp,v 1.17 2000-08-30 18:05:24 sandervl Exp $ */ 2 2 3 3 /* … … 225 225 const BITMAPINFO *info, UINT wUsage, DWORD dwRop ) 226 226 { 227 #if 1228 227 INT rc; 229 228 … … 263 262 DIBSection *destdib = DIBSection::findHDC(hdc); 264 263 if(destdib) { 265 destdib->sync(hdc, yDst, heightDst); 264 if(widthDst == widthSrc && heightDst == heightSrc && 265 destdib->GetBitCount() == infoLoc->bmiHeader.biBitCount && 266 destdib->GetBitCount() == 8) 267 { 268 destdib->sync(xDst, yDst, widthDst, heightDst, (PVOID)bits); 269 } 270 else destdib->sync(hdc, yDst, heightDst); 266 271 } 267 272 } … … 277 282 else { 278 283 DIBSection *destdib = DIBSection::findHDC(hdc); 279 if(destdib) { 280 destdib->sync(hdc, yDst, heightDst); 281 } 284 if(destdib) { 285 if(widthDst == widthSrc && heightDst == heightSrc && 286 destdib->GetBitCount() == info->bmiHeader.biBitCount && 287 destdib->GetBitCount() == 8) 288 { 289 destdib->sync(xDst, yDst, widthDst, heightDst, (PVOID)bits); 290 } 291 else destdib->sync(hdc, yDst, heightDst); 292 } 282 293 } 283 294 284 295 return rc; 285 #else286 dprintf(("GDI32: StretchDIBits\n"));287 return O32_StretchDIBits(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, (void *)arg10, (PBITMAPINFO)arg11, arg12, arg13);288 #endif289 296 } 290 297 //****************************************************************************** -
trunk/src/gdi32/dibsect.cpp
r4034 r4127 1 /* $Id: dibsect.cpp,v 1.3 7 2000-08-18 18:14:57sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.38 2000-08-30 18:05:24 sandervl Exp $ */ 2 2 3 3 /* … … 41 41 : bmpBits(NULL), pOS2bmp(NULL), next(NULL), bmpBitsDblBuffer(NULL) 42 42 { 43 int palsize=0; 44 43 45 bmpsize = pbmi->biWidth; 44 46 /* @@@PH 98/06/07 -- high-color bitmaps don't have palette */ … … 50 52 { 51 53 case 1: 52 bmpsize = ((bmpsize + 31) & ~31) / 8; 53 os2bmphdrsize += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2); 54 bmpsize = ((bmpsize + 31) & ~31) / 8; 55 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 56 os2bmphdrsize += palsize; 54 57 break; 55 58 case 4: 56 59 bmpsize = ((bmpsize + 7) & ~7) / 2; 57 os2bmphdrsize += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2); 60 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 61 os2bmphdrsize += palsize; 58 62 break; 59 63 case 8: 60 os2bmphdrsize += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2); 64 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 65 os2bmphdrsize += palsize; 61 66 bmpsize = (bmpsize + 3) & ~3; 62 67 break; … … 79 84 80 85 this->hSection = hSection; 86 this->dwOffset = dwOffset; 81 87 if(hSection) { 82 88 bmpBits = (char *)MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS_W, 0, dwOffset, bmpsize*pbmi->biHeight); … … 130 136 dibinfo.dsBm.bmBits = bmpBits; 131 137 132 dibinfo.dshSection = h andle;138 dibinfo.dshSection = hSection; 133 139 dibinfo.dsOffset = dwOffset; 134 140 … … 136 142 { 137 143 dibinfo.dsBitfields[0] = dibinfo.dsBitfields[1] = dibinfo.dsBitfields[2] = 0; 144 if(palsize) { 145 SetDIBColorTable(0, (1 << pbmi->biBitCount), (RGBQUAD *)(pbmi+1)); 146 } 138 147 } 139 148 else { … … 305 314 306 315 dibinfo.dshSection = hSection; 307 dibinfo.dsOffset = 0; // TODO: put the correct value here (if createdibsection with file handle)316 dibinfo.dsOffset = dwOffset; 308 317 309 318 if(coloruse == DIB_PAL_COLORS || pbmi->biBitCount <= 8) … … 377 386 { 378 387 pOS2bmp->argbColor[i].fcOptions = 0; 388 #ifdef DEBUG_PALETTE 379 389 dprintf2(("Index %d : 0x%08X\n",i, *((ULONG*)(&pOS2bmp->argbColor[i])) )); 390 #endif 380 391 } 381 392 … … 547 558 } 548 559 //****************************************************************************** 560 int WIN32API GetDIBits(HDC hdc, HBITMAP hBitmap, UINT uStartScan, UINT cScanLines, 561 void *lpvBits, BITMAPINFO_W * lpbi, UINT uUsage); 562 549 563 //****************************************************************************** 550 564 void DIBSection::sync(HDC hdc, DWORD nYdest, DWORD nDestHeight) … … 555 569 dprintf(("Sync destination dibsection %x (%x)", handle, hdc)); 556 570 571 #if 0 572 BITMAPINFO_W *tmphdr = (BITMAPINFO_W *)malloc(os2bmphdrsize + sizeof(BITMAPINFO_W)); 573 tmphdr->bmiHeader.biSize = sizeof(BITMAPINFOHEADER_W); 574 GetDIBits(hdc, handle, nYdest, nDestHeight, NULL, tmphdr, 0); 575 destBuf = GetDIBObject() + nYdest*dibinfo.dsBm.bmWidthBytes; 576 rc = GetDIBits(hdc, handle, nYdest, nDestHeight, destBuf, tmphdr, 0); 577 #ifdef DEBUG_PALETTE 578 if(rc && tmphdr->bmiHeader.biBitCount <= 8) { 579 for(int i=0;i<(1<<tmphdr->bmiHeader.biBitCount);i++) 580 { 581 dprintf2(("Index %d : 0x%08X\n",i, *((ULONG*)(&tmphdr->bmiColors[i])) )); 582 } 583 } 584 #endif 585 586 #else 557 587 BITMAPINFO2 *tmphdr = (BITMAPINFO2 *)malloc(os2bmphdrsize); 558 588 memcpy(tmphdr, pOS2bmp, os2bmphdrsize); … … 576 606 rc = GpiQueryBitmapBits(hdc, nYdest, nDestHeight, destBuf, 577 607 tmphdr); 578 } 608 #ifdef DEBUG_PALETTE 609 if(rc != GPI_ALTERROR && tmphdr->cBitCount <= 8) { 610 for(int i=0;i<(1<<tmphdr->cBitCount);i++) 611 { 612 dprintf2(("Index %d : 0x%08X\n",i, *((ULONG*)(&tmphdr->argbColor[i])) )); 613 } 614 } 615 #endif 616 } 617 #endif 618 #if 0 579 619 if(dibinfo.dsBitfields[1] == 0x3E0) {//RGB 555? 580 620 dprintf(("DIBSection::sync: convert RGB 565 to RGB 555")); … … 587 627 else RGB565to555((WORD *)destBuf, (WORD *)destBuf, (nDestHeight*dibinfo.dsBm.bmWidthBytes)/sizeof(WORD)); 588 628 } 629 #endif 589 630 free(tmphdr); 590 631 if(rc != nDestHeight) { 591 632 DebugInt3(); 592 633 } 634 } 635 //****************************************************************************** 636 //manual sync if no stretching and bpp is the same 637 //WARNING: this also assumes the colortables are the same 638 //****************************************************************************** 639 void DIBSection::sync(DWORD xDst, DWORD yDst, DWORD widthDst, DWORD heightDst, PVOID bits) 640 { 641 char *srcbuf, *destbuf; 642 int linesize; 643 644 srcbuf = (char *)bits + dibinfo.dsBm.bmWidthBytes*yDst + 645 (xDst*dibinfo.dsBm.bmWidthBytes)/pOS2bmp->cx; 646 destbuf = (char *)GetDIBObject() + dibinfo.dsBm.bmWidthBytes*yDst + 647 (xDst*dibinfo.dsBm.bmWidthBytes)/pOS2bmp->cx; 648 linesize = (widthDst*dibinfo.dsBm.bmWidthBytes)/pOS2bmp->cx; 649 for(int i=0;i<heightDst;i++) { 650 memcpy(destbuf, srcbuf, linesize); 651 destbuf += dibinfo.dsBm.bmWidthBytes; 652 srcbuf += linesize; 653 } 593 654 } 594 655 //****************************************************************************** -
trunk/src/gdi32/dibsect.h
r3711 r4127 1 /* $Id: dibsect.h,v 1. 19 2000-06-14 18:30:18sandervl Exp $ */1 /* $Id: dibsect.h,v 1.20 2000-08-30 18:05:24 sandervl Exp $ */ 2 2 3 3 /* … … 49 49 } BITMAP_W, *LPBITMAP_W; 50 50 51 typedef struct { 52 BITMAPINFOHEADER_W bmiHeader; 53 RGBQUAD bmiColors[1]; 54 } BITMAPINFO_W; 55 typedef BITMAPINFO *LPBITMAPINFO; 56 51 57 #ifdef OS2_ONLY 52 58 #define DIB_RGB_COLORS 0 … … 76 82 77 83 DWORD GetBitmapHandle() { return handle; }; 84 void SetBitmapHandle(DWORD bmphandle) { handle = bmphandle; }; 78 85 DWORD GetRGBUsage() { return iUsage; }; 79 86 … … 84 91 DWORD Rop); 85 92 void sync(HDC hdc, DWORD nYdest, DWORD nDestHeight); 93 void sync(DWORD xDst, DWORD yDst, DWORD widthDst, DWORD heightDst, PVOID bits); 86 94 int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb); 87 95 … … 100 108 private: 101 109 DWORD handle, iUsage; 102 DWORD hSection ;110 DWORD hSection, dwOffset; 103 111 HWND hwndParent; 104 112 HDC hdc; -
trunk/src/gdi32/palette.cpp
r4034 r4127 1 /* $Id: palette.cpp,v 1. 6 2000-08-18 18:14:58sandervl Exp $ */1 /* $Id: palette.cpp,v 1.7 2000-08-30 18:05:25 sandervl Exp $ */ 2 2 3 3 /* … … 66 66 HPALETTE rc; 67 67 68 #ifdef DEBUG_PALETTE 68 69 for(int i=0; i<arg1->palNumEntries;i++) 69 70 { 70 71 dprintf2(("Index %d : 0x%08X\n",i, *((DWORD*)(&arg1->palPalEntry[i])) )); 71 72 } 73 #endif 72 74 rc = O32_CreatePalette(arg1); 73 75 dprintf(("GDI32: CreatePalette %x %d returns 0x%08X\n", arg1, arg1->palNumEntries, rc));
Note:
See TracChangeset
for help on using the changeset viewer.