Changeset 1746 for trunk/src


Ignore:
Timestamp:
Nov 14, 1999, 11:16:32 PM (26 years ago)
Author:
hugh
Message:

Fixes to let RA run

Location:
trunk/src/ddraw
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ddraw/OS2DDRAW.CPP

    r1568 r1746  
    1717#include <builtin.h>
    1818#include "cio2.h"
    19 
     19#include "os2util.h"
    2020// include with the videomodes we support
    2121// better would be to get these modes from the card
     
    176176  else
    177177    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  }
    178189}
    179190//******************************************************************************
     
    15581569  HRESULT rc;
    15591570  int rci;
    1560 
     1571  USHORT sel;
    15611572  dprintf(("DDRAW: WaitForVerticalBlank\n"));
    15621573
     
    15641575    return (DDERR_UNSUPPORTED);
    15651576
    1566 
    1567   rci = io_init1();
    1568 
     1577  return DD_OK;
     1578
     1579  rci = InitIO();
    15691580
    15701581  if(rci)  // try to get IOPL for the thread
     
    15741585  }
    15751586  // AT this point we should have IOPL so lets use it!
     1587  dprintf(("DDRAW: IOPL 3!\n"));
    15761588
    15771589  rc = DDERR_INVALIDPARAMS; // set returnvalue to fail
     
    15791591  if(DDWAITVB_BLOCKBEGIN == dwFlags)
    15801592  {
     1593    dprintf(("DDRAW: BLOCKBEGIN\n"));
     1594
    15811595    while ((c_inb1(0x3da)&0x08)!=0); // Wait for end of vert. retrace if one is running
    15821596    while ((c_inb1(0x3da)&0x08)==0); // Wait for new start of retrace
     
    15861600  if(DDWAITVB_BLOCKEND == dwFlags)
    15871601  {
     1602    dprintf(("DDRAW: BLOCKEND\n"));
    15881603    rc = DD_OK;
    15891604    if((c_inb1(0x3da)&0x08)!=0)        // Are we in a vert. retrace
  • trunk/src/ddraw/OS2SURFACE.CPP

    r1568 r1746  
    1616#include <misc.h>
    1717#include "asmutil.h"
     18#include "bltFunc.h"
    1819#include <winerror.h>
    1920#include <os2win.h>
     
    520521                 pFrameBuffer(NULL),Updated(FALSE),
    521522                 fOverlayValid(FALSE),
    522                  BackBuffer(NULL),FrontBuffer(NULL)
     523                 BackBuffer(NULL),FrontBuffer(NULL),
     524                 pDBreal(NULL),pFBreal(NULL)
    523525
    524526{
     
    722724  }
    723725
     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  }
    724817  if( lpDDSurfaceDesc->dwFlags & DDSD_CAPS )
    725818  {
     
    11591252            dprintf(("DDRAW:  Alloc CCBuf "));
    11601253            dwPitchDB = (lpDDSurfaceDesc->dwWidth * (lpDraw->dCaps.ulDepth/8) +7) & ~7;
     1254
    11611255            if(Mainchain)
    11621256            {
    11631257              dprintf(("DDRAW: with DIVE\n"));
    11641258              // 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
    11671262              diveBufNr = 0;
    11681263              rc = DiveAllocImageBuffer( hDive,
     
    11831278              // No so we must create the Divebuffer to do the colortranslation
    11841279              // 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
    11871283            }
    11881284            dprintf(( " @ %08X\n", pDiveBuffer));
     
    12451341            dprintf(("DDRAW: Mipmpa # = %d\n",lpDDSurfaceDesc->dwMipMapCount));
    12461342          #endif
    1247           memcpy(&ComplexSurfaceDesc,lpDDSurfaceDesc,sizeof(DDSURFACEDESC2));
     1343          memcpy( &ComplexSurfaceDesc,
     1344                  lpDDSurfaceDesc,
     1345                  sizeof(DDSURFACEDESC2));
    12481346          ComplexSurfaceDesc.dwMipMapCount = 0;
    12491347
     
    14401538  }
    14411539
    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)
    14621570        {
    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;
    14751574        }
    1476         else
    1477         {
    1478           #ifdef DEBUG
    1479             dprintf(("DDRAW: Error creating Palette default to 0"));
    1480           #endif
    1481           ulColor = 0;
    1482         }
    1483         for(i=0,(char*)pColor = ScanLine;i<(FillWidth/4)+1;i++)
    1484            *(pColor+i) = ulColor;
    14851575        break;
    14861576      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)
    14881583        {
    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;
    15031586        }
    1504         else
    1505         {
    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;
    15131587        break;
    15141588      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++)
    15161592        {
    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;
    15451595        }
    15461596        break;
    15471597      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);
    15861620}
    15871621//******************************************************************************
     
    18131847    if(lpPalette)
    18141848      lpPalette->RestorePhysPalette();
     1849
    18151850  }
    18161851  else
     
    18211856        DiveEndImageBufferAccess(hDive, diveBufNr);
    18221857      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    }
    18311860
    18321861    fLocked = FALSE;
    18331862    diveBufNr = -1;
    18341863  }
    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);
    18391874
    18401875  // Clear the list of locked rectangles
     
    26462681                 dest->dwBytesPPDive,
    26472682                 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      }
    26482692
    26492693      // End of Special Type 1 blitting on the screen
     
    26702714      // Type 2 Sysmem to Primarysurface ca also be handled by this
    26712715
    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 
    26812716      if(!dwFlags)
    26822717      {
    26832718        dprintf(("DDRAW: Solid Blit\n"));
    26842719
    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
    27322736      }
    27332737      else
    27342738      {
     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();
    27352747        // Transparent Blit
    27362748        if( (dwFlags &DDBLT_KEYSRC) || (dwFlags & DDBLT_KEYSRCOVERRIDE) )
     
    27752787        if(!dwFlags)
    27762788        {
    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                          );
    27942804        }
    27952805        else
     
    28312841                   dest->dwPitchDB);
    28322842
     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        }
    28332852        return DD_OK;
    28342853      }
    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();
    28442854
    28452855      // Check for transparent blit
    28462856      if(!dwFlags)
    28472857      {
    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                        );
    28652873      }
    28662874      else
    28672875      {
     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();
    28682884        DWORD dwPitch = dest->dwPitchDB;
    28692885
     
    54695485    // free our allocated Memory
    54705486    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    }
    54725493  }
    54735494  // 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  }
    54765508  return DD_OK;
    54775509}
     
    54995531    me->Updated = TRUE;
    55005532    // free our allocated Memory
     5533    // free our allocated Memory
    55015534    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    }
    55035541  }
    55045542  // 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  }
    55065555
    55075556  return DD_OK;
     
    58615910  return (DD_OK);
    58625911}
     5912
     5913
    58635914
    58645915//******************************************************************************
  • trunk/src/ddraw/OS2SURFACE.H

    r1562 r1746  
    5353 private:
    5454        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                               );
    5570 protected:
    5671        HRESULT                lastError;
  • trunk/src/ddraw/OS2UTIL.CPP

    r1568 r1746  
    1 /* $Id: OS2UTIL.CPP,v 1.7 1999-11-02 22:41:23 hugh Exp $ */
     1/* $Id: OS2UTIL.CPP,v 1.8 1999-11-14 22:16:32 hugh Exp $ */
    22
    33/*
     
    1010 */
    1111#define INCL_DOSMEMMGR
     12#define INCL_DOSDEVICES
    1213#include <os2wrap.h>
    1314#include <misc.h>
    1415#include "os2util.h"
    15 
     16#include "cio2.h"
    1617
    1718//******************************************************************************
     
    4546  WinSetWindowPos(hwndClient, HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE);
    4647}
     48//******************************************************************************
     49//******************************************************************************
    4750
     51int 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 phaller Exp $ */
     1/* $Id: OS2UTIL.H,v 1.4 1999-11-14 22:16:32 hugh Exp $ */
    22
    33/*
     
    1515void  OS2FreeMem(char *lpMem);
    1616void  OS2MaximizeWindow(HWND hwndClient);
    17 
     17int InitIO();
    1818#endif
  • trunk/src/ddraw/cio2.h

    r211 r1746  
    1111{
    1212 int io_init1();
     13 int io_init2(short);
    1314 int io_exit1();
    1415
  • trunk/src/ddraw/makefile

    r1585 r1746  
    1919
    2020OBJS =  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
    2223
    2324
     
    8485initterm.obj: initterm.cpp initterm.h
    8586
     87os2util.obj:  os2util.cpp os2util.h
     88
     89bltFunc.obj: bltFunc.cpp bltFunc.h \
     90    $(PDWIN32_INCLUDE)\misc.h
     91
     92iccio1.obj: iccio1.asm
     93
     94asmutil.obj: asmutil.asm
     95
    8696clean:
    8797  $(RM) *.obj *.lib *.dll *.map *.pch
Note: See TracChangeset for help on using the changeset viewer.