Ignore:
Timestamp:
Mar 9, 2001, 11:48:48 PM (25 years ago)
Author:
mike
Message:

Updates/cleanup for Watcom (not complete)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ddraw/new/OS2SURFACE.CPP

    r4326 r5291  
    1 /* $Id: OS2SURFACE.CPP,v 1.2 2000-09-25 20:54:01 mike Exp $ */
     1/* $Id: OS2SURFACE.CPP,v 1.3 2001-03-09 22:48:48 mike Exp $ */
    22
    33/*
    4  * Direct/X Surface class implementaion
     4 * DirectDraw Surface class implementaion
    55 *
    66 * Copyright 1999 Markus Montkowski
     7 * Copyright 2000 Michal Necasek
    78 *
    89 * Project Odin Software License can be found in LICENSE.TXT
     
    302303
    303304#define CBM_CREATEDIB   0x02L   /* create DIB bitmap */
     305
    304306#ifdef DEBUG
    305 
    306307// ******************************************************************************
    307308// *    internal helper functions from WINE
     
    536537  _dump_DDPIXELFORMAT(pf->dwFlags);
    537538  dprintf(("DDRAW: dwFourCC : %ld\n", pf->dwFourCC));
    538   dprintf(("DDRAW: RBG bit cbout : %ld\n", pf->dwRGBBitCount));
     539  dprintf(("DDRAW: RBG bit count : %ld\n", pf->dwRGBBitCount));
    539540  dprintf(("DDRAW: Masks : R %08lx  G %08lx  B %08lx  A %08lx\n",
    540541       pf->dwRBitMask, pf->dwGBitMask, pf->dwBBitMask, pf->dwRGBAlphaBitMask));
     
    559560
    560561{
    561   ULONG rc;
    562   DWORD i;
    563   DIVE_CAPS dCaps;
     562  DWORD rc;
    564563  DDSURFACEDESC2 ComplexSurfaceDesc;
    565   OS2IDirectDrawSurface *AttachedSurface;
    566564  OS2IDirectDrawSurface *MipMapSurface;
    567565
     
    721719  if(NULL==DPA_SurfaceMipMaps)
    722720  {
    723     #ifdef DEBUG
    724       dprintf(("DDRAW: Internal : Error creating DPA for MipMaps\n"));
    725     #endif
     721    dprintf(("DDRAW: Internal : Error creating DPA for MipMaps\n"));
    726722    lastError = DDERR_OUTOFMEMORY ;
    727723    return;
     
    747743  if(NULL==DPA_SurfacePrivateData)
    748744  {
    749     dprintf(("DDRAW: Internal : Error creating DPA for priva surface Data\n"));
     745    dprintf(("DDRAW: Internal : Error creating DPA for private surface Data\n"));
    750746    lastError = DDERR_OUTOFMEMORY ;
    751747    return;
     
    778774          break;
    779775        default:
    780           dprintf(("DDRAW: Unsupported System ColorDeapth %d",lpDraw->dCaps.ulDepth));
     776          dprintf(("DDRAW: Unsupported System ColorDepth %d",lpDraw->dCaps.ulDepth));
    781777          BltSolid  = NULL;
    782778          ColorConv = NULL;
     
    809805          break;
    810806        default:
    811           dprintf(("DDRAW: Unsupported System ColorDeapth %d",lpDraw->dCaps.ulDepth));
     807          dprintf(("DDRAW: Unsupported System ColorDepth %d",lpDraw->dCaps.ulDepth));
    812808          BltSolid  = NULL;
    813809          ColorConv = NULL;
     
    840836          break;
    841837        default:
    842           dprintf(("DDRAW: Unsupported System ColorDeapth %d",lpDraw->dCaps.ulDepth));
     838          dprintf(("DDRAW: Unsupported System ColorDepth %d",lpDraw->dCaps.ulDepth));
    843839          BltSolid  = NULL;
    844840          ColorConv = NULL;
     
    871867          break;
    872868        default:
    873           dprintf(("DDRAW: Unsupported System ColorDeapth %d",lpDraw->dCaps.ulDepth));
     869          dprintf(("DDRAW: Unsupported System ColorDepth %d",lpDraw->dCaps.ulDepth));
    874870          BltSolid  = NULL;
    875871          ColorConv = NULL;
     
    879875      break;
    880876    default:
    881       dprintf(("DDRAW: Unsupported DX ColorDeapth %d",lpDraw->GetScreenBpp()));
     877      dprintf(("DDRAW: Unsupported DX ColorDepth %d",lpDraw->GetScreenBpp()));
    882878      BltSolid  = NULL;
    883879      ColorConv = NULL;
     
    896892    if( surfaceType & DDSCAPS_PRIMARYSURFACE)
    897893    {
    898       #ifdef DEBUG
    899         dprintf(("DDRAW: Primary surface!\n"));
    900       #endif
    901 
     894      dprintf(("DDRAW: Primary surface!\n"));
    902895      if( lpDraw->HasPrimarySurface())
    903896      {
    904         #ifdef DEBUG
    905           dprintf(("DDRAW: Primary surface already exits!\n"));
    906         #endif
     897        dprintf(("DDRAW: Primary surface already exits!\n"));
    907898        lastError = DDERR_PRIMARYSURFACEALREADYEXISTS;
    908899        return;
     
    925916      if( lpDraw->dCaps.ulDepth == lpDraw->GetScreenBpp() )
    926917      {
    927         dprintf(("DDRAW: DirectScreenAccess possible\n"));
     918        dprintf(("DDRAW: Direct Screen Access possible\n"));
    928919
    929920        // Yes so direct access to framebuffer is possible
     
    940931        // and blit to the real framebuffer on Unlock to do color conversion
    941932
    942         dprintf( ("Need Color conversation %d => %d Bit\n",
     933        dprintf( ("Need Color conversion %d => %d Bit\n",
    943934                  lpDraw->GetScreenBpp(),
    944935                  lpDraw->dCaps.ulDepth
     
    962953
    963954      dprintf(("DDRAW: Setting up Surface\n"));
    964 
    965955      DDSurfaceDesc.dwFlags     |= DDSD_WIDTH | DDSD_HEIGHT |
    966956                                   DDSD_PITCH | DDSD_LPSURFACE |
     
    10561046          dprintf(("DDRAW: Unsupported Complex Surface\n"));
    10571047          #ifdef DEBUG
    1058             _dump_DDSCAPS(DDSurfaceDesc.dwFlags);
     1048          _dump_DDSCAPS(DDSurfaceDesc.dwFlags);
    10591049          #endif
    10601050          lastError = DDERR_OUTOFMEMORY;
     
    14091399{
    14101400
    1411   int i, FillWidth, FillHeight, Top, Left;
     1401  int FillWidth, FillHeight, Top, Left;
    14121402  DWORD *pPal24;
    14131403  WORD  *pPal16;
    1414   #ifdef DEBUG
    1415     dprintf(("DDRAW: ColorFill with %08X\n", dwFillColor));
    1416   #endif
     1404  dprintf(("DDRAW: ColorFill with %08X\n", dwFillColor));
    14171405
    14181406  if(NULL!=lpDestRect)
     
    14361424  //dprintf(("DDRAW: 0x%08X (%d/%d) at\n", pLine,FillWidth,FillHeight));
    14371425
    1438   // Better safe then sorry
    1439   if(FillHeight<=0)
     1426  // Better safe than sorry
     1427  if (FillHeight <= 0)
    14401428    return(DD_OK);
    14411429
     
    16471635      break;
    16481636    default:
    1649       #ifdef DEBUG
    16501637        dprintf( ("Unexpected Screen Bitdepth %d\n",
    16511638                  lpDraw->dCaps.ulDepth));
    1652       #endif
    16531639      break;
    16541640  }
     
    16771663OS2IDirectDrawSurface::~OS2IDirectDrawSurface()
    16781664{
    1679   OS2IDirectDrawSurface  *AttachedSurface;
    1680 
    16811665
    16821666  if(DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
     
    17551739
    17561740  lpDraw->Vtbl.Release(lpDraw);
    1757 
    1758 }
     1741}
     1742
    17591743//******************************************************************************
    17601744//******************************************************************************
     
    17941778    else
    17951779    {
    1796       dprintf(("DDRAW: We are oe of many buffers\n"));
     1780      dprintf(("DDRAW: We are one of many buffers\n"));
    17971781      DDSurfaceDesc.ddsCaps.dwCaps &=  ~DDSCAPS_BACKBUFFER ;
    17981782      DDSurfaceDesc.ddsCaps.dwCaps |=  DDSCAPS_FLIP;
     
    18071791//******************************************************************************
    18081792//******************************************************************************
    1809 HRESULT __stdcall SurfQueryInterface(THIS This, REFIID riid, LPVOID FAR * ppvObj)
     1793HRESULT WIN32API SurfQueryInterface(THIS This, REFIID riid, LPVOID FAR * ppvObj)
    18101794{
    18111795  // ToDo: Add Interface handling for D3D Textures
     
    18261810  if(IsEqualGUID(riid, IID_IDirectDrawSurface))
    18271811  {
    1828     *ppvObj = &me->Vtbl2;  // ToDo DO a real V1 table
     1812    *ppvObj = &me->lpVtbl;  // ToDo DO a real V1 table
    18291813    rc = DD_OK;
    18301814    goto RetFn;
     
    18321816  if(IsEqualGUID(riid, IID_IDirectDrawSurface2))
    18331817  {
    1834     *ppvObj = &me->Vtbl2;
     1818    *ppvObj = &me->lpVtbl2;
    18351819    rc = DD_OK;
    18361820    goto RetFn;
     
    18591843//******************************************************************************
    18601844//******************************************************************************
    1861 ULONG __stdcall SurfAddRef(THIS This)
     1845ULONG WIN32API SurfAddRef(THIS This)
    18621846{
    18631847 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    18641848
    1865   #ifdef DEBUG
    1866     dprintf(("DDRAW: OS2IDirectDrawSurface::SurfAddRef %d\n", me->Referenced+1));
    1867   #endif
     1849  dprintf(("DDRAW: OS2IDirectDrawSurface::SurfAddRef %d\n", me->Referenced+1));
    18681850
    18691851  return ++me->Referenced;
     
    18711853//******************************************************************************
    18721854//******************************************************************************
    1873 ULONG __stdcall SurfRelease(THIS This)
     1855ULONG WIN32API SurfRelease(THIS This)
    18741856{
    18751857 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    18761858
    1877   #ifdef DEBUG
    1878     dprintf(("DDRAW: OS2IDirectDrawSurface::SurfRelease %d\n", me->Referenced-1));
    1879     dprintf(("DDRAW: OS2IDirectDrawSurface::Surface %X\n", me));
    1880   #endif
     1859  dprintf(("DDRAW: OS2IDirectDrawSurface::SurfRelease %d\n", me->Referenced-1));
     1860  dprintf(("DDRAW: OS2IDirectDrawSurface::Surface %X\n", me));
    18811861  if(me->Referenced)
    18821862  {
     
    18981878//******************************************************************************
    18991879//******************************************************************************
    1900 HRESULT __stdcall SurfAddAttachedSurface(THIS This, LPDIRECTDRAWSURFACE2 lpDDSurface)
    1901 {
    1902 
    1903   #ifdef DEBUG
    1904     dprintf(("DDRAW: SurfAddAttachedSurface\n"));
    1905   #endif
     1880HRESULT WIN32API SurfAddAttachedSurface(THIS This, LPDIRECTDRAWSURFACE2 lpDDSurface)
     1881{
     1882
     1883  dprintf(("DDRAW: SurfAddAttachedSurface\n"));
    19061884  return SurfAddAttachedSurface4(This, (LPDIRECTDRAWSURFACE4)lpDDSurface);
    19071885}
    19081886//******************************************************************************
    19091887//******************************************************************************
    1910 HRESULT __stdcall SurfAddAttachedSurface3(THIS This, LPDIRECTDRAWSURFACE3 lpDDSurface)
    1911 {
    1912 
    1913   #ifdef DEBUG
    1914     dprintf(("DDRAW: SurfAddAttachedSurface\n"));
    1915   #endif
     1888HRESULT WIN32API SurfAddAttachedSurface3(THIS This, LPDIRECTDRAWSURFACE3 lpDDSurface)
     1889{
     1890
     1891  dprintf(("DDRAW: SurfAddAttachedSurface\n"));
    19161892  return SurfAddAttachedSurface4(This, (LPDIRECTDRAWSURFACE4)lpDDSurface);
    19171893}
    19181894//******************************************************************************
    19191895//******************************************************************************
    1920 HRESULT __stdcall SurfAddAttachedSurface4(THIS This, LPDIRECTDRAWSURFACE4 lpDDSurface)
     1896HRESULT WIN32API SurfAddAttachedSurface4(THIS This, LPDIRECTDRAWSURFACE4 lpDDSurface)
    19211897{
    19221898  OS2IDirectDrawSurface *AttachedSurface;
     
    19251901  int rc;
    19261902
    1927   #ifdef DEBUG
    1928     dprintf(("DDRAW: SurfAddAttachedSurface4\n"));
    1929   #endif
     1903  dprintf(("DDRAW: SurfAddAttachedSurface4\n"));
    19301904
    19311905  if (NULL==lpDDSurface)
     
    19361910  if(AttachedSurface->IsImplicitSurface())
    19371911  {
    1938     #ifdef DEBUG
    1939      dprintf(("DDRAW: Internal : Can't attach an implicit created surface to an other surface\n"));
    1940     #endif
     1912    dprintf(("DDRAW: Internal : Can't attach an implicitly created surface to another surface\n"));
    19411913    return(DDERR_CANNOTATTACHSURFACE);
    19421914  }
     
    19441916  if(This == AttachedSurface)
    19451917  {
    1946     #ifdef DEBUG
    1947      dprintf(("DDRAW: Can't attach an surface to itself\n"));
    1948     #endif
     1918    dprintf(("DDRAW: Can't attach a surface to itself\n"));
    19491919    return(DDERR_CANNOTATTACHSURFACE);
    19501920  }
     
    19691939        else
    19701940        {
    1971           #ifdef DEBUG
    1972             dprintf(("DDRAW: Internal : Error attaching to MipMap\n"));
    1973           #endif
     1941          dprintf(("DDRAW: Internal : Error attaching to MipMap\n"));
    19741942          return(DDERR_CANNOTATTACHSURFACE);
    19751943        }
     
    19771945      else
    19781946      {
    1979         #ifdef DEBUG
    1980           dprintf(("DDRAW: Target Surface isn't a MipMap\n"));
    1981         #endif
     1947        dprintf(("DDRAW: Target Surface isn't a MipMap\n"));
    19821948        return(DDERR_CANNOTATTACHSURFACE);
    19831949      }
     
    19951961      else
    19961962      {
    1997         #ifdef DEBUG
    1998           dprintf(("DDRAW: Internal : Error attaching to general Set\n"));
    1999         #endif
     1963        dprintf(("DDRAW: Internal : Error attaching to general Set\n"));
    20001964        return(DDERR_CANNOTATTACHSURFACE);
    20011965      }
     
    20101974       )
    20111975    {
    2012       #ifdef DEBUG
    2013         dprintf(("DDRAW: Surfaces don't have same dimensions\n"));
    2014       #endif
     1976      dprintf(("DDRAW: Surfaces don't have equal dimensions\n"));
    20151977      return(DDERR_CANNOTATTACHSURFACE);
    20161978    }
     
    20211983        if( (AttachedSurface->GetFrontBuffer()!=NULL) || (AttachedSurface->BackBuffer!= NULL))
    20221984        {
    2023           #ifdef DEBUG
    2024             dprintf(("DDRAW: Surfaces already has a front/backbuffer\n"));
    2025           #endif
     1985          dprintf(("DDRAW: Surface already has a front/backbuffer\n"));
    20261986          return(DDERR_SURFACEALREADYATTACHED);
    20271987        }
     
    20562016        else
    20572017        {
    2058           #ifdef DEBUG
    2059             dprintf(("DDRAW: Can't attach backbuffer to anything but a frontbuffer\n"));
    2060           #endif
    2061          return(DDERR_CANNOTATTACHSURFACE);
     2018          dprintf(("DDRAW: Can't attach backbuffer to anything but a frontbuffer\n"));
     2019          return(DDERR_CANNOTATTACHSURFACE);
    20622020        }
    20632021      }
     
    20802038            else
    20812039            {
    2082               #ifdef DEBUG
    2083                 dprintf(("DDRAW: Internal : Error attaching to MipMap\n"));
    2084               #endif
     2040              dprintf(("DDRAW: Internal : Error attaching to MipMap\n"));
    20852041              return(DDERR_CANNOTATTACHSURFACE);
    20862042            }
     
    20882044          else
    20892045          {
    2090             #ifdef DEBUG
    2091               dprintf(("DDRAW: Tagget Surface isn't a MipMap\n"));
    2092             #endif
     2046            dprintf(("DDRAW: Target Surface isn't a MipMap\n"));
    20932047           return(DDERR_CANNOTATTACHSURFACE);
    20942048          }
     
    21042058          else
    21052059          {
    2106             #ifdef DEBUG
    2107               dprintf(("DDRAW: Internal : Error attaching to general Set\n"));
    2108             #endif
     2060            dprintf(("DDRAW: Internal : Error attaching to general Set\n"));
    21092061            return(DDERR_CANNOTATTACHSURFACE);
    21102062          }
     
    21182070//******************************************************************************
    21192071//******************************************************************************
    2120 HRESULT __stdcall SurfAddOverlayDirtyRect(THIS, LPRECT)
    2121 {
    2122   #ifdef DEBUG
    2123     dprintf(("DDRAW: SurfAddOverlayDirtyRect Not implemented by M$ in V 6.0! \n"));
    2124   #endif
     2072HRESULT WIN32API SurfAddOverlayDirtyRect(THIS, LPRECT)
     2073{
     2074  dprintf(("DDRAW: SurfAddOverlayDirtyRect Not implemented by M$ in DX 6.0!\n"));
    21252075
    21262076  return(DD_OK);
     
    21282078//******************************************************************************
    21292079//******************************************************************************
    2130 HRESULT __stdcall SurfBlt(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE2 lpDDSrcSurface,
     2080HRESULT WIN32API SurfBlt(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE2 lpDDSrcSurface,
    21312081        LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
    21322082{
     
    21402090//******************************************************************************
    21412091//******************************************************************************
    2142 HRESULT __stdcall SurfBlt3(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE3 lpDDSrcSurface,
     2092HRESULT WIN32API SurfBlt3(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE3 lpDDSrcSurface,
    21432093        LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
    21442094{
     
    21522102//******************************************************************************
    21532103//******************************************************************************
    2154 HRESULT __stdcall SurfBlt4(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE4 lpDDSrcSurface,
     2104HRESULT WIN32API SurfBlt4(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE4 lpDDSrcSurface,
    21552105        LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
    21562106{
     
    21702120 OS2IDirectDrawSurface *src  = (OS2IDirectDrawSurface *)lpDDSrcSurface;
    21712121
    2172  HRESULT                rc;
    2173  ULONG                  ulColor, *pColor;
    2174  RECTL                  cliprect;
    2175 
    2176  int                    x, y, i, j, BlitWidth, BlitHeight;
     2122 int                    x, i, BlitWidth, BlitHeight;
    21772123 PALETTEENTRY           SysPal[257];
    21782124 PLOGPALETTE            pLogPal = (PLOGPALETTE) SysPal;
     
    21852131
    21862132  #ifdef DEBUG
    2187     dprintf(("DDRAW: SurfBlt4 To Surf %08X, from Surf %08X, flags %08X", dest, src, dwFlags));
     2133    dprintf(("DDRAW: SurfBlt4 To Surf %08X, from Surf %08X\n",dest,src));
    21882134    if ( (NULL!=lpDestRect)&& (NULL!=lpSrcRect))
    21892135      dprintf(("DDRAW: SurfBlt4 to (%d,%d)(%d,%d) at %08X from (%d,%d)(%d,%d) at %08X\n", lpDestRect->left, lpDestRect->top,
     
    22892235    {
    22902236      delete pIRectDest;
    2291       dprintf(("DDRAW: Blt: Dest Surface partly locked\n"));
     2237      dprintf(("DDRAW: Blt: Dest Surface partially locked\n"));
    22922238      return(DDERR_SURFACEBUSY);
    22932239    }
     
    24742420    }
    24752421  }
    2476 /*
     2422
    24772423  if( ( (NULL==lpDestRect) && (NULL!=lpSrcRect) ) ||
    24782424      ( (NULL==lpSrcRect) && (NULL!=lpDestRect) ) )
    24792425  {
    2480     dprintf(("DDRAW: Blitting with scaleing\n Not supported.\n"));
    2481 
    2482     return DDERR_NOSTRETCHHW;
     2426    dprintf(("DDRAW: Blitting with scaling\n Not supported.\n"));
     2427
     2428//    return DDERR_NOSTRETCHHW;
    24832429  }
    24842430
     
    24922438    return DDERR_NOSTRETCHHW;
    24932439  }
    2494 */
     2440
    24952441  if (dest->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
    24962442  {
     
    25932539    {
    25942540      // copy from the screen to a buffer
    2595       dprintf(("DDRAW: Screen to buffer"));
    25962541
    25972542      if( (NULL==lpDestRect) &&
     
    26592604    {
    26602605      // DIVE => DIVE  or Mem => Dive can be handelt in the same way
    2661       dprintf(("DDRAW: Buffer to screen"));
    26622606
    26632607      if( (src->pDiveBuffer == dest->pDiveBuffer) &&
     
    27252669        {
    27262670          DWORD dwFx;
    2727           DWORD dwSrcColor, dwDestColor;
    27282671
    27292672          dwFlags &= ~DDBLT_DDFX; // remove the handled flag
     
    31893132//******************************************************************************
    31903133//******************************************************************************
    3191 HRESULT __stdcall SurfBltBatch(THIS, LPDDBLTBATCH, DWORD, DWORD )
    3192 {
    3193   #ifdef DEBUG
    3194     dprintf(("DDRAW: SurfBltBatch Not implemented by M$\n"));
    3195   #endif
     3134HRESULT WIN32API SurfBltBatch(THIS, LPDDBLTBATCH, DWORD, DWORD )
     3135{
     3136  dprintf(("DDRAW: SurfBltBatch Not implemented by M$\n"));
    31963137
    31973138  return(DD_OK);
     
    31993140//******************************************************************************
    32003141//******************************************************************************
    3201 HRESULT __stdcall SurfBltFast( THIS This ,
     3142HRESULT WIN32API SurfBltFast( THIS This ,
    32023143                               DWORD dwX,
    32033144                               DWORD dwY,
     
    32163157//******************************************************************************
    32173158//******************************************************************************
    3218 HRESULT __stdcall SurfBltFast3(THIS This ,
     3159HRESULT WIN32API SurfBltFast3(THIS This ,
    32193160                               DWORD dwX,
    32203161                               DWORD dwY,
     
    32333174//******************************************************************************
    32343175//******************************************************************************
    3235 HRESULT __stdcall SurfBltFast4( THIS This,
     3176HRESULT WIN32API SurfBltFast4( THIS This,
    32363177                                DWORD dwX,
    32373178                                DWORD dwY,
     
    32443185  RECTL SrcRect;
    32453186  char *pBltPos, *pSrcPos;
    3246   DWORD dwDestColor, dwSrcColor, BlitWidth, BlitHeight,x,y;
     3187  DWORD dwDestColor, dwSrcColor, BlitWidth, BlitHeight, x;
    32473188
    32483189  dprintf(("DDRAW: SurfBltFast4 %08X at(%d/%d) onto %08X with flags %08X\n",src, dwX,dwY, dest, dwTrans));
    32493190
    3250   if( (NULL==lpDDSrcSurface) ||
    3251       (dwX<0) || (dwY<0) ||
    3252       (dwX>dest->width) ||
    3253       (dwY>dest->height))
     3191  if( (NULL == lpDDSrcSurface) ||
     3192      ((LONG)dwX < 0) || ((LONG)dwY < 0) ||
     3193      (dwX > dest->width) ||
     3194      (dwY > dest->height))
    32543195  {
    32553196    dprintf(("DDRAW: Invalid Parameters %08X, %d %d", lpDDSrcSurface ,dest->width , dest->height));
     
    32573198  }
    32583199
    3259   if (NULL!=lpSrcRect)
     3200  if (NULL != lpSrcRect)
    32603201  {
    32613202    memcpy(&SrcRect,lpSrcRect,sizeof(RECTL) );
     
    32853226  if(DDBLTFAST_NOCOLORKEY == dwTrans )
    32863227  {
    3287     dprintf(( "Solid Blit, %d pels wide => %d bytes per line\n",
     3228    dprintf(( "Solid Blit, %d bits => %d bytes per line\n",
    32883229              (SrcRect.right - SrcRect.left),
    32893230              BlitWidth) );
    32903231    #ifdef USE_ASM
    32913232      BltRec(pBltPos, pSrcPos, BlitWidth, BlitHeight,
    3292              dest->dwPitchDB, src->dwPitchDB);
     3233             dest->dwPitchDB,
     3234             src->dwPitchDB);
    32933235    #else
    32943236      // Solid Blit
    32953237      while(1)
    32963238      {
    3297         memcpy(pBltPos, pSrcPos, BlitWidth);
     3239        memcpy(pBltPos,pSrcPos,BlitWidth);
    32983240        pBltPos += dest->dwPitchDB;
    32993241        pSrcPos += src->dwPitchDB;
     
    33083250    dprintf(("DDRAW: TransBlit\n"));
    33093251
    3310     if (dwTrans & DDBLTFAST_SRCCOLORKEY)
     3252    if(dwTrans & DDBLTFAST_SRCCOLORKEY)
    33113253    {
    33123254      dprintf(("DDRAW: Trans SRC\n"));
     
    34163358        {
    34173359          case 1:
    3418             if(CPUHasMMX())
    3419               while(BlitHeight--)
     3360            if (CPUHasMMX())
     3361              while (BlitHeight--)
    34203362              {
    34213363                BlitColorKey8MMX((PBYTE)pBltPos,(PBYTE)pSrcPos,dwSrcColor,BlitWidth);
     
    34243366              }
    34253367            else
    3426               while(BlitHeight--)
     3368              while (BlitHeight--)
    34273369              {
    34283370                BlitColorKey8((PBYTE)pBltPos,(PBYTE)pSrcPos,dwSrcColor,BlitWidth);
     
    34333375          case 2:
    34343376
    3435             if(CPUHasMMX())
     3377            if (CPUHasMMX())
    34363378              while(BlitHeight--)
    34373379              {
     
    34813423    else
    34823424    {
    3483       if(dwTrans & DDBLTFAST_DESTCOLORKEY)
     3425      if (dwTrans & DDBLTFAST_DESTCOLORKEY)
    34843426      {
    34853427        dprintf(("DDRAW: DestColorKey\n"));
     
    35713513  //   dest->Vtbl4->ChangeUniquenessValue(dest);
    35723514
    3573   return(DD_OK);
    3574 }
    3575 
    3576 //******************************************************************************
    3577 //******************************************************************************
    3578 HRESULT __stdcall SurfDeleteAttachedSurface(THIS This, DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSurface)
     3515  return DD_OK;
     3516}
     3517//******************************************************************************
     3518//******************************************************************************
     3519HRESULT WIN32API SurfDeleteAttachedSurface(THIS This, DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSurface)
    35793520{
    35803521  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    35833524  return(SurfDeleteAttachedSurface4(me, dwFlags, (LPDIRECTDRAWSURFACE4)lpDDSurface));
    35843525}
    3585 
    3586 //******************************************************************************
    3587 //******************************************************************************
    3588 HRESULT __stdcall SurfDeleteAttachedSurface3(THIS This, DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSurface)
     3526//******************************************************************************
     3527//******************************************************************************
     3528HRESULT WIN32API SurfDeleteAttachedSurface3(THIS This, DWORD dwFlags, LPDIRECTDRAWSURFACE3 lpDDSurface)
    35893529{
    35903530  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    3591   #ifdef DEBUG
    3592     dprintf(("DDRAW: SurfDeleteAttachedSurface\n"));
    3593   #endif
     3531  dprintf(("DDRAW: SurfDeleteAttachedSurface\n"));
    35943532
    35953533  return(SurfDeleteAttachedSurface4(me, dwFlags, (LPDIRECTDRAWSURFACE4)lpDDSurface));
     
    35973535//******************************************************************************
    35983536//******************************************************************************
    3599 HRESULT __stdcall SurfDeleteAttachedSurface4(THIS This, DWORD dwFlags , LPDIRECTDRAWSURFACE4 lpDDSurface)
     3537HRESULT WIN32API SurfDeleteAttachedSurface4(THIS This, DWORD dwFlags , LPDIRECTDRAWSURFACE4 lpDDSurface)
    36003538{
    36013539
     
    36063544
    36073545  BOOL Found = FALSE;
    3608   #ifdef DEBUG
    3609     dprintf(("DDRAW: SurfDeleteAttachedSurface\n"));
    3610   #endif
     3546  dprintf(("DDRAW: SurfDeleteAttachedSurface\n"));
    36113547
    36123548  if((0!=dwFlags)||(NULL==lpDDSurface))
     
    37453681//******************************************************************************
    37463682//******************************************************************************
    3747 HRESULT __stdcall SurfEnumAttachedSurfaces(THIS This, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpCallBack)
     3683HRESULT WIN32API SurfEnumAttachedSurfaces(THIS This, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpCallBack)
    37483684{
    37493685  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    3750   #ifdef DEBUG
    3751     dprintf(("DDRAW: SurfEnumAttachedSurfaces\n"));
    3752   #endif
     3686  dprintf(("DDRAW: SurfEnumAttachedSurfaces\n"));
    37533687
    37543688  return(SurfEnumAttachedSurfaces4(me,lpContext, (LPDDENUMSURFACESCALLBACK2) lpCallBack));
     
    37563690//******************************************************************************
    37573691//******************************************************************************
    3758 HRESULT __stdcall SurfEnumAttachedSurfaces4(THIS This, LPVOID lpContext ,LPDDENUMSURFACESCALLBACK2 lpCallBack)
     3692HRESULT WIN32API SurfEnumAttachedSurfaces4(THIS This, LPVOID lpContext ,LPDDENUMSURFACESCALLBACK2 lpCallBack)
    37593693{
    37603694  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    37643698  HRESULT rc;
    37653699
    3766   #ifdef DEBUG
    3767     dprintf(("DDRAW: SurfEnumAttachedSurfaces\n"));
    3768   #endif
     3700  dprintf(("DDRAW: SurfEnumAttachedSurfaces\n"));
    37693701  if (NULL==lpCallBack)
    37703702    return (DDERR_INVALIDPARAMS);
     
    38163748//******************************************************************************
    38173749//******************************************************************************
    3818 HRESULT __stdcall SurfEnumOverlayZOrders(THIS, DWORD,LPVOID,LPDDENUMSURFACESCALLBACK)
     3750HRESULT WIN32API SurfEnumOverlayZOrders(THIS, DWORD,LPVOID,LPDDENUMSURFACESCALLBACK)
    38193751{
    38203752  dprintf(("DDRAW: SurfEnumOverlayZOrders\n"));
     
    38243756//******************************************************************************
    38253757//******************************************************************************
    3826 HRESULT __stdcall SurfEnumOverlayZOrders4(THIS, DWORD,LPVOID,LPDDENUMSURFACESCALLBACK2)
     3758HRESULT WIN32API SurfEnumOverlayZOrders4(THIS, DWORD,LPVOID,LPDDENUMSURFACESCALLBACK2)
    38273759{
    38283760  dprintf(("DDRAW: SurfEnumOverlayZOrders\n"));
     
    38323764//******************************************************************************
    38333765//******************************************************************************
    3834 HRESULT __stdcall SurfFlip(THIS This, LPDIRECTDRAWSURFACE2 lpDDSurf, DWORD dwFlags)
     3766HRESULT WIN32API SurfFlip(THIS This, LPDIRECTDRAWSURFACE2 lpDDSurf, DWORD dwFlags)
    38353767{
    38363768  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    38423774//******************************************************************************
    38433775//******************************************************************************
    3844 HRESULT __stdcall SurfFlip3(THIS This, LPDIRECTDRAWSURFACE3 lpDDSurf, DWORD dwFlags)
     3776HRESULT WIN32API SurfFlip3(THIS This, LPDIRECTDRAWSURFACE3 lpDDSurf, DWORD dwFlags)
    38453777{
    38463778  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    38523784//******************************************************************************
    38533785//******************************************************************************
    3854 HRESULT __stdcall SurfFlip4(THIS This, LPDIRECTDRAWSURFACE4 lpDDSurf, DWORD dwFlags)
     3786HRESULT WIN32API SurfFlip4(THIS This, LPDIRECTDRAWSURFACE4 lpDDSurf, DWORD dwFlags)
    38553787{
    38563788  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    38593791  LPVOID Data;
    38603792  char *pcrFB,*pcFB,*pcrDB,*pcDB;
    3861   ULONG rc;
    38623793
    38633794  dprintf(("DDRAW: SurfFlip4\n"));
     
    39073838  }
    39083839
    3909   if(-1 != me->diveBufNr)
     3840  if (-1 != me->diveBufNr)
    39103841  {
    39113842    //dprintf(("DDRAW: DIVE Flipchain DiveBuffer #%d",FlipSurface->diveBufNr));
     
    39343865  else
    39353866  {
    3936     #ifdef DEBUG
    3937       dprintf(("DDRAW: Memory Flipchain"));
    3938     #endif
     3867    dprintf(("DDRAW: Memory Flipchain"));
    39393868    // Memory Flipchain
    39403869    //
     
    39603889    me->pDiveBuffer             = FlipSurface->pDiveBuffer;
    39613890
    3962     if(NULL==lpDDSurf)
    3963     {
    3964       while(NULL!=FlipSurface->BackBuffer)
     3891    if (NULL==lpDDSurf)
     3892    {
     3893      while (NULL!=FlipSurface->BackBuffer)
    39653894      {
    39663895        FlipSurface->DDSurfaceDesc.lpSurface = FlipSurface->BackBuffer->DDSurfaceDesc.lpSurface;
     
    39793908  }
    39803909
    3981   return(DD_OK);
    3982 }
    3983 //******************************************************************************
    3984 //******************************************************************************
    3985 HRESULT __stdcall SurfGetAttachedSurface(THIS This, LPDDSCAPS lpDDCaps,
     3910  return DD_OK;
     3911}
     3912
     3913//******************************************************************************
     3914//******************************************************************************
     3915HRESULT WIN32API SurfGetAttachedSurface(THIS This, LPDDSCAPS lpDDCaps,
    39863916                                         LPDIRECTDRAWSURFACE2 FAR * lpDDSurf)
    39873917{
    39883918  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    3989   #ifdef DEBUG
    3990     dprintf(("DDRAW: SurfGetAttachedSurface\n"));
    3991   #endif
     3919  dprintf(("DDRAW: SurfGetAttachedSurface\n"));
    39923920
    39933921  return(SurfGetAttachedSurface4(me, (LPDDSCAPS2)lpDDCaps , (LPDIRECTDRAWSURFACE4*)lpDDSurf));
     
    39953923//******************************************************************************
    39963924//******************************************************************************
    3997 HRESULT __stdcall SurfGetAttachedSurface3(THIS This, LPDDSCAPS lpDDCaps,
     3925HRESULT WIN32API SurfGetAttachedSurface3(THIS This, LPDDSCAPS lpDDCaps,
    39983926                                         LPDIRECTDRAWSURFACE3 FAR * lpDDSurf)
    39993927{
    40003928  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    4001   #ifdef DEBUG
    4002     dprintf(("DDRAW: SurfGetAttachedSurface3\n"));
    4003   #endif
     3929  dprintf(("DDRAW: SurfGetAttachedSurface3\n"));
    40043930
    40053931  return(SurfGetAttachedSurface4(me, (LPDDSCAPS2)lpDDCaps , (LPDIRECTDRAWSURFACE4*)lpDDSurf));
     
    40073933//******************************************************************************
    40083934//******************************************************************************
    4009 HRESULT __stdcall SurfGetAttachedSurface4(THIS This, LPDDSCAPS2 lpDDCaps,
     3935HRESULT WIN32API SurfGetAttachedSurface4(THIS This, LPDDSCAPS2 lpDDCaps,
    40103936                                          LPDIRECTDRAWSURFACE4 FAR * lpDDSurf)
    40113937{
     
    40944020//******************************************************************************
    40954021//******************************************************************************
    4096 HRESULT __stdcall SurfGetBltStatus(THIS This, DWORD)
    4097 {
    4098   #ifdef DEBUG
    4099     dprintf(("DDRAW: SurfGetBltStatus\n"));
    4100   #endif
     4022HRESULT WIN32API SurfGetBltStatus(THIS This, DWORD)
     4023{
     4024  dprintf(("DDRAW: SurfGetBltStatus\n"));
    41014025
    41024026  return(DD_OK);
     
    41044028//******************************************************************************
    41054029//******************************************************************************
    4106 HRESULT __stdcall SurfGetCaps(THIS This, LPDDSCAPS lpDDCaps)
     4030HRESULT WIN32API SurfGetCaps(THIS This, LPDDSCAPS lpDDCaps)
    41074031{
    41084032  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    41094033
    4110   #ifdef DEBUG
    4111     dprintf(("DDRAW: SurfGetCaps\n"));
    4112   #endif
     4034  dprintf(("DDRAW: SurfGetCaps\n"));
    41134035
    41144036  if(NULL==lpDDCaps)
     
    41234045//******************************************************************************
    41244046//******************************************************************************
    4125 HRESULT __stdcall SurfGetCaps4(THIS This, LPDDSCAPS2 lpDDCaps)
     4047HRESULT WIN32API SurfGetCaps4(THIS This, LPDDSCAPS2 lpDDCaps)
    41264048{
    41274049  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    4128   #ifdef DEBUG
    4129     dprintf(("DDRAW: SurfGetCaps4\n"));
    4130   #endif
     4050  dprintf(("DDRAW: SurfGetCaps4\n"));
    41314051
    41324052  if(NULL==lpDDCaps)
     
    41374057    _dump_DDSCAPS(lpDDCaps->dwCaps);
    41384058    _dump_DDSCAPS2(lpDDCaps->dwCaps2);
    4139 
    41404059  #endif
    41414060
     
    41444063//******************************************************************************
    41454064//******************************************************************************
    4146 HRESULT __stdcall SurfGetClipper(THIS This, LPDIRECTDRAWCLIPPER FAR *lplpClipper)
     4065HRESULT WIN32API SurfGetClipper(THIS This, LPDIRECTDRAWCLIPPER FAR *lplpClipper)
    41474066{
    41484067  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    41494068
    4150   #ifdef DEBUG
    4151     dprintf(("DDRAW: SurfGetClipper\n"));
    4152   #endif
     4069  dprintf(("DDRAW: SurfGetClipper\n"));
    41534070
    41544071  if(me->lpClipper)
     
    41624079//******************************************************************************
    41634080//******************************************************************************
    4164 HRESULT __stdcall SurfGetColorKey(THIS This, DWORD dwFlags, LPDDCOLORKEY lpDDColKey)
     4081HRESULT WIN32API SurfGetColorKey(THIS This, DWORD dwFlags, LPDDCOLORKEY lpDDColKey)
    41654082{
    41664083  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    4167 
    4168 #ifdef DEBUG
    41694084  dprintf(("DDRAW: SurfGetColorKey\n"));
    4170 #endif
    41714085
    41724086  if ((0==dwFlags) || (NULL==lpDDColKey))
     
    41934107//******************************************************************************
    41944108//******************************************************************************
    4195 HRESULT __stdcall SurfGetDC(THIS This, HDC FAR *hdc)
     4109HRESULT WIN32API SurfGetDC(THIS This, HDC FAR *hdc)
    41964110{
    41974111 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    41984112 DDSURFACEDESC2        LockedSurfaceDesc;
    4199  HRESULT rc;
     4113 HRESULT               rc;
     4114 BITMAPINFOHEADER      bmihHdr;
    42004115 BITMAP bmpSurface;
    42014116 struct
     
    42054120 } BitmapInfo;
    42064121
    4207   #ifdef DEBUG
    4208     dprintf(("DDRAW: SurfGetDC\n"));
    4209   #endif
    4210 
    4211   if (NULL==hdc)
     4122  dprintf(("DDRAW: SurfGetDC\n"));
     4123
     4124  if (hdc == NULL)
    42124125    return(DDERR_INVALIDPARAMS);
    42134126
     
    42274140    if(me->hdcImage == NULL)
    42284141    {
    4229       #ifdef DEBUG
    4230         dprintf(("DDRAW: Can't create compatible DC!\n"));
    4231       #endif
     4142      dprintf(("DDRAW: Can't create compatible DC!\n"));
    42324143      me->Vtbl.Unlock(me,NULL);
    42334144      rc = DDERR_GENERIC;
    42344145    }
    4235     InverseDC(me->hdcImage, LockedSurfaceDesc.dwHeight);
    4236   }
    4237 
    4238   if( (DD_OK==rc) &&
    4239       (me->hbmImage == NULL) )
    4240   {
     4146  }
     4147
     4148  if( (DD_OK==rc) && (me->hbmImage == NULL) )
     4149  {
     4150    OS2IDirectDrawPalette *ddpal = NULL;
     4151
    42414152    dprintf( ("Trying to create Bitmap (%d/%d) at %d Bit\n",
    4242               LockedSurfaceDesc.lPitch/ (LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount>>3),
     4153              LockedSurfaceDesc.dwWidth,
    42434154              LockedSurfaceDesc.dwHeight,
    42444155              LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount
    42454156            ));
    4246     #if 0
     4157    #if 1
    42474158    memset(&BitmapInfo, 0, sizeof(BitmapInfo));
    4248     BitmapInfo.bmiHead.biSize   = sizeof(BITMAPINFOHEADER);
    4249     BitmapInfo.bmiHead.biWidth  = LockedSurfaceDesc.lPitch/ (LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount>>3);
    4250     BitmapInfo.bmiHead.biHeight = LockedSurfaceDesc.dwHeight;
    4251     BitmapInfo.bmiHead.biPlanes = 1;
    4252     BitmapInfo.bmiHead.biBitCount    = LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
     4159    BitmapInfo.bmiHead.biSize     = sizeof(BITMAPINFOHEADER);
     4160    BitmapInfo.bmiHead.biWidth    = LockedSurfaceDesc.dwWidth;
     4161    BitmapInfo.bmiHead.biHeight   = LockedSurfaceDesc.dwHeight;
     4162    BitmapInfo.bmiHead.biPlanes   = 1;
     4163    BitmapInfo.bmiHead.biBitCount = (WORD)LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
     4164    memset(&bmihHdr, 0, sizeof(bmihHdr));
     4165    bmihHdr.biSize     = sizeof(BITMAPINFOHEADER);
     4166    bmihHdr.biWidth    = LockedSurfaceDesc.dwWidth;
     4167    bmihHdr.biHeight   = LockedSurfaceDesc.dwHeight;
     4168    bmihHdr.biPlanes   = 1;
     4169    bmihHdr.biBitCount = (WORD)LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
    42534170    #else
    42544171    bmpSurface.bmType       = 0;
     
    42664183        break;
    42674184      case 8:
    4268         #if 0
     4185        #if 1
    42694186        BitmapInfo.bmiHead.biCompression = BI_RGB;
    4270         GetSystemPaletteEntries(me->hdcImage,0,255,(PPALETTEENTRY)&BitmapInfo.bmiCols[0]);
     4187        if (me->lpPalette != NULL)
     4188           ddpal = me->lpPalette;
     4189        if ((me->FrontBuffer != NULL) && (me->FrontBuffer->lpPalette != NULL))
     4190           ddpal = me->FrontBuffer->lpPalette;
     4191        if (ddpal != NULL) {
     4192           ddpal->Vtbl.GetEntries((IDirectDrawPalette*)ddpal,
     4193              0, 0, 256, (PPALETTEENTRY)&BitmapInfo.bmiCols[0]);
     4194        }
     4195        else {
     4196           dprintf(("DDRAW: Using default palette\n"));
     4197           for (DWORD i = 0; i < 256; i++) {
     4198              BitmapInfo.bmiCols[i].rgbBlue  = DefaultPalette[i*3+2];
     4199              BitmapInfo.bmiCols[i].rgbGreen = DefaultPalette[i*3+1];
     4200              BitmapInfo.bmiCols[i].rgbRed   = DefaultPalette[i*3];
     4201              BitmapInfo.bmiCols[i].rgbReserved = 0;
     4202           }
     4203        }
    42714204        me->hbmImage = CreateDIBitmap( me->hdcImage,
    4272                                        NULL,
    4273                                        CBM_CREATEDIB,
     4205                                       &bmihHdr,
     4206                                       CBM_INIT,
    42744207                                       LockedSurfaceDesc.lpSurface,
    42754208                                       (PBITMAPINFO)&BitmapInfo,
     
    42924225                                       LockedSurfaceDesc.lpSurface,
    42934226                                       (PBITMAPINFO)&BitmapInfo,
    4294                                        DIB_RGB_COLORS);
     4227                                       DIB_RGB_COLORS );
    42954228        #else
    42964229        bmpSurface.bmBitsPixel  = 24;
     
    42994232        break;
    43004233      default:
    4301         #ifdef DEBUG
    4302           dprintf( ("Unexptected BitCount %d \n",
     4234        dprintf( ("Unexpected BitCount %d \n",
    43034235                    LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount));
    4304         #endif
    43054236        me->hbmImage=NULL;
    43064237    } // end switch (me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
     
    43084239    if(me->hbmImage == NULL)
    43094240    {
    4310       #ifdef DEBUG
    4311         dprintf(("DDRAW: Can't create bitmap!\n"));
    4312       #endif
     4241      dprintf(("DDRAW: Can't create bitmap!\n"));
    43134242      DeleteDC(me->hdcImage);
    43144243      me->hdcImage = NULL;
     
    43194248  else
    43204249  {
    4321     if( (DD_OK==rc) &&
    4322         (me->dwLastDCUnique != me->dwUniqueValue) )
    4323     {
    4324       #ifdef DEBUG
    4325         dprintf(("DDRAW: The Surface was locked/unlocked after the last DC was created =>Update Bitmap!\n"));
    4326       #endif
     4250    if( (DD_OK==rc) && (me->dwLastDCUnique != me->dwUniqueValue) )
     4251    {
     4252      dprintf(("DDRAW: The Surface was locked/unlocked after the last DC was created =>Update Bitmap!\n"));
    43274253
    43284254      memset(&BitmapInfo,0, sizeof(BitmapInfo));
    43294255      BitmapInfo.bmiHead.biSize     = sizeof(BITMAPINFOHEADER);
    4330       BitmapInfo.bmiHead.biWidth    = LockedSurfaceDesc.lPitch/ (LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount>>3);
     4256      BitmapInfo.bmiHead.biWidth    = LockedSurfaceDesc.dwWidth;
    43314257      BitmapInfo.bmiHead.biHeight   = LockedSurfaceDesc.dwHeight;
    43324258      BitmapInfo.bmiHead.biPlanes   = 1;
    4333       BitmapInfo.bmiHead.biBitCount = LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
     4259      BitmapInfo.bmiHead.biBitCount = (WORD)LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
    43344260
    43354261      switch(LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
     
    43594285          break;
    43604286        default:
    4361           #ifdef DEBUG
    4362             dprintf(("DDRAW: Unexptected BitCount %d => Bitmap not updated!\n",LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount));
    4363           #endif
     4287          dprintf(("DDRAW: Unexpected BitCount %d => Bitmap not updated!\n",LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount));
    43644288          break;
    43654289      } // end switch (me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
     
    43704294  // Allways select the bitmap into the DC! No matter if the old or a new one
    43714295
    4372   if(DD_OK==rc)
    4373   {
    4374     if((me->hgdiOld = SelectObject(me->hdcImage, me->hbmImage)) == NULL)
    4375     {
    4376       #ifdef DEBUG
    4377         dprintf(("DDRAW: Can't select bitmap into dc!\n"));
    4378       #endif
     4296  if (DD_OK==rc)
     4297  {
     4298    if ((me->hgdiOld = SelectObject(me->hdcImage, me->hbmImage)) == NULL)
     4299    {
     4300      dprintf(("DDRAW: Can't select bitmap into DC!\n"));
    43794301      DeleteDC(me->hdcImage);
    43804302      me->hdcImage = NULL;
     
    43944316//******************************************************************************
    43954317//******************************************************************************
    4396 HRESULT __stdcall SurfGetFlipStatus(THIS This, DWORD dwFlags)
    4397 {
    4398   #ifdef DEBUG
    4399     dprintf(("DDRAW: SurfGetFlipStatus\n"));
    4400   #endif
     4318HRESULT WIN32API SurfGetFlipStatus(THIS This, DWORD dwFlags)
     4319{
     4320  dprintf(("DDRAW: SurfGetFlipStatus\n"));
    44014321
    44024322  if( (DDGFS_CANFLIP!=dwFlags) && (DDGFS_ISFLIPDONE!=dwFlags) )
     
    44074327//******************************************************************************
    44084328//******************************************************************************
    4409 HRESULT __stdcall SurfGetOverlayPosition(THIS This, LPLONG lplX, LPLONG lplY)
     4329HRESULT WIN32API SurfGetOverlayPosition(THIS This, LPLONG lplX, LPLONG lplY)
    44104330{
    44114331  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    4412   #ifdef DEBUG
    4413     dprintf(("DDRAW: SurfGetOverlayPosition\n"));
    4414   #endif
     4332  dprintf(("DDRAW: SurfGetOverlayPosition\n"));
    44154333
    44164334  // Maybe simply return dderr_notsupported as we retun a max overlay value of 0 in the caps ?
     
    44354353//******************************************************************************
    44364354//******************************************************************************
    4437 HRESULT __stdcall SurfGetPalette(THIS This, LPDIRECTDRAWPALETTE FAR *lplpPalette)
     4355HRESULT WIN32API SurfGetPalette(THIS This, LPDIRECTDRAWPALETTE FAR *lplpPalette)
    44384356{
    44394357 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    44404358
    4441   #ifdef DEBUG
    4442     dprintf(("DDRAW: SurfGetPalette\n"));
    4443   #endif
     4359  dprintf(("DDRAW: SurfGetPalette\n"));
    44444360
    44454361  if(me->lpPalette)
     
    44534369//******************************************************************************
    44544370//******************************************************************************
    4455 HRESULT __stdcall SurfGetPixelFormat(THIS This, LPDDPIXELFORMAT lpPixelFormat)
     4371HRESULT WIN32API SurfGetPixelFormat(THIS This, LPDDPIXELFORMAT lpPixelFormat)
    44564372{
    44574373  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    44584374
    4459   #ifdef DEBUG
    4460     dprintf(("DDRAW: SurfGetPixelFormat\n"));
    4461   #endif
     4375  dprintf(("DDRAW: SurfGetPixelFormat %x %x", This, lpPixelFormat));
    44624376
    44634377  if(NULL==lpPixelFormat)
     
    44724386//******************************************************************************
    44734387//******************************************************************************
    4474 HRESULT __stdcall SurfGetSurfaceDesc(THIS This, LPDDSURFACEDESC lpSurface)
     4388HRESULT WIN32API SurfGetSurfaceDesc(THIS This, LPDDSURFACEDESC lpSurface)
    44754389{
    44764390  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    44774391
    4478   #ifdef DEBUG
    4479     dprintf(("DDRAW: SurfGetSurfaceDesc\n"));
    4480   #endif
     4392  dprintf(("DDRAW: SurfGetSurfaceDesc\n"));
    44814393
    44824394  if((lpSurface == NULL)||(lpSurface->dwSize != sizeof(DDSURFACEDESC)) )
     
    44914403//******************************************************************************
    44924404//******************************************************************************
    4493 HRESULT __stdcall SurfGetSurfaceDesc4(THIS This, LPDDSURFACEDESC2 lpSurface)
     4405HRESULT WIN32API SurfGetSurfaceDesc4(THIS This, LPDDSURFACEDESC2 lpSurface)
    44944406{
    44954407  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    44964408
    4497   #ifdef DEBUG
    4498     dprintf(("DDRAW: SurfGetSurfaceDesc4\n"));
    4499   #endif
     4409  dprintf(("DDRAW: SurfGetSurfaceDesc4\n"));
    45004410
    45014411  if((lpSurface == NULL)||(lpSurface->dwSize != sizeof(DDSURFACEDESC2)) )
     
    45104420//******************************************************************************
    45114421//******************************************************************************
    4512 HRESULT __stdcall SurfInitialize(THIS, LPDIRECTDRAW, LPDDSURFACEDESC)
    4513 {
    4514   #ifdef DEBUG
    4515     dprintf(("DDRAW: SurfInitialize\n"));
    4516   #endif
     4422HRESULT WIN32API SurfInitialize(THIS, LPDIRECTDRAW, LPDDSURFACEDESC)
     4423{
     4424  dprintf(("DDRAW: SurfInitialize\n"));
    45174425
    45184426  return(DDERR_ALREADYINITIALIZED); // Init is done during creation see M$ Doc
     
    45204428//******************************************************************************
    45214429//******************************************************************************
    4522 HRESULT __stdcall SurfInitialize4(THIS, LPDIRECTDRAW, LPDDSURFACEDESC2)
    4523 {
    4524   #ifdef DEBUG
    4525     dprintf(("DDRAW: SurfInitialize\n"));
    4526   #endif
     4430HRESULT WIN32API SurfInitialize4(THIS, LPDIRECTDRAW, LPDDSURFACEDESC2)
     4431{
     4432  dprintf(("DDRAW: SurfInitialize\n"));
    45274433
    45284434  return(DDERR_ALREADYINITIALIZED); // Init is done during creation see M$ Doc
     
    45304436//******************************************************************************
    45314437//******************************************************************************
    4532 HRESULT __stdcall SurfIsLost(THIS)
     4438HRESULT WIN32API SurfIsLost(THIS)
    45334439{
    45344440  // We don't loose any surface ;)
     
    45364442  // if  they are preserved if switching to a FS DOS/OS2 session
    45374443  //
    4538   #ifdef DEBUG
    4539     dprintf(("DDRAW: SurfIsLost\n"));
    4540   #endif
     4444  dprintf(("DDRAW: SurfIsLost\n"));
    45414445
    45424446  return(DD_OK);
     
    45444448//******************************************************************************
    45454449//******************************************************************************
    4546 HRESULT __stdcall SurfLock( THIS This,
     4450HRESULT WIN32API SurfLock( THIS This,
    45474451                            LPRECT lpRect,
    45484452                            LPDDSURFACEDESC lpSurfaceDesc,
     
    45534457  HRESULT rc;
    45544458
    4555   #ifdef DEBUG
    4556     dprintf(("DDRAW: SurfLock %d %08X %d %d\n", (int)lpRect, (int)lpSurfaceDesc, dwFlags, hEvent));
    4557   #endif
     4459  dprintf(("DDRAW: SurfLock %d %08X %d %d\n", (int)lpRect, (int)lpSurfaceDesc, dwFlags, hEvent));
    45584460
    45594461  if((NULL==lpSurfaceDesc)||(NULL!=hEvent))
     
    45814483//******************************************************************************
    45824484//******************************************************************************
    4583 HRESULT __stdcall SurfLock4( THIS This,
     4485HRESULT WIN32API SurfLock4( THIS This,
    45844486                             LPRECT lpRect,
    45854487                             LPDDSURFACEDESC2 lpSurfaceDesc,
     
    45924494
    45934495  BOOL Found;
    4594   ULONG  nrScanLines;
    4595   char *pBuffer;
    45964496  DDRectangle *pIRectCurrent,*pIRectNew;
    4597   static int times = 0;
    45984497  HRESULT rc;
    45994498
    4600   #ifdef DEBUG
    4601     dprintf( ("SurfLock4 %08X %08X %08X %d %d\n",
    4602               me,
    4603               (int)lpRect,
    4604               (int)lpSurfaceDesc,
    4605               dwFlags,
    4606               hEvent) );
    4607   #endif
     4499  dprintf( ("SurfLock4 %08X %08X %08X %d %d\n",
     4500            me,
     4501            (int)lpRect,
     4502            (int)lpSurfaceDesc,
     4503            dwFlags,
     4504            hEvent) );
    46084505
    46094506  if( (NULL==lpSurfaceDesc) ||
     
    46334530    if (NULL==lpRect)
    46344531    {
    4635       // If anything is locked we can't locke the complete surface
    4636       dprintf(("DDRAW: Surface has locked Rectangles, and we want to complete lock it\n"));
     4532      // If anything is locked we can't lock the complete surface
     4533      dprintf(("DDRAW: Surface has locked Rectangles and we want to completely lock it\n"));
    46374534      Found = TRUE;
    46384535    }
     
    46424539      // be locked so check for this
    46434540
    4644       dprintf(("DDRAW: Surface has locked Rectangles, check if the overlap\n"));
     4541      dprintf(("DDRAW: Surface has locked Rectangles, check if they overlap\n"));
    46454542
    46464543      i=0;
     
    46644561    {
    46654562      delete pIRectNew;
    4666       #ifdef DEBUG
    4667         dprintf(("DDRAW: SurfLock4: Surface already locked\n\n"));
    4668       #endif
     4563      dprintf(("DDRAW: SurfLock4: Surface already locked\n\n"));
    46694564      rc = DDERR_SURFACEBUSY;
    46704565    }
     
    46814576                                  (lpRect->top * me->dwPitchFB) +
    46824577                                  (lpRect->left * (lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount>>3)));
    4683       #ifdef DEBUG
    4684         dprintf(("DDRAW: SurfLock4 %08X (x,y) = (%d,%d)\n\n", lpSurfaceDesc->lpSurface, lpRect->top, lpRect->left));
    4685       #endif
     4578      dprintf(("DDRAW: SurfLock4 %08X (x,y) = (%d,%d)\n\n", lpSurfaceDesc->lpSurface, lpRect->top, lpRect->left));
    46864579    }
    46874580    else
    46884581    {
    4689       #ifdef DEBUG
    4690         dprintf(("DDRAW: SurfLock4 %08X \n\n", lpSurfaceDesc->lpSurface));
    4691       #endif
     4582      dprintf(("DDRAW: SurfLock4 %08X \n\n", lpSurfaceDesc->lpSurface));
    46924583    }
    46934584    // Add the rectangle to the list of locked rectangles
     
    47074598//******************************************************************************
    47084599//******************************************************************************
    4709 HRESULT __stdcall SurfReleaseDC(THIS This, HDC hdc)
     4600HRESULT WIN32API SurfReleaseDC(THIS This, HDC hdc)
    47104601{
    47114602 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    47154606   RGBQUAD           bmiCols[256];
    47164607 } BitmapInfo;
    4717  BITMAP bmpData;
    4718  char szError[256];
    4719  int i,rc;
    4720 
    4721   #ifdef DEBUG
    4722     dprintf(("DDRAW: SurfReleaseDC\n"));
    4723   #endif
     4608// BITMAP bmpData;
     4609 int rc;
     4610
     4611  dprintf(("DDRAW: SurfReleaseDC\n"));
    47244612
    47254613  if(hdc != me->hdcImage)
     
    47514639                      (PBITMAPINFO)&BitmapInfo,
    47524640                      DIB_RGB_COLORS);
     4641//      BitmapInfo.bmiHead.biHeight = -BitmapInfo.bmiHead.biHeight;
    47534642      dprintf( ("GetDIBits rc=%d\n Size   :%d\n Width  :%d\n Height :%d\n"
    47544643                " Planes :%d\n BitCount :%d\nLastEror = %d\nPixel[0,0] = 0x%02X\n",
     
    47614650                GetLastError(),
    47624651                ((char*)me->DDSurfaceDesc.lpSurface)[0]));
     4652
    47634653      rc = GetDIBits( hdc,
    47644654                      me->hbmImage,
     
    47894679      break;
    47904680    default:
    4791       #ifdef DEBUG
    4792         dprintf(("DDRAW: Unexptected BitCount %d => Surface unlocked but no data copied back\n",me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount));
    4793       #endif
     4681      dprintf(("DDRAW: Unexpected BitCount %d => Surface unlocked but no data copied back\n",me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount));
    47944682      // we might could keep the surface locked and return an error but this is more "safe"
    47954683      break;
     
    48144702//******************************************************************************
    48154703//******************************************************************************
    4816 HRESULT __stdcall SurfRestore(THIS)
    4817 {
    4818   #ifdef DEBUG
    4819     dprintf(("DDRAW: SurfRestore\n"));
    4820   #endif
     4704HRESULT WIN32API SurfRestore(THIS)
     4705{
     4706  dprintf(("DDRAW: SurfRestore\n"));
    48214707
    48224708  return(DD_OK);
     
    48244710//******************************************************************************
    48254711//******************************************************************************
    4826 HRESULT __stdcall SurfSetClipper(THIS This, LPDIRECTDRAWCLIPPER lpClipper)
     4712HRESULT WIN32API SurfSetClipper(THIS This, LPDIRECTDRAWCLIPPER lpClipper)
    48274713{
    48284714 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    48294715
    4830   #ifdef DEBUG
    4831     dprintf(("DDRAW: SurfSetClipper\n"));
    4832   #endif
     4716  dprintf(("DDRAW: SurfSetClipper %x %x", This, lpClipper));
    48334717
    48344718  if(lpClipper == NULL)
     
    48614745//******************************************************************************
    48624746//******************************************************************************
    4863 HRESULT __stdcall SurfSetColorKey(THIS  This, DWORD dwFlags, LPDDCOLORKEY lpDDColKey)
     4747HRESULT WIN32API SurfSetColorKey(THIS  This, DWORD dwFlags, LPDDCOLORKEY lpDDColKey)
    48644748{
    48654749  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    49134797//******************************************************************************
    49144798//******************************************************************************
    4915 HRESULT __stdcall SurfSetOverlayPosition(THIS This, LONG lX, LONG lY)
     4799HRESULT WIN32API SurfSetOverlayPosition(THIS This, LONG lX, LONG lY)
    49164800{
    49174801  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    49184802
    4919   #ifdef DEBUG
    4920     dprintf(("DDRAW: SurfSetOverlayPosition\n"));
    4921   #endif
     4803  dprintf(("DDRAW: SurfSetOverlayPosition\n"));
    49224804
    49234805  if( (me->DDSurfaceDesc.dwFlags & DDSD_CAPS) &&
     
    49424824//******************************************************************************
    49434825//******************************************************************************
    4944 HRESULT __stdcall SurfSetPalette(THIS This, LPDIRECTDRAWPALETTE lpPalette)
     4826HRESULT WIN32API SurfSetPalette(THIS This, LPDIRECTDRAWPALETTE lpPalette)
    49454827{
    49464828  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    49474829
    4948   #ifdef DEBUG
    4949     dprintf(("DDRAW: SurfSetPalette\n"));
    4950   #endif
     4830  dprintf(("DDRAW: SurfSetPalette\n"));
    49514831
    49524832  if(lpPalette == NULL)
     
    49994879//******************************************************************************
    50004880//******************************************************************************
    5001 HRESULT __stdcall SurfUnlock(THIS This, LPVOID lpSurfaceData)
     4881HRESULT WIN32API SurfUnlock(THIS This, LPVOID lpSurfaceData)
    50024882{
    50034883
     
    50094889  HRESULT rc;
    50104890
    5011   #ifdef DEBUG
    5012     dprintf(("DDRAW: SurfUnlock at %08X\n",lpSurfaceData));
    5013   #endif
     4891  dprintf(("DDRAW: SurfUnlock at %08X\n",lpSurfaceData));
    50144892
    50154893  if(me->fLocked == FALSE)
    50164894  {
    5017     #ifdef DEBUG
    5018       dprintf(("DDRAW: Surface not locked!\n"));
    5019     #endif
     4895    dprintf(("DDRAW: Surface not locked!\n"));
    50204896    return(DDERR_NOTLOCKED);
    50214897  }
    5022 
    5023   #ifdef DEBUG
    5024     dprintf(("DDRAW: Start Emuneration of Locked Rects\n"));
    5025   #endif
    50264898
    50274899  i=0;
     
    50334905    // this pointer in the locked rects DPA to unlock the right rect.
    50344906
    5035     while(i<DPA_GetPtrCount(me->DPA_LockedRects) && !Found)
     4907    while(i < DPA_GetPtrCount(me->DPA_LockedRects) && !Found)
    50364908    {
    50374909      pIRectEnum = (DDRectangle*)DPA_FastGetPtr(me->DPA_LockedRects,i);
     
    50474919      if(!Found)
    50484920      {
    5049         #ifdef DEBUG
    5050           dprintf(("DDRAW: Not Found, try Next rect\n"));
    5051         #endif
     4921        dprintf(("DDRAW: Not Found, try Next rect\n"));
    50524922        i++;
    50534923      }
    5054       #ifdef DEBUG
    50554924      else
    50564925      {
    50574926        dprintf(("DDRAW: Found Rect\n"));
    50584927      }
    5059       #endif
    50604928    }
    50614929  }
     
    50824950      if(!Found)
    50834951      {
    5084         #ifdef DEBUG
    5085           dprintf(("DDRAW: Not Found, try Next rect\n"));
    5086         #endif
     4952        dprintf(("DDRAW: Not Found, try Next rect\n"));
    50874953        i++;
    50884954      }
    5089       #ifdef DEBUG
    50904955      else
    50914956      {
    50924957        dprintf(("DDRAW: Found Rect\n"));
    50934958      }
    5094       #endif
    50954959    }
    50964960    delete pIRectUnlock;
     
    50994963  if(!Found)
    51004964  {
    5101     #ifdef DEBUG
    5102       dprintf(("DDRAW: Rectangle not locked, wrong Rect!\n\n"));
    5103     #endif
     4965    dprintf(("DDRAW: Rectangle not locked, wrong Rect!\n\n"));
    51044966    rc = DDERR_INVALIDRECT;
    51054967  }
    51064968  else
    51074969  {
    5108     #ifdef DEBUG
    5109       dprintf(("DDRAW: Remove Rect %d from Seq.\n",i));
    5110     #endif
     4970    dprintf(("DDRAW: Remove Rect %d from Seq.\n",i));
    51114971
    51124972    DPA_DeletePtr(me->DPA_LockedRects,i);
    51134973
    5114     #ifdef DEBUG
    5115       dprintf(("DDRAW: Test if locked Rects main\n"));
    5116     #endif
     4974    dprintf(("DDRAW: Test if locked Rects main\n"));
    51174975
    51184976    if(0==DPA_GetPtrCount(me->DPA_LockedRects))  // Do we have unlocked last rectangle
    51194977    {
    5120       #ifdef DEBUG
    5121         dprintf(("DDRAW: No Locked Rects left for surface\n"));
    5122       #endif
     4978      dprintf(("DDRAW: No Locked Rects left for surface\n"));
    51234979      me->fLocked = FALSE;
    51244980    }
     
    51314987    if(me->pFrameBuffer != me->pDiveBuffer)
    51324988    {
    5133       #ifdef DEBUG
    5134         dprintf(( "ColorConversion Needed %08X != %08X\n",
    5135                   me->pFrameBuffer,
    5136                   me->pDiveBuffer));
    5137       #endif
     4989      dprintf(( "ColorConversion Needed %08X != %08X\n",
     4990                me->pFrameBuffer,
     4991                me->pDiveBuffer));
    51384992      if(NULL!=lpSurfaceData)
    51394993      {
     
    51505004      }
    51515005    }
    5152     #ifdef DEBUG
    51535006    else
    51545007      dprintf( ("No ColorConversion Needed"));
    5155     #endif
    51565008
    51575009    // delete tne DDRectobject of the found rectangle
     
    51695021//******************************************************************************
    51705022//******************************************************************************
    5171 HRESULT __stdcall SurfUnlock4(THIS This, LPRECT lpSurfaceRect)
     5023HRESULT WIN32API SurfUnlock4(THIS This, LPRECT lpSurfaceRect)
    51725024{
    51735025  // MS changed the parameter from LPVOID to LPRECT with DX6
     
    51855037  HRESULT rc;
    51865038
    5187   #ifdef DEBUG
    5188     dprintf(("DDRAW: SurfUnlock4\n"));
    5189   #endif
     5039  dprintf(("DDRAW: SurfUnlock4\n"));
    51905040
    51915041  if(me->fLocked == FALSE)
    51925042  {
    5193     #ifdef DEBUG
    5194       dprintf(("DDRAW: Surface not locked!\n"));
    5195     #endif
     5043    dprintf(("DDRAW: Surface not locked!\n"));
    51965044    return(DDERR_NOTLOCKED);
    51975045  }
     
    52175065            pIRectUnlock->Right() ));
    52185066
    5219   #ifdef DEBUG
    5220     dprintf(("DDRAW: Start Emuneration of Locked Rects\n"));
    5221   #endif
     5067  dprintf(("DDRAW: Start Enumeration of Locked Rects\n"));
    52225068
    52235069  i=0;
     
    52345080    if(!Found)
    52355081    {
    5236       #ifdef DEBUG
    5237         dprintf(("DDRAW: Not Found, try Next rect\n"));
    5238       #endif
     5082      dprintf(("DDRAW: Not Found, try Next rect\n"));
    52395083      i++;
    52405084    }
    5241     #ifdef DEBUG
    52425085    else
    52435086    {
    52445087      dprintf(("DDRAW: Found Rect\n"));
    52455088    }
    5246     #endif
    52475089  }
    52485090
     
    52525094    if(NULL==lpSurfaceRect)
    52535095    {
    5254       #ifdef DEBUG
    5255         dprintf(("DDRAW: Rectangle not locked, wrong Rect!\n\n"));
    5256       #endif
     5096      dprintf(("DDRAW: Rectangle not locked, wrong Rect!\n\n"));
    52575097      return(DDERR_INVALIDRECT);
    52585098    }
     
    52625102  else
    52635103  {
    5264     #ifdef DEBUG
    5265       dprintf(("DDRAW: Remove Rect from Seq.\n"));
    5266     #endif
     5104    dprintf(("DDRAW: Remove Rect from Seq.\n"));
    52675105
    52685106    DPA_DeletePtr(me->DPA_LockedRects,i);
     
    52705108    if(0==DPA_GetPtrCount(me->DPA_LockedRects))  // Do we have unlocked last rectangle
    52715109    {
    5272       #ifdef DEBUG
    5273         dprintf(("DDRAW: No Locked Rects left for surface\n"));
    5274       #endif
     5110      dprintf(("DDRAW: No Locked Rects left for surface\n"));
    52755111      me->fLocked = FALSE;
    52765112    }
     
    52785114    if(me->pFrameBuffer != me->pDiveBuffer)
    52795115    {
    5280       #ifdef DEBUG
    5281         dprintf(( "ColorConversion Needed %08X != %08X\n",
    5282                   me->pFrameBuffer,
    5283                   me->pDiveBuffer));
    5284       #endif
     5116      dprintf(( "ColorConversion Needed %08X != %08X\n",
     5117                me->pFrameBuffer,
     5118                me->pDiveBuffer));
    52855119      me->ColorConversion(lpSurfaceRect);
    52865120    }
     
    52965130//******************************************************************************
    52975131//******************************************************************************
    5298 HRESULT __stdcall SurfUpdateOverlay(THIS This, LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX)
    5299 {
    5300   #ifdef DEBUG
    5301     dprintf(("DDRAW: SurfUpdateOverlay\n"));
    5302   #endif
     5132HRESULT WIN32API SurfUpdateOverlay(THIS This, LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX)
     5133{
     5134  dprintf(("DDRAW: SurfUpdateOverlay\n"));
    53035135  return(DD_OK);
    53045136}
    53055137//******************************************************************************
    53065138//******************************************************************************
    5307 HRESULT __stdcall SurfUpdateOverlay3(THIS This, LPRECT, LPDIRECTDRAWSURFACE3,LPRECT,DWORD, LPDDOVERLAYFX)
    5308 {
    5309   #ifdef DEBUG
    5310     dprintf(("DDRAW: SurfUpdateOverlay\n"));
    5311   #endif
     5139HRESULT WIN32API SurfUpdateOverlay3(THIS This, LPRECT, LPDIRECTDRAWSURFACE3,LPRECT,DWORD, LPDDOVERLAYFX)
     5140{
     5141  dprintf(("DDRAW: SurfUpdateOverlay\n"));
    53125142  return(DD_OK);
    53135143}
    53145144//******************************************************************************
    53155145//******************************************************************************
    5316 HRESULT __stdcall SurfUpdateOverlay4(THIS, LPRECT, LPDIRECTDRAWSURFACE4,LPRECT,DWORD, LPDDOVERLAYFX)
    5317 {
    5318   #ifdef DEBUG
    5319     dprintf(("DDRAW: SurfUpdateOverlay\n"));
    5320   #endif
     5146HRESULT WIN32API SurfUpdateOverlay4(THIS, LPRECT, LPDIRECTDRAWSURFACE4,LPRECT,DWORD, LPDDOVERLAYFX)
     5147{
     5148  dprintf(("DDRAW: SurfUpdateOverlay\n"));
    53215149  return(DD_OK);
    53225150}
    53235151//******************************************************************************
    53245152//******************************************************************************
    5325 HRESULT __stdcall SurfUpdateOverlayDisplay(THIS, DWORD)
    5326 {
    5327   #ifdef DEBUG
    5328     dprintf(("DDRAW: SurfUpdateOverlayDisplay\n"));
    5329   #endif
     5153HRESULT WIN32API SurfUpdateOverlayDisplay(THIS, DWORD)
     5154{
     5155  dprintf(("DDRAW: SurfUpdateOverlayDisplay\n"));
    53305156  return(DD_OK);
    53315157}
    53325158//******************************************************************************
    53335159//******************************************************************************
    5334 HRESULT __stdcall SurfUpdateOverlayZOrder(THIS, DWORD, LPDIRECTDRAWSURFACE2)
    5335 {
    5336   #ifdef DEBUG
    5337     dprintf(("DDRAW: SurfUpdateOverlayZOrder\n"));
    5338   #endif
     5160HRESULT WIN32API SurfUpdateOverlayZOrder(THIS, DWORD, LPDIRECTDRAWSURFACE2)
     5161{
     5162  dprintf(("DDRAW: SurfUpdateOverlayZOrder\n"));
    53395163  return(DD_OK);
    53405164}
    53415165//******************************************************************************
    53425166//******************************************************************************
    5343 HRESULT __stdcall SurfUpdateOverlayZOrder3(THIS, DWORD, LPDIRECTDRAWSURFACE3)
    5344 {
    5345   #ifdef DEBUG
    5346     dprintf(("DDRAW: SurfUpdateOverlayZOrder\n"));
    5347   #endif
     5167HRESULT WIN32API SurfUpdateOverlayZOrder3(THIS, DWORD, LPDIRECTDRAWSURFACE3)
     5168{
     5169  dprintf(("DDRAW: SurfUpdateOverlayZOrder\n"));
    53485170  return(DD_OK);
    53495171}
    53505172//******************************************************************************
    53515173//******************************************************************************
    5352 HRESULT __stdcall SurfUpdateOverlayZOrder4(THIS, DWORD, LPDIRECTDRAWSURFACE4)
    5353 {
    5354   #ifdef DEBUG
    5355     dprintf(("DDRAW: SurfUpdateOverlayZOrder4\n"));
    5356   #endif
     5174HRESULT WIN32API SurfUpdateOverlayZOrder4(THIS, DWORD, LPDIRECTDRAWSURFACE4)
     5175{
     5176  dprintf(("DDRAW: SurfUpdateOverlayZOrder4\n"));
    53575177  return(DD_OK);
    53585178}
    53595179//******************************************************************************
    53605180//******************************************************************************
    5361 HRESULT __stdcall SurfGetDDInterface(THIS This, LPVOID FAR *lplpDirectDraw)
     5181HRESULT WIN32API SurfGetDDInterface(THIS This, LPVOID FAR *lplpDirectDraw)
    53625182{
    53635183 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    53645184
    5365   #ifdef DEBUG
    5366     dprintf(("DDRAW: SurfGetDDInterface\n"));
    5367   #endif
     5185  dprintf(("DDRAW: SurfGetDDInterface\n"));
    53685186  *lplpDirectDraw = (LPVOID FAR *)me->lpDraw;
    53695187  return(DD_OK);
     
    53715189//******************************************************************************
    53725190//******************************************************************************
    5373 HRESULT __stdcall SurfPageLock(THIS, DWORD)
     5191HRESULT WIN32API SurfPageLock(THIS, DWORD)
    53745192{
    53755193  // Only used for DMA memory access
    53765194  // If we implement this for the None dive buffers with a pdd the we must change
    53775195  // from malloc to DosAllocMem and use OBJ_TILE flag
    5378   #ifdef DEBUG
    5379     dprintf(("DDRAW: SurfPageLock\n"));
    5380   #endif
     5196  dprintf(("DDRAW: SurfPageLock\n"));
    53815197  return(DD_OK);
    53825198}
    53835199//******************************************************************************
    53845200//******************************************************************************
    5385 HRESULT __stdcall SurfPageUnlock(THIS, DWORD)
    5386 {
    5387   #ifdef DEBUG
    5388     dprintf(("DDRAW: SurfPageUnlock\n"));
    5389   #endif
     5201HRESULT WIN32API SurfPageUnlock(THIS, DWORD)
     5202{
     5203  dprintf(("DDRAW: SurfPageUnlock\n"));
    53905204  return(DD_OK);
    53915205}
     
    53945208// V3 Interface Functions
    53955209
    5396 HRESULT __stdcall SurfSetSurfaceDesc(THIS This, LPDDSURFACEDESC lpSurfDesc, DWORD dwFlags)
    5397 {
    5398   #ifdef DEBUG
    5399     dprintf(("DDRAW: SurfSetSurfaceDesc\n"));
    5400   #endif
     5210HRESULT WIN32API SurfSetSurfaceDesc(THIS This, LPDDSURFACEDESC lpSurfDesc, DWORD dwFlags)
     5211{
     5212  dprintf(("DDRAW: SurfSetSurfaceDesc\n"));
    54015213
    54025214  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    54415253//******************************************************************************
    54425254//******************************************************************************
    5443 HRESULT __stdcall SurfSetSurfaceDesc4(THIS This, LPDDSURFACEDESC2 lpSurfDesc, DWORD dwFlags)
    5444 {
    5445   #ifdef DEBUG
    5446     dprintf(("DDRAW: SurfSetSurfaceDesc4\n"));
    5447   #endif
     5255HRESULT WIN32API SurfSetSurfaceDesc4(THIS This, LPDDSURFACEDESC2 lpSurfDesc, DWORD dwFlags)
     5256{
     5257  dprintf(("DDRAW: SurfSetSurfaceDesc4\n"));
    54485258
    54495259  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    54915301// V4 Interface Functions
    54925302
    5493 HRESULT __stdcall SurfSetPrivateData(THIS This, REFGUID refGUID, LPVOID lpData,
     5303HRESULT WIN32API SurfSetPrivateData(THIS This, REFGUID refGUID, LPVOID lpData,
    54945304                                     DWORD dwDataSize, DWORD dwFlags)
    54955305{
     
    55015311  HRESULT rc;
    55025312
    5503   #ifdef DEBUG
    5504     dprintf(("DDRAW: SurfSetPrivateData\n"));
    5505   #endif
     5313  dprintf(("DDRAW: SurfSetPrivateData\n"));
    55065314
    55075315  if(NULL==me)
     
    56765484//******************************************************************************
    56775485//******************************************************************************
    5678 HRESULT __stdcall SurfGetPrivateData(THIS This, REFGUID refGUID, LPVOID lpData, LPDWORD lpDataSize)
     5486HRESULT WIN32API SurfGetPrivateData(THIS This, REFGUID refGUID, LPVOID lpData, LPDWORD lpDataSize)
    56795487{
    56805488  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    56845492  BOOL bFound = FALSE;
    56855493
    5686   #ifdef DEBUG
    5687     dprintf(("DDRAW: SurfGetPrivateData\n"));
    5688   #endif
     5494  dprintf(("DDRAW: SurfGetPrivateData\n"));
    56895495
    56905496  if(NULL==me)
     
    57375543//******************************************************************************
    57385544//******************************************************************************
    5739 HRESULT __stdcall SurfFreePrivateData(THIS This, REFGUID refGUID)
     5545HRESULT WIN32API SurfFreePrivateData(THIS This, REFGUID refGUID)
    57405546{
    57415547  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    57445550  BOOL bFound = FALSE;
    57455551
    5746   #ifdef DEBUG
    5747     dprintf(("DDRAW: SurfFreePrivateData\n"));
    5748   #endif
     5552  dprintf(("DDRAW: SurfFreePrivateData\n"));
    57495553
    57505554  if(NULL==me)
     
    57875591//******************************************************************************
    57885592//******************************************************************************
    5789 HRESULT __stdcall SurfGetUniquenessValue(THIS This, LPDWORD lpValue)
    5790 {
    5791   #ifdef DEBUG
    5792     dprintf(("DDRAW: SurfGetUniquenessValue\n"));
    5793   #endif
     5593HRESULT WIN32API SurfGetUniquenessValue(THIS This, LPDWORD lpValue)
     5594{
     5595  dprintf(("DDRAW: SurfGetUniquenessValue\n"));
    57945596  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    57955597  if (NULL==lpValue)
     
    58015603//******************************************************************************
    58025604//******************************************************************************
    5803 HRESULT __stdcall SurfChangeUniquenessValue(THIS This)
     5605HRESULT WIN32API SurfChangeUniquenessValue(THIS This)
    58045606{
    58055607  OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
     
    58085610
    58095611
    5810   #ifdef DEBUG
    5811     dprintf(("DDRAW: SurfChangeUniquenessValue\n"));
    5812   #endif
     5612  dprintf(("DDRAW: SurfChangeUniquenessValue\n"));
    58135613  me->dwUniqueValue++;
    58145614
     
    59645764  DWORD dwTLineStart;     // # DWORD in which the first transinfo is
    59655765  DWORD dwTDWStart;       // byte in which the firs transinfo is
    5966   DWORD dwTrans;          // current transparentvalue
    5967   DWORD BlitWidth;
     5766
    59685767  dwTLineLen = 1 + ((pSrcDesc->dwWidth + 31) & ~31);
    59695768  pdwTLine = (DWORD*)pAlpha + (dwTLineLen* lpSrcRect->top);
Note: See TracChangeset for help on using the changeset viewer.