- Timestamp:
- Nov 14, 1999, 11:16:32 PM (26 years ago)
- Location:
- trunk/src/ddraw
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/OS2DDRAW.CPP
r1568 r1746 17 17 #include <builtin.h> 18 18 #include "cio2.h" 19 19 #include "os2util.h" 20 20 // include with the videomodes we support 21 21 // better would be to get these modes from the card … … 176 176 else 177 177 bScale = FALSE; 178 179 rc = InitIO(); 180 181 if(rc) // try to get IOPL for the thread 182 { 183 dprintf(("DDRAW: No IOPL\n")); 184 } 185 else 186 { 187 dprintf(("DDRAW: IOPL 3!\n")); 188 } 178 189 } 179 190 //****************************************************************************** … … 1558 1569 HRESULT rc; 1559 1570 int rci; 1560 1571 USHORT sel; 1561 1572 dprintf(("DDRAW: WaitForVerticalBlank\n")); 1562 1573 … … 1564 1575 return (DDERR_UNSUPPORTED); 1565 1576 1566 1567 rci = io_init1(); 1568 1577 return DD_OK; 1578 1579 rci = InitIO(); 1569 1580 1570 1581 if(rci) // try to get IOPL for the thread … … 1574 1585 } 1575 1586 // AT this point we should have IOPL so lets use it! 1587 dprintf(("DDRAW: IOPL 3!\n")); 1576 1588 1577 1589 rc = DDERR_INVALIDPARAMS; // set returnvalue to fail … … 1579 1591 if(DDWAITVB_BLOCKBEGIN == dwFlags) 1580 1592 { 1593 dprintf(("DDRAW: BLOCKBEGIN\n")); 1594 1581 1595 while ((c_inb1(0x3da)&0x08)!=0); // Wait for end of vert. retrace if one is running 1582 1596 while ((c_inb1(0x3da)&0x08)==0); // Wait for new start of retrace … … 1586 1600 if(DDWAITVB_BLOCKEND == dwFlags) 1587 1601 { 1602 dprintf(("DDRAW: BLOCKEND\n")); 1588 1603 rc = DD_OK; 1589 1604 if((c_inb1(0x3da)&0x08)!=0) // Are we in a vert. retrace -
trunk/src/ddraw/OS2SURFACE.CPP
r1568 r1746 16 16 #include <misc.h> 17 17 #include "asmutil.h" 18 #include "bltFunc.h" 18 19 #include <winerror.h> 19 20 #include <os2win.h> … … 520 521 pFrameBuffer(NULL),Updated(FALSE), 521 522 fOverlayValid(FALSE), 522 BackBuffer(NULL),FrontBuffer(NULL) 523 BackBuffer(NULL),FrontBuffer(NULL), 524 pDBreal(NULL),pFBreal(NULL) 523 525 524 526 { … … 722 724 } 723 725 726 switch(lpDraw->GetScreenBpp()) 727 { 728 case 8: 729 switch(lpDraw->dCaps.ulDepth) 730 { 731 case 8: 732 BltSolid = &BltSolid8to8; 733 break; 734 case 16: 735 BltSolid = &BltSolid8to16; 736 break; 737 case 24: 738 BltSolid = &BltSolid8to24; 739 break; 740 case 32: 741 BltSolid = &BltSolid8to32; 742 break; 743 default: 744 dprintf(("DDRAW: Unsupported System ColorDeapth %d",lpDraw->dCaps.ulDepth)); 745 BltSolid = NULL; 746 break; 747 } 748 break; 749 case16: 750 switch(lpDraw->dCaps.ulDepth) 751 { 752 case 8: 753 BltSolid = &BltSolid16to8; 754 break; 755 case 16: 756 BltSolid = &BltSolid16to16; 757 break; 758 case 24: 759 BltSolid = &BltSolid16to24; 760 break; 761 case 32: 762 BltSolid = &BltSolid16to32; 763 break; 764 default: 765 dprintf(("DDRAW: Unsupported System ColorDeapth %d",lpDraw->dCaps.ulDepth)); 766 BltSolid = NULL; 767 break; 768 } 769 break; 770 case24: 771 switch(lpDraw->dCaps.ulDepth) 772 { 773 case 8: 774 BltSolid = &BltSolid24to8; 775 break; 776 case 16: 777 BltSolid = &BltSolid24to16; 778 break; 779 case 24: 780 BltSolid = &BltSolid24to24; 781 break; 782 case 32: 783 BltSolid = &BltSolid24to32; 784 break; 785 default: 786 dprintf(("DDRAW: Unsupported System ColorDeapth %d",lpDraw->dCaps.ulDepth)); 787 BltSolid = NULL; 788 break; 789 } 790 break; 791 case32: 792 switch(lpDraw->dCaps.ulDepth) 793 { 794 case 8: 795 BltSolid = &BltSolid32to8; 796 break; 797 case 16: 798 BltSolid = &BltSolid32to16; 799 break; 800 case 24: 801 BltSolid = &BltSolid32to24; 802 break; 803 case 32: 804 BltSolid = &BltSolid32to32; 805 break; 806 default: 807 dprintf(("DDRAW: Unsupported System ColorDeapth %d",lpDraw->dCaps.ulDepth)); 808 BltSolid = NULL; 809 break; 810 } 811 break; 812 default: 813 dprintf(("DDRAW: Unsupported DX ColorDeapth %d",lpDraw->GetScreenBpp())); 814 BltSolid = NULL; 815 break; 816 } 724 817 if( lpDDSurfaceDesc->dwFlags & DDSD_CAPS ) 725 818 { … … 1159 1252 dprintf(("DDRAW: Alloc CCBuf ")); 1160 1253 dwPitchDB = (lpDDSurfaceDesc->dwWidth * (lpDraw->dCaps.ulDepth/8) +7) & ~7; 1254 1161 1255 if(Mainchain) 1162 1256 { 1163 1257 dprintf(("DDRAW: with DIVE\n")); 1164 1258 // This surface is part of flipchain with the primary surface use dive to assoc memory 1165 pDiveBuffer = (char*)malloc( lpDDSurfaceDesc->dwHeight * 1166 dwPitchDB); 1259 pDBreal = (char*)malloc( lpDDSurfaceDesc->dwHeight * 1260 dwPitchDB+24); 1261 pDiveBuffer = (char*)(((int)pDBreal + 7) & ~7); // align to QWORD 1167 1262 diveBufNr = 0; 1168 1263 rc = DiveAllocImageBuffer( hDive, … … 1183 1278 // No so we must create the Divebuffer to do the colortranslation 1184 1279 // and blit to the real framebuffer on Unlock to do color conversion 1185 pDiveBuffer = (char*)malloc( lpDDSurfaceDesc->dwHeight * 1186 dwPitchDB); 1280 pDBreal = (char*)malloc( lpDDSurfaceDesc->dwHeight * 1281 dwPitchDB + 24); 1282 pDiveBuffer = (char*)(((int)pDBreal + 7) & ~7); // align to QWORD 1187 1283 } 1188 1284 dprintf(( " @ %08X\n", pDiveBuffer)); … … 1245 1341 dprintf(("DDRAW: Mipmpa # = %d\n",lpDDSurfaceDesc->dwMipMapCount)); 1246 1342 #endif 1247 memcpy(&ComplexSurfaceDesc,lpDDSurfaceDesc,sizeof(DDSURFACEDESC2)); 1343 memcpy( &ComplexSurfaceDesc, 1344 lpDDSurfaceDesc, 1345 sizeof(DDSURFACEDESC2)); 1248 1346 ComplexSurfaceDesc.dwMipMapCount = 0; 1249 1347 … … 1440 1538 } 1441 1539 1442 return(DD_OK); 1443 1444 #if 0 // rest of old code for resuse/move to a function to get closest syscolor 1445 // for colorconversion modes color fills 1446 else 1447 { 1448 // Yeah! Color conversion needed ;) 1449 #ifdef DEBUG 1450 dprintf(("DDRAW: Color converion ! Urks, may not work \n")); 1451 #endif 1452 1453 switch(dest->lpDraw->dCaps.ulDepth) 1454 { 1455 case 8: // 256 Mode bad thing as programm wants to run in a higher mode might look ugly 1456 GetSystemPaletteEntries(GetDC(HWND_DESKTOP),0,255,&SysPal[1]); 1457 pLogPal->palVersion = 0; 1458 pLogPal->palNumEntries = 256; 1459 1460 hPal = CreatePalette(pLogPal); 1461 if(hPal!=NULL) 1540 if(pDiveBuffer!=pFrameBuffer) 1541 { 1542 dprintf(("DDRAW: CC-Mode Fill FrameBuffer\n")); 1543 1544 if(NULL!=lpDestRect) 1545 { 1546 FillWidth = lpDestRect->right - lpDestRect->left; 1547 FillHeight = lpDestRect->bottom - lpDestRect->top -1; 1548 pLine = pFrameBuffer + 1549 (lpDestRect->top*dwPitchFB) + 1550 (lpDestRect->left*lpDraw->GetScreenBpp()); 1551 } 1552 else 1553 { 1554 FillWidth = width; 1555 FillHeight = height -1; 1556 pLine = pFrameBuffer; 1557 } 1558 1559 // Colorconversion mode we must also fill the other buffer 1560 switch(lpDraw->GetScreenBpp()) 1561 { 1562 case 8: 1563 dprintf(("DDRAW: 8 Bit\n")); 1564 dwColor = (dwFillColor<<24) + (dwFillColor<<16) + 1565 (dwFillColor<<8) + (dwFillColor); 1566 dprintf(("DDRAW: Fill with 0x%08X\n",dwColor)); 1567 for(i=0,pColor = (DWORD*)pLine;i<(FillWidth/4);i++) 1568 pColor[i] = dwColor; 1569 if(FillWidth % 4) 1462 1570 { 1463 if(dest->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount==16) 1464 { 1465 ulColor = ((lpDDBltFx->dwFillColor & 0x0000001F) <<3) + 1466 ((lpDDBltFx->dwFillColor & 0x000007E0) <<5) + 1467 ((lpDDBltFx->dwFillColor & 0x0000F800) <<8); 1468 } 1469 else 1470 ulColor = lpDDBltFx->dwFillColor; 1471 1472 ulColor = GetNearestPaletteIndex(hPal,ulColor); 1473 ulColor = (ulColor & 0x000000FF) + ((ulColor & 0x000000FF) << 8) + 1474 ((ulColor & 0x000000FF) << 16) + ((ulColor & 0x000000FF) << 24); 1571 pFillPos = (char*) (&pColor[i-1]); 1572 for(i=0;i<FillWidth % 4;i++) 1573 pFillPos[i] = (UCHAR) dwColor; 1475 1574 } 1476 else1477 {1478 #ifdef DEBUG1479 dprintf(("DDRAW: Error creating Palette default to 0"));1480 #endif1481 ulColor = 0;1482 }1483 for(i=0,(char*)pColor = ScanLine;i<(FillWidth/4)+1;i++)1484 *(pColor+i) = ulColor;1485 1575 break; 1486 1576 case 16: 1487 if(dest->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount==8) 1577 dprintf(("DDRAW: 16 Bit\n")); 1578 dwColor = (dwFillColor<<16) + (dwFillColor); 1579 dprintf(("DDRAW: Fill with 0x%08X\n",dwColor)); 1580 for(i=0,pColor = (DWORD*)pLine;i<(FillWidth/2);i++) 1581 pColor[i] = dwColor; 1582 if(FillWidth % 2) 1488 1583 { 1489 if(lpDDBltFx->dwFillColor > 255) 1490 return DDERR_INVALIDPARAMS; 1491 1492 if(dest->lpPalette!=NULL) 1493 dest->lpPalette->lpVtbl->GetEntries(dest->lpPalette,0,0,256,(LPPALETTEENTRY)&SysPal); 1494 else 1495 GetSystemPaletteEntries(GetDC(HWND_DESKTOP),0,255,(PPALETTEENTRY)&SysPal); 1496 1497 SysPal[lpDDBltFx->dwFillColor].peBlue >>3; 1498 SysPal[lpDDBltFx->dwFillColor].peGreen >>2; 1499 SysPal[lpDDBltFx->dwFillColor].peRed >>3; 1500 ulColor = ULONG(SysPal[lpDDBltFx->dwFillColor].peRed) << 11 + 1501 ULONG(SysPal[lpDDBltFx->dwFillColor].peGreen) << 5 + 1502 ULONG(SysPal[lpDDBltFx->dwFillColor].peBlue); 1584 pFillPos = (char*)(&pColor[i-1]); 1585 *((USHORT*)pFillPos) = (USHORT)dwColor; 1503 1586 } 1504 else1505 {1506 ulColor = (lpDDBltFx->dwFillColor & 0x000000FF)>>3 +1507 (((lpDDBltFx->dwFillColor & 0x0000FF00)>>5) & 0x000007E0) +1508 (((lpDDBltFx->dwFillColor & 0x00FF0000)>>8) & 0x0000F800);1509 }1510 ulColor += ulColor << 16;1511 for(i=0,(char*)pColor = ScanLine;i<(FillWidth/2)+1;i++)1512 *(pColor+i) = ulColor;1513 1587 break; 1514 1588 case 24: 1515 if(dest->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount==8) 1589 dprintf(("DDRAW: 24 Bit\n")); 1590 dwColor = (dwFillColor<<8); 1591 for(i=0 ; i<FillWidth ; i++) 1516 1592 { 1517 if(lpDDBltFx->dwFillColor > 255) 1518 return DDERR_INVALIDPARAMS; 1519 1520 if(dest->lpPalette!=NULL) 1521 dest->lpPalette->lpVtbl->GetEntries(dest->lpPalette,0,0,256,(LPPALETTEENTRY)&SysPal); 1522 else 1523 GetSystemPaletteEntries(GetDC(HWND_DESKTOP),0,255,(PPALETTEENTRY)&SysPal); 1524 1525 ulColor = ULONG(SysPal[lpDDBltFx->dwFillColor].peRed) <<24 + 1526 ULONG(SysPal[lpDDBltFx->dwFillColor].peGreen) <<16 + 1527 ULONG(SysPal[lpDDBltFx->dwFillColor].peBlue) <<8; 1528 } 1529 else 1530 { 1531 if(dest->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount==16) 1532 { 1533 ulColor = ((lpDDBltFx->dwFillColor & 0x0000001F) <<11) + 1534 ((lpDDBltFx->dwFillColor & 0x000007E0) <<13) + 1535 ((lpDDBltFx->dwFillColor & 0x0000F800) <<18); 1536 } 1537 else 1538 ulColor = lpDDBltFx->dwFillColor << 8 ; 1539 } 1540 1541 for(i=0;i<FillWidth;i++) 1542 { 1543 char* pColor = (char*)Scanline+(i*3); 1544 *pColor = ulColor; 1593 char* pColor = (char*)pLine+(i*3); 1594 *pColor = dwColor; 1545 1595 } 1546 1596 break; 1547 1597 case 32: 1548 if(dest->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount==8) 1549 { 1550 if(lpDDBltFx->dwFillColor > 255) 1551 return DDERR_INVALIDPARAMS; 1552 1553 if(dest->lpPalette!=NULL) 1554 dest->lpPalette->lpVtbl->GetEntries(dest->lpPalette,0,0,256,(LPPALETTEENTRY)&SysPal); 1555 else 1556 GetSystemPaletteEntries(GetDC(HWND_DESKTOP),0,255,(PPALETTEENTRY)&SysPal); 1557 1558 ulColor = ULONG(SysPal[lpDDBltFx->dwFillColor].peRed) <<16 + 1559 ULONG(SysPal[lpDDBltFx->dwFillColor].peGreen) <<8 + 1560 ULONG(SysPal[lpDDBltFx->dwFillColor].peBlue); 1561 } 1562 else 1563 { 1564 if(dest->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount==16) 1565 { 1566 ulColor = ((lpDDBltFx->dwFillColor & 0x0000001F) <<3) + 1567 ((lpDDBltFx->dwFillColor & 0x000007E0) <<5) + 1568 ((lpDDBltFx->dwFillColor & 0x0000F800) <<8); 1569 } 1570 else 1571 ulColor = lpDDBltFx->dwFillColor & 0x00FFFFFF; 1572 } 1573 1574 for(i=0,(char*)pColor = ScanLine;i<(FillWidth/4);i++) 1575 *(pColor+i) = ulColor; 1576 break; 1577 default: 1578 #ifdef DEBUG 1579 dprintf(("DDRAW: Unexpected Bitdepth\n")); 1580 #endif 1581 return DDERR_GENERIC; 1582 } // end switch (dest->lpDraw->dCaps.ulDepth) 1583 }// end of Scanline setup 1584 #endif 1585 1598 dprintf(("DDRAW: 32 Bit\n")); 1599 dwColor = dwFillColor; 1600 for(i=0,pColor = (DWORD*)pLine;i<FillWidth;i++) 1601 pColor[i] = dwColor; 1602 } 1603 1604 pFillPos = pLine + dwPitchFB; 1605 FillWidth = FillWidth*lpDraw->GetScreenBpp(); 1606 for( y=0;y<FillHeight;y++,pFillPos+=dwPitchFB) 1607 { 1608 #ifdef USE_ASM 1609 // ToDo get the loop into an asm function as well to speed up filling 1610 // maybe remove the creation of the first fill line in an all asm 1611 // function and use MMX regs to set 8 bytes 1612 MemFlip(pFillPos,pLine,FillWidth); 1613 #else 1614 memcpy(pFillPos,pLine,FillWidth); 1615 #endif 1616 } 1617 } 1618 1619 return(DD_OK); 1586 1620 } 1587 1621 //****************************************************************************** … … 1813 1847 if(lpPalette) 1814 1848 lpPalette->RestorePhysPalette(); 1849 1815 1850 } 1816 1851 else … … 1821 1856 DiveEndImageBufferAccess(hDive, diveBufNr); 1822 1857 DiveFreeImageBuffer(hDive, diveBufNr); 1823 } 1824 else 1825 { 1826 // Memory Surfaces 1827 if (!Updated) // check for user handled buffer 1828 free(DDSurfaceDesc.lpSurface); 1829 } 1830 1858 1859 } 1831 1860 1832 1861 fLocked = FALSE; 1833 1862 diveBufNr = -1; 1834 1863 } 1835 1836 // Free the translation buffer 1837 if(pFrameBuffer != pDiveBuffer) 1838 free(pDiveBuffer); 1864 // Free Buffers if they have been allocated 1865 // DIVE Buffer 1866 1867 if(NULL!=pDBreal) 1868 free(pDBreal); 1869 1870 // FrameBuffer 1871 1872 if(NULL!=pFBreal) 1873 free(pFBreal); 1839 1874 1840 1875 // Clear the list of locked rectangles … … 2646 2681 dest->dwBytesPPDive, 2647 2682 dest->dwPitchDB); 2683 // MoveRects in framebuufer if we use colorconversion 2684 if(dest->pFrameBuffer != dest->pDiveBuffer) 2685 { 2686 MoveRects( dest->pFrameBuffer, 2687 (LPRECT)&DestRect, 2688 (LPRECT)&SrcRect, 2689 dest->lpDraw->GetScreenBpp()>>3, 2690 dest->dwPitchFB); 2691 } 2648 2692 2649 2693 // End of Special Type 1 blitting on the screen … … 2670 2714 // Type 2 Sysmem to Primarysurface ca also be handled by this 2671 2715 2672 pBltPos = (char*) dest->pDiveBuffer + (DestRect.top * dest->dwPitchDB) +2673 (DestRect.left * dest->dwBytesPPDive);2674 2675 pSrcPos = (char*) src->pDiveBuffer + (SrcRect.top * src->dwPitchDB) +2676 (SrcRect.left * src->dwBytesPPDive);2677 2678 BlitHeight = pIRectDest->height();2679 BlitWidth = pIRectDest->width();2680 2681 2716 if(!dwFlags) 2682 2717 { 2683 2718 dprintf(("DDRAW: Solid Blit\n")); 2684 2719 2685 BlitWidth *= dest->dwBytesPPDive; 2686 2687 #ifdef USE_ASM 2688 BltRec(pBltPos, pSrcPos, BlitWidth, BlitHeight, 2689 dest->dwPitchDB, 2690 src->dwPitchDB); 2691 #else 2692 // Solid Blit 2693 while(1) 2694 { 2695 memcpy(pBltPos,pSrcPos,BlitWidth); 2696 pBltPos += dest->dwPitchDB; 2697 pSrcPos += src->dwPitchDB; 2698 if(! (--BlitHeight)) 2699 break; 2700 } 2701 #endif 2702 2703 if(dest->pFrameBuffer != dest->pDiveBuffer) 2704 { 2705 // Copy Framebuffer also ... 2706 pBltPos = (char*) dest->pFrameBuffer + (DestRect.top * dest->dwPitchFB) + 2707 (DestRect.left * dest->lpDraw->GetScreenBpp()); 2708 2709 pSrcPos = (char*) src->pFrameBuffer + (SrcRect.top * src->dwPitchFB) + 2710 (SrcRect.left * dest->lpDraw->GetScreenBpp()); 2711 2712 BlitHeight = pIRectDest->height(); 2713 BlitWidth = pIRectDest->width(); 2714 BlitWidth *= dest->lpDraw->GetScreenBpp(); 2715 2716 #ifdef USE_ASM 2717 BltRec(pBltPos, pSrcPos, BlitWidth, BlitHeight, 2718 dest->dwPitchDB, 2719 src->dwPitchDB); 2720 #else 2721 // Solid Blit 2722 while(1) 2723 { 2724 memcpy(pBltPos,pSrcPos,BlitWidth); 2725 pBltPos += dest->dwPitchFB; 2726 pSrcPos += src->dwPitchFB; 2727 if(! (--BlitHeight)) 2728 break; 2729 } 2730 #endif 2731 } 2720 dest->BltSolid( dest->pDiveBuffer, 2721 dest->pFrameBuffer, 2722 DestRect.top, 2723 DestRect.left, 2724 dest->dwPitchDB, 2725 dest->dwPitchFB, 2726 src->pDiveBuffer, 2727 src->pFrameBuffer, 2728 SrcRect.top, 2729 SrcRect.left, 2730 pIRectDest->width(), 2731 pIRectDest->height(), 2732 src->dwPitchDB, 2733 src->dwPitchFB 2734 ); 2735 2732 2736 } 2733 2737 else 2734 2738 { 2739 pBltPos = (char*) dest->pDiveBuffer + (DestRect.top * dest->dwPitchDB) + 2740 (DestRect.left * dest->dwBytesPPDive); 2741 2742 pSrcPos = (char*) src->pDiveBuffer + (SrcRect.top * src->dwPitchDB) + 2743 (SrcRect.left * src->dwBytesPPDive); 2744 2745 BlitHeight = pIRectDest->height(); 2746 BlitWidth = pIRectDest->width(); 2735 2747 // Transparent Blit 2736 2748 if( (dwFlags &DDBLT_KEYSRC) || (dwFlags & DDBLT_KEYSRCOVERRIDE) ) … … 2775 2787 if(!dwFlags) 2776 2788 { 2777 BlitWidth *= dest->dwBytesPPDive; 2778 2779 #ifdef USE_ASM 2780 BltRec(pBltPos, pSrcPos, BlitWidth, BlitHeight, 2781 dest->dwPitchDB, 2782 src->dwPitchDB); 2783 #else 2784 // Solid Blit 2785 while(1) 2786 { 2787 memcpy(pBltPos,pSrcPos,BlitWidth); 2788 pBltPos += dest->dwPitchDB; 2789 pSrcPos += src->dwPitchDB; 2790 if(! (--BlitHeight)) 2791 break; 2792 } 2793 #endif 2789 dest->BltSolid( dest->pDiveBuffer, 2790 dest->pFrameBuffer, 2791 DestRect.top, 2792 DestRect.left, 2793 dest->dwPitchDB, 2794 dest->dwPitchFB, 2795 src->pDiveBuffer, 2796 src->pFrameBuffer, 2797 SrcRect.top, 2798 SrcRect.left, 2799 pIRectDest->width(), 2800 pIRectDest->height(), 2801 src->dwPitchDB, 2802 src->dwPitchFB 2803 ); 2794 2804 } 2795 2805 else … … 2831 2841 dest->dwPitchDB); 2832 2842 2843 // MoveRects in framebuufer if we use colorconversion 2844 if(dest->pFrameBuffer != dest->pDiveBuffer) 2845 { 2846 MoveRects( dest->pFrameBuffer, 2847 (LPRECT)&DestRect, 2848 (LPRECT)&SrcRect, 2849 dest->lpDraw->GetScreenBpp()>>3, 2850 dest->dwPitchFB); 2851 } 2833 2852 return DD_OK; 2834 2853 } 2835 2836 pBltPos = (char*) dest->pDiveBuffer + (DestRect.top * dest->dwPitchDB) +2837 (DestRect.left * dest->dwBytesPPDive);2838 2839 pSrcPos = (char*) src->pDiveBuffer + (SrcRect.top * src->dwPitchDB) +2840 (SrcRect.left * src->dwBytesPPDive);2841 2842 BlitHeight = pIRectDest->height();2843 BlitWidth = pIRectDest->width();2844 2854 2845 2855 // Check for transparent blit 2846 2856 if(!dwFlags) 2847 2857 { 2848 BlitWidth *= dest->dwBytesPPDive; 2849 2850 #ifdef USE_ASM 2851 BltRec(pBltPos, pSrcPos, BlitWidth, BlitHeight, 2852 dest->dwPitchDB, 2853 src->dwPitchDB); 2854 #else 2855 // Solid Blit 2856 while(1) 2857 { 2858 memcpy(pBltPos,pSrcPos,BlitWidth); 2859 pBltPos += dest->dwPitchDB; 2860 pSrcPos += src->dwPitchDB; 2861 if(! (--BlitHeight)) 2862 break; 2863 } 2864 #endif 2858 dest->BltSolid( dest->pDiveBuffer, 2859 dest->pFrameBuffer, 2860 DestRect.top, 2861 DestRect.left, 2862 dest->dwPitchDB, 2863 dest->dwPitchFB, 2864 src->pDiveBuffer, 2865 src->pFrameBuffer, 2866 SrcRect.top, 2867 SrcRect.left, 2868 pIRectDest->width(), 2869 pIRectDest->height(), 2870 src->dwPitchDB, 2871 src->dwPitchFB 2872 ); 2865 2873 } 2866 2874 else 2867 2875 { 2876 pBltPos = (char*) dest->pDiveBuffer + (DestRect.top * dest->dwPitchDB) + 2877 (DestRect.left * dest->dwBytesPPDive); 2878 2879 pSrcPos = (char*) src->pDiveBuffer + (SrcRect.top * src->dwPitchDB) + 2880 (SrcRect.left * src->dwBytesPPDive); 2881 2882 BlitHeight = pIRectDest->height(); 2883 BlitWidth = pIRectDest->width(); 2868 2884 DWORD dwPitch = dest->dwPitchDB; 2869 2885 … … 5469 5485 // free our allocated Memory 5470 5486 if(me->DDSurfaceDesc.dwFlags & DDSD_LPSURFACE) 5471 free(me->DDSurfaceDesc.lpSurface); 5487 { 5488 if(me->pFBreal) 5489 free(me->pFBreal); 5490 if(me->pDBreal) 5491 free(me->pFBreal); 5492 } 5472 5493 } 5473 5494 // me->lpVtbl->ChangeUniquenessValue(me); 5474 memcpy((char *)&(me->DDSurfaceDesc), (char *)lpSurfDesc, sizeof(DDSURFACEDESC)); 5475 5495 memcpy( (char*)&(me->DDSurfaceDesc), 5496 (char*)lpSurfDesc, 5497 sizeof(DDSURFACEDESC)); 5498 5499 me->dwPitchFB = me->DDSurfaceDesc.lPitch; 5500 5501 if( me->lpDraw->dCaps.ulDepth != me->lpDraw->GetScreenBpp() ) 5502 { 5503 // create CC buffer .... 5504 me->dwPitchDB = (me->DDSurfaceDesc.dwWidth * me->dwBytesPPDive +7) & ~7; 5505 me->pDBreal = (char*)malloc( me->DDSurfaceDesc.dwHeight * me->dwPitchDB + 24); 5506 me->pDiveBuffer = (char*)(((int)me->pDBreal + 7) & ~7); // align to QWORD 5507 } 5476 5508 return DD_OK; 5477 5509 } … … 5499 5531 me->Updated = TRUE; 5500 5532 // free our allocated Memory 5533 // free our allocated Memory 5501 5534 if(me->DDSurfaceDesc.dwFlags & DDSD_LPSURFACE) 5502 free(me->DDSurfaceDesc.lpSurface); 5535 { 5536 if(me->pFBreal) 5537 free(me->pFBreal); 5538 if(me->pDBreal) 5539 free(me->pFBreal); 5540 } 5503 5541 } 5504 5542 // me->lpVtbl->ChangeUniquenessValue(me); 5505 memcpy((char *)&(me->DDSurfaceDesc), (char *)lpSurfDesc, sizeof(DDSURFACEDESC2)); 5543 memcpy( (char *)&(me->DDSurfaceDesc), 5544 (char*)lpSurfDesc, 5545 sizeof(DDSURFACEDESC2)); 5546 me->dwPitchFB = me->DDSurfaceDesc.lPitch; 5547 5548 if( me->lpDraw->dCaps.ulDepth != me->lpDraw->GetScreenBpp() ) 5549 { 5550 // create CC buffer .... 5551 me->dwPitchDB = (me->DDSurfaceDesc.dwWidth * me->dwBytesPPDive +7) & ~7; 5552 me->pDBreal = (char*)malloc( me->DDSurfaceDesc.dwHeight * me->dwPitchDB + 24); 5553 me->pDiveBuffer = (char*)(((int)me->pDBreal + 7) & ~7); // align to QWORD 5554 } 5506 5555 5507 5556 return DD_OK; … … 5861 5910 return (DD_OK); 5862 5911 } 5912 5913 5863 5914 5864 5915 //****************************************************************************** -
trunk/src/ddraw/OS2SURFACE.H
r1562 r1746 53 53 private: 54 54 HRESULT ColorFill(LPRECT, DWORD); 55 void (__cdecl *BltSolid)( char *pDBDst, 56 char *pFBDst, 57 DWORD dwDstTop, 58 DWORD dwDstLeft, 59 DWORD dwPitchDBDst, 60 DWORD dwPitchFBDst, 61 char *pDBSrc, 62 char *pFBSrc, 63 DWORD dwSrcTop, 64 DWORD dwSrcLeft, 65 DWORD dwWidth, 66 DWORD dwHeight, 67 DWORD dwPitchDBSrc, 68 DWORD dwPitchFBSrc 69 ); 55 70 protected: 56 71 HRESULT lastError; -
trunk/src/ddraw/OS2UTIL.CPP
r1568 r1746 1 /* $Id: OS2UTIL.CPP,v 1. 7 1999-11-02 22:41:23hugh Exp $ */1 /* $Id: OS2UTIL.CPP,v 1.8 1999-11-14 22:16:32 hugh Exp $ */ 2 2 3 3 /* … … 10 10 */ 11 11 #define INCL_DOSMEMMGR 12 #define INCL_DOSDEVICES 12 13 #include <os2wrap.h> 13 14 #include <misc.h> 14 15 #include "os2util.h" 15 16 #include "cio2.h" 16 17 17 18 //****************************************************************************** … … 45 46 WinSetWindowPos(hwndClient, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE); 46 47 } 48 //****************************************************************************** 49 //****************************************************************************** 47 50 51 int InitIO() 52 { 53 WORD gdt; 54 HRESULT rc; 55 HFILE device; 56 ULONG ulAction; 57 58 rc = DosOpen( "\\dev\\fastio$", 59 &device, 60 &ulAction, 61 0,0,1, 62 OPEN_ACCESS_READWRITE|OPEN_SHARE_DENYNONE, 63 0); 64 if(rc) 65 return rc; 66 67 rc = DosDevIOCtl( device, 118, 100, 0,0,0,&gdt,2,&ulAction); 68 69 DosClose(device); 70 71 if(rc) 72 { 73 return rc; 74 } 75 76 io_init2(gdt); 77 78 return 0; 79 } 80 -
trunk/src/ddraw/OS2UTIL.H
r97 r1746 1 /* $Id: OS2UTIL.H,v 1. 3 1999-06-10 17:10:57 phallerExp $ */1 /* $Id: OS2UTIL.H,v 1.4 1999-11-14 22:16:32 hugh Exp $ */ 2 2 3 3 /* … … 15 15 void OS2FreeMem(char *lpMem); 16 16 void OS2MaximizeWindow(HWND hwndClient); 17 17 int InitIO(); 18 18 #endif -
trunk/src/ddraw/cio2.h
r211 r1746 11 11 { 12 12 int io_init1(); 13 int io_init2(short); 13 14 int io_exit1(); 14 15 -
trunk/src/ddraw/makefile
r1585 r1746 19 19 20 20 OBJS = ddraw.obj os2ddraw.obj os2clipper.obj os2d3d.obj iccio1.obj asmutil.obj\ 21 os2surface.obj os2palette.obj os2palset.obj rectangle.obj initterm.obj 21 os2surface.obj os2palette.obj os2palset.obj rectangle.obj initterm.obj \ 22 os2util.obj bltFunc.obj 22 23 23 24 … … 84 85 initterm.obj: initterm.cpp initterm.h 85 86 87 os2util.obj: os2util.cpp os2util.h 88 89 bltFunc.obj: bltFunc.cpp bltFunc.h \ 90 $(PDWIN32_INCLUDE)\misc.h 91 92 iccio1.obj: iccio1.asm 93 94 asmutil.obj: asmutil.asm 95 86 96 clean: 87 97 $(RM) *.obj *.lib *.dll *.map *.pch
Note:
See TracChangeset
for help on using the changeset viewer.