- Timestamp:
- Aug 5, 1999, 9:23:04 PM (26 years ago)
- Location:
- trunk/src/ddraw
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/OS2DDRAW.CPP
r416 r423 126 126 } 127 127 128 ULONG rc = DiveOpen(&hDive, FALSE, &pFrameBuffer); 128 ULONG rc = DiveOpen( &hDive, 129 FALSE, 130 &pFrameBuffer); 129 131 if(rc) 130 132 { … … 135 137 else 136 138 { 137 rc = DiveQueryCaps(&dCaps,DIVE_BUFFER_SCREEN); 139 WriteLog("DiveOpen OK\n"); 140 rc = DiveQueryCaps( &dCaps, 141 DIVE_BUFFER_SCREEN); 138 142 } 139 143 -
trunk/src/ddraw/OS2SURFACE.CPP
r416 r423 359 359 if( surfaceType & DDSCAPS_PRIMARYSURFACE) 360 360 { 361 if( lpDraw->HasPrimarySurface())362 {363 lastError = DDERR_PRIMARYSURFACEALREADYEXISTS;364 return;365 }366 367 361 #ifdef DEBUG 368 362 WriteLog("Primary surface!\n"); 369 363 #endif 364 365 if( lpDraw->HasPrimarySurface()) 366 { 367 #ifdef DEBUG 368 WriteLog("Primary surface already exits!\n"); 369 #endif 370 lastError = DDERR_PRIMARYSURFACEALREADYEXISTS; 371 return; 372 } 373 370 374 if( (lpDDSurfaceDesc->dwFlags & DDSD_HEIGHT) || 371 375 (lpDDSurfaceDesc->dwFlags & DDSD_WIDTH) || … … 563 567 DWORD dwBpp; 564 568 DWORD dwCaps; 569 WriteLog( " Requested Size %dx%d\n", 570 DDSurfaceDesc.dwWidth, 571 DDSurfaceDesc.dwHeight); 572 565 573 if(DDSurfaceDesc.dwFlags & DDSD_PIXELFORMAT) // Pixelformat passed in ? 566 574 { 575 WriteLog(" Pixelformat requested :"); 567 576 // YES use it 568 577 if(DDSurfaceDesc.ddpfPixelFormat.dwFlags & DDPF_RGB) … … 579 588 } 580 589 else 590 { 591 WriteLog(" Use Screen Format :"); 581 592 dwBpp = dwBytesPPDive << 3; // No use Screenformat 593 lpDDSurfaceDesc->ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); 594 lpDDSurfaceDesc->ddpfPixelFormat.dwFourCC = (DWORD) lpDraw->GetScreenFourCC(); 595 lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount = dwBpp; 596 DDSurfaceDesc.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); 597 DDSurfaceDesc.ddpfPixelFormat.dwFourCC = (DWORD) lpDraw->GetScreenFourCC(); 598 DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount = dwBpp; 599 switch(DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount) 600 { 601 case 4: 602 lpDDSurfaceDesc->ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED4 | DDPF_RGB; 603 DDSurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED4 | DDPF_RGB; 604 break; 605 case 8: 606 lpDDSurfaceDesc->ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_FOURCC | DDPF_RGB; 607 DDSurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_FOURCC | DDPF_RGB; 608 break; 609 case 16: 610 lpDDSurfaceDesc->ddpfPixelFormat.dwFlags = DDPF_FOURCC | DDPF_RGB; 611 lpDDSurfaceDesc->ddpfPixelFormat.dwRBitMask = 0x0000F800; 612 lpDDSurfaceDesc->ddpfPixelFormat.dwGBitMask = 0x000007E0; 613 lpDDSurfaceDesc->ddpfPixelFormat.dwBBitMask = 0x0000001F; 614 DDSurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_FOURCC | DDPF_RGB; 615 DDSurfaceDesc.ddpfPixelFormat.dwRBitMask = 0x0000F800; 616 DDSurfaceDesc.ddpfPixelFormat.dwGBitMask = 0x000007E0; 617 DDSurfaceDesc.ddpfPixelFormat.dwBBitMask = 0x0000001F; 618 break; 619 case 24: 620 case 32: 621 lpDDSurfaceDesc->ddpfPixelFormat.dwFlags = DDPF_FOURCC | DDPF_RGB; 622 lpDDSurfaceDesc->ddpfPixelFormat.dwRBitMask = 0x00FF0000; 623 lpDDSurfaceDesc->ddpfPixelFormat.dwGBitMask = 0x0000FF00; 624 lpDDSurfaceDesc->ddpfPixelFormat.dwBBitMask = 0x000000FF; 625 DDSurfaceDesc.ddpfPixelFormat.dwFlags = DDPF_FOURCC | DDPF_RGB; 626 DDSurfaceDesc.ddpfPixelFormat.dwRBitMask = 0x00FF0000; 627 DDSurfaceDesc.ddpfPixelFormat.dwGBitMask = 0x0000FF00; 628 DDSurfaceDesc.ddpfPixelFormat.dwBBitMask = 0x000000FF; 629 break; 630 default: 631 // Remove the Pixelformat flag 632 lpDDSurfaceDesc->dwFlags &= ~DDSD_PIXELFORMAT; 633 DDSurfaceDesc.dwFlags &= ~DDSD_PIXELFORMAT; 634 #ifdef DEBUG 635 WriteLog("Unexpected BitDepth : %d\n",lpDraw->GetScreenBpp()); 636 #endif 637 break; 638 } // end switch 639 640 } 641 642 WriteLog("%d Bits\n",dwBpp); 582 643 583 644 // three possible situaltions … … 593 654 // 1. 594 655 656 WriteLog(" Usersupplied Surface\n"); 657 595 658 if(NULL==DDSurfaceDesc.lpSurface) 596 659 { … … 611 674 dwPitchFB = DDSurfaceDesc.lPitch; 612 675 613 if( (lpDraw->dCaps.ulDepth )== dwBpp )676 if( lpDraw->dCaps.ulDepth == dwBpp ) 614 677 { 615 678 // Yes No Colorconversion is needed so point to the same buffer … … 642 705 { 643 706 // 2. 707 708 WriteLog(" Alloc on Load Texture?!\n"); 644 709 645 710 dwCaps &= ~DDSCAPS_ALLOCONLOAD; // remove flag … … 667 732 // 3. 668 733 734 WriteLog(" Alloc now!\n"); 735 669 736 lpDDSurfaceDesc->dwFlags |= DDSD_PITCH|DDSD_LPSURFACE; 670 737 DDSurfaceDesc.dwFlags = lpDDSurfaceDesc->dwFlags; … … 696 763 pFrameBuffer = (char*)(((int)pFBreal + 7) & ~7); // align to QWORD 697 764 765 WriteLog( " Framebuffer @ %08X QWAligned @ %08X with a Pitch of %d", 766 pFBreal, pFrameBuffer, dwPitchFB); 767 698 768 lpDDSurfaceDesc->lpSurface = pFrameBuffer; 699 769 DDSurfaceDesc.lpSurface = pFrameBuffer; 700 770 701 if(Mainchain)702 {703 // This surface is part of flipchain with the primary surface use dive to alloc704 diveBufNr = 0;705 DiveAllocImageBuffer( hDive,706 &diveBufNr,707 lpDraw->dCaps.fccColorEncoding,708 lpDDSurfaceDesc->dwWidth,709 lpDDSurfaceDesc->dwHeight,710 (lpDDSurfaceDesc->dwWidth * (lpDraw->dCaps.ulDepth/8) +7) & ~7,711 (PBYTE)pDiveBuffer);712 }713 771 714 772 if( (lpDraw->dCaps.ulDepth ) == dwBpp ) 715 773 { 774 WriteLog(" No CC_Buffer needed\n"); 716 775 // Yes => No Colorconversion is needed so point to the same buffer 717 776 pDiveBuffer = pFrameBuffer; … … 719 778 else 720 779 { 721 // No so we must create the Divebuffer to do the colortranslation 722 // and blit to the real framebuffer on Unlock to do color conversion 723 pDiveBuffer = (char*)malloc( lpDDSurfaceDesc->dwHeight * 724 ((lpDDSurfaceDesc->dwWidth * (lpDraw->dCaps.ulDepth/8) +7) & ~7) ); 725 780 WriteLog(" Alloc CCBuf "); 781 if(Mainchain) 782 { 783 WriteLog("with DIVE\n"); 784 // This surface is part of flipchain with the primary surface use dive to alloc 785 diveBufNr = 0; 786 DiveAllocImageBuffer( hDive, 787 &diveBufNr, 788 lpDraw->dCaps.fccColorEncoding, 789 lpDDSurfaceDesc->dwWidth, 790 lpDDSurfaceDesc->dwHeight, 791 (lpDDSurfaceDesc->dwWidth * (lpDraw->dCaps.ulDepth/8) +7) & ~7, 792 (PBYTE)pDiveBuffer); 793 } 794 else 795 { 796 WriteLog("with malloc"); 797 // No so we must create the Divebuffer to do the colortranslation 798 // and blit to the real framebuffer on Unlock to do color conversion 799 pDiveBuffer = (char*)malloc( lpDDSurfaceDesc->dwHeight * 800 ((lpDDSurfaceDesc->dwWidth * (lpDraw->dCaps.ulDepth/8) +7) & ~7) ); 801 } 726 802 } 727 803 … … 821 897 } // Endif DDCAPS is valid 822 898 else 899 { 900 WriteLog("CAPS not valid\n"); 823 901 lastError = DDERR_INVALIDPARAMS; 824 902 } 825 903 #ifdef DEBUG 826 904 WriteLog("Buf %X Screen Caps (%d,%d), bitcount %d\n\n", this, lpDraw->GetScreenHeight(), lpDraw->GetScreenWidth(),
Note:
See TracChangeset
for help on using the changeset viewer.