Changeset 850 for trunk/src


Ignore:
Timestamp:
Sep 6, 1999, 11:40:08 PM (26 years ago)
Author:
hugh
Message:

Fixed bug in pageflipping, constructor colorfill

Location:
trunk/src/ddraw
Files:
4 edited

Legend:

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

    r587 r850  
    3838  DWORD dwVSize, dwVType;
    3939  ULONG rc;
     40  FOURCC fccModes[100];
    4041
    4142  // Setup table for 3d devices
     
    139140  else
    140141  {
    141     WriteLog("DiveOpen OK\n");
     142    WriteLog("DiveOpen OK Framebuufer at 0x%08X\n",pFrameBuffer);
    142143  }
    143144  memset( &dCaps,
     
    145146          sizeof(DIVE_CAPS) );
    146147  dCaps.ulStructLen = sizeof(DIVE_CAPS);
     148  dCaps.ulFormatLength = 100;
     149  dCaps.pFormatData = &fccModes[0];
    147150
    148151  rc = DiveQueryCaps( &dCaps,
    149152                      DIVE_BUFFER_SCREEN);
     153
     154  WriteLog("DiveQueryCaps rc=0x%08X\n",rc);
    150155
    151156
     
    168173  if(hDive)
    169174    DiveClose(hDive);
    170   if(hDiveColorConv)
    171     DiveClose(hDiveColorConv);
    172175
    173176  // Safty call in case the program did set the pal to all black
     
    753756HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
    754757{
     758  DWORD dwSize;
     759
    755760  #ifdef DEBUG
    756761    WriteLog("DDGetCaps of ");
     
    766771    WriteLog("Driver\n");
    767772
    768     if(sizeof(DDCAPS)!=lpDDDriverCaps->dwSize)
    769     {
    770       WriteLog("Size Not Set\n");
     773    if( (sizeof(DDCAPS)!=lpDDDriverCaps->dwSize)     &&
     774        (sizeof(DDCAPS_DX5)!=lpDDDriverCaps->dwSize) &&
     775        (sizeof(DDCAPS_DX3)!=lpDDDriverCaps->dwSize) )
     776    {
     777      WriteLog( "Size %d Not supported ",
     778                lpDDDriverCaps->dwSize);
    771779      return(DDERR_INVALIDPARAMS);
    772780    }
    773781    // Clear structure so we only have to set the supported flags
    774782
    775 
    776     memset(lpDDDriverCaps,0,sizeof(DDCAPS));
     783    dwSize = lpDDDriverCaps->dwSize;
     784    memset( lpDDDriverCaps,
     785            0,
     786            lpDDDriverCaps->dwSize);
    777787
    778788
    779789    // Reset the size
    780     lpDDDriverCaps->dwSize = sizeof(DDCAPS);
     790    lpDDDriverCaps->dwSize = dwSize;
    781791
    782792    // Now report the CAPs back which we support
     
    789799
    790800    lpDDDriverCaps->dwCaps2 = DDCAPS2_CERTIFIED |         // Who cares so say yes
    791                               DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
     801                              //DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
    792802                              DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
    793803                              DDCAPS2_NONLOCALVIDMEM |    // All surfaces are in memory
     
    803813                                DDPCAPS_VSYNC  |        // Vsync yet
    804814                                DDPCAPS_PRIMARYSURFACE; //
    805     lpDDDriverCaps->dwVidMemTotal = 2048*1024;           // total video memory
    806     lpDDDriverCaps->dwVidMemFree  = 2048*1024;            // total free video memory
     815    lpDDDriverCaps->dwVidMemTotal = 4096*1024;          // total video memory
     816    lpDDDriverCaps->dwVidMemFree  = 4096*1024;          // total free video memory
    807817    lpDDDriverCaps->dwNumFourCCCodes;        // number of supported FOURCC codes
    808     lpDDDriverCaps->dwRops[DD_ROP_SPACE];    // supported raster ops
     818/*
     819    ToDo: must finde out ow the array is used for this
     820    lpDDDriverCaps->dwRops[DD_ROP_SPACE] = SRCCOPY |
     821                                           BLACKNESS |
     822                                           WHITENESS;  // Raster OPs implemented
     823*/
    809824    lpDDDriverCaps->dwSVBCaps = DDCAPS_BLT |              // We do blitting
    810825                                DDCAPS_BLTCOLORFILL |     // We do colorfills
     
    812827                                DDCAPS_COLORKEYHWASSIST;
    813828    lpDDDriverCaps->dwSVBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
    814     lpDDDriverCaps->dwSVBFXCaps;             //  .
    815     lpDDDriverCaps->dwSVBRops[DD_ROP_SPACE]; //  .
     829    lpDDDriverCaps->dwSVBFXCaps = DDCAPS_BLT |              // We do blitting
     830                                  DDCAPS_BLTCOLORFILL |     // We do colorfills
     831                                  DDCAPS_COLORKEY |         // We support Colorkeying
     832                                  DDCAPS_COLORKEYHWASSIST;
     833/*
     834    ToDo: must finde out ow the array is used for this
     835    lpDDDriverCaps->dwSVBRops[DD_ROP_SPACE] = SRCCOPY |
     836                                              BLACKNESS |
     837                                              WHITENESS;  // Raster OPs implemented
     838*/
    816839    lpDDDriverCaps->dwVSBCaps = DDCAPS_BLT |              // We do blitting
    817840                                DDCAPS_BLTCOLORFILL |     // We do colorfills
     
    819842                                DDCAPS_COLORKEYHWASSIST;
    820843    lpDDDriverCaps->dwVSBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
    821     lpDDDriverCaps->dwVSBFXCaps;             //  .
    822     lpDDDriverCaps->dwVSBRops[DD_ROP_SPACE]; //  .
     844    lpDDDriverCaps->dwVSBFXCaps = DDCAPS_BLT |              // We do blitting
     845                                  DDCAPS_BLTCOLORFILL |     // We do colorfills
     846                                  DDCAPS_COLORKEY |         // We support Colorkeying
     847                                  DDCAPS_COLORKEYHWASSIST;
     848/*
     849    ToDo: must finde out ow the array is used for this
     850    lpDDDriverCaps->dwVSBRops[DD_ROP_SPACE] = SRCCOPY |
     851                                              BLACKNESS |
     852                                              WHITENESS;  // Raster OPs implemented
     853*/
    823854    lpDDDriverCaps->dwSSBCaps = DDCAPS_BLT |              // We do blitting
    824855                                DDCAPS_BLTCOLORFILL |     // We do colorfills
     
    826857                                DDCAPS_COLORKEYHWASSIST;
    827858    lpDDDriverCaps->dwSSBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
    828     lpDDDriverCaps->dwSSBFXCaps;            //  .
    829     lpDDDriverCaps->dwSSBRops[DD_ROP_SPACE]; //  .
    830     lpDDDriverCaps->dwSVBCaps2 = DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
    831                                  DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
    832                                  DDCAPS2_WIDESURFACES;       // Any size you want!
    833     lpDDDriverCaps->dwNLVBCaps = DDCAPS_BLT |              // We do blitting
    834                                  DDCAPS_BLTCOLORFILL |     // We do colorfills
    835                                  DDCAPS_COLORKEY |         // We support Colorkeying
    836                                  DDCAPS_COLORKEYHWASSIST;
    837     lpDDDriverCaps->dwNLVBCaps2 = DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
    838                                   DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
    839                                   DDCAPS2_WIDESURFACES;       // Any size you want!
    840     lpDDDriverCaps->dwNLVBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
    841     lpDDDriverCaps->dwNLVBFXCaps;            //  .
    842     lpDDDriverCaps->dwNLVBRops[DD_ROP_SPACE];//  .
    843     DDSCAPS2 ddsCaps;                 // general surface caps
     859    lpDDDriverCaps->dwSSBFXCaps = DDCAPS_BLT |              // We do blitting
     860                                  DDCAPS_BLTCOLORFILL |     // We do colorfills
     861                                  DDCAPS_COLORKEY |         // We support Colorkeying
     862                                  DDCAPS_COLORKEYHWASSIST;
     863/*
     864    ToDo: must finde out ow the array is used for this
     865    lpDDDriverCaps->dwSSBRops[SRCCOPY]   = 1;
     866    lpDDDriverCaps->dwSSBRops[BLACKNESS] = 1;
     867    lpDDDriverCaps->dwSSBRops[WHITENESS] = 1;  // Raster OPs implemented
     868*/
     869    // These are ony in >DX5
     870    if(dwSize>sizeof(DDCAPS_DX3))
     871    {
     872      lpDDDriverCaps->dwSVBCaps2 = //DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
     873                                   DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
     874                                   DDCAPS2_WIDESURFACES;       // Any size you want!
     875      lpDDDriverCaps->dwNLVBCaps = DDCAPS_BLT |              // We do blitting
     876                                   DDCAPS_BLTCOLORFILL |     // We do colorfills
     877                                   DDCAPS_COLORKEY |         // We support Colorkeying
     878                                   DDCAPS_COLORKEYHWASSIST;
     879      lpDDDriverCaps->dwNLVBCaps2 = //DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
     880                                    DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
     881                                    DDCAPS2_WIDESURFACES;       // Any size you want!
     882      lpDDDriverCaps->dwNLVBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
     883      lpDDDriverCaps->dwNLVBFXCaps = DDCAPS_BLT |              // We do blitting
     884                                     DDCAPS_BLTCOLORFILL |     // We do colorfills
     885                                     DDCAPS_COLORKEY |         // We support Colorkeying
     886                                     DDCAPS_COLORKEYHWASSIST;
     887      lpDDDriverCaps->dwNLVBRops[DD_ROP_SPACE];//  ToDo: Again the array ...
     888
     889      // General Surface caps only in DX6
     890      if(dwSize>sizeof(DDCAPS_DX5))
     891      {
     892        lpDDDriverCaps->ddsCaps.dwCaps = DDSCAPS_ALPHA | DDSCAPS_BACKBUFFER |
     893                                         DDSCAPS_COMPLEX | DDSCAPS_FLIP |
     894                                         DDSCAPS_FRONTBUFFER | DDSCAPS_LOCALVIDMEM |
     895                                         DDSCAPS_NONLOCALVIDMEM | DDSCAPS_OFFSCREENPLAIN |
     896                                         // DDSCAPS_OVERLAY |
     897                                         DDSCAPS_PALETTE | DDSCAPS_PRIMARYSURFACE |
     898                                         DDSCAPS_SYSTEMMEMORY |DDSCAPS_VIDEOMEMORY |
     899                                         DDSCAPS_VISIBLE;
     900
     901      #ifdef USE_OPENGL
     902        lpDDDriverCaps->dwCaps |= DDCAPS_3D | DDCAPS_ZBLTS;
     903        // ToDO find and put the value for DDCAPS2_NO2DDURING3DSCENE in ddraw.h
     904        // lpDDDriverCaps->dwCaps2 |=  DDCAPS2_NO2DDURING3DSCENE;
     905        lpDDDriverCaps->ddsCaps.dwCaps |= DDSCAPS_3DDEVICE | DDSCAPS_MIPMAP |
     906                                          DDSCAPS_TEXTURE | DDSCAPS_ZBUFFER;
     907      #endif
     908      }
     909    }
     910
    844911
    845912  }
     
    13441411 ULONG rc;
    13451412 OS2IDirectDraw        *me = (OS2IDirectDraw *)This;
     1413 SETUP_BLITTER sBlt;
    13461414
    13471415  #ifdef DEBUG
     
    13521420  me->screenheight = dwHeight;
    13531421  me->screenbpp    = dwBPP;
    1354   if(me->screenbpp!=me->dCaps.ulDepth)
    1355   {
    1356     rc = DiveOpen( &me->hDiveColorConv,
    1357                    FALSE,
    1358                    0);
    1359     WriteLog("Screen in different mode than requested, open addional DIVE instance(rc=%X)\n\n",rc);
    1360 
    1361   }
    1362 //  _interrupt(3);
     1422
     1423  memset(&sBlt,0,sizeof(sBlt));
     1424  sBlt.ulStructLen = sizeof(sBlt);
     1425  sBlt.fccSrcColorFormat = FOURCC_SCRN;
     1426  sBlt.ulSrcWidth        = dwWidth;
     1427  sBlt.ulSrcHeight       = dwHeight;
     1428  sBlt.ulSrcPosX         = 0;
     1429  sBlt.ulSrcPosY         = 0;
     1430  sBlt.fccDstColorFormat = FOURCC_SCRN;
     1431  sBlt.ulDstWidth        = dwWidth;
     1432  sBlt.ulDstHeight       = dwHeight;
     1433  sBlt.lDstPosX          = 0;
     1434  sBlt.lDstPosY          = 0;
     1435  sBlt.lScreenPosX       = 0;
     1436  sBlt.lScreenPosY       = me->dCaps.ulVerticalResolution-dwHeight;
     1437  sBlt.ulNumDstRects     = DIVE_FULLY_VISIBLE;
     1438
     1439  rc = DiveSetupBlitter( me->hDive,
     1440                         &sBlt);
     1441
    13631442  return(DD_OK);
    13641443}
     
    13701449 ULONG rc;
    13711450 OS2IDirectDraw        *me = (OS2IDirectDraw *)This;
     1451 SETUP_BLITTER sBlt;
    13721452
    13731453#ifdef DEBUG
     
    13771457  me->screenheight = dwHeight;
    13781458  me->screenbpp    = dwBPP;
    1379   if(me->screenbpp!=me->dCaps.ulDepth)
    1380   {
    1381     rc = DiveOpen( &me->hDiveColorConv,
    1382                    FALSE,
    1383                    0);
    1384     WriteLog("Screen in different mode than requested, open addional DIVE instance(rc=%X)\n\n",rc);
    1385 
    1386   }
    1387 //  _interrupt(3);
     1459
     1460  memset(&sBlt,0,sizeof(sBlt));
     1461  sBlt.ulStructLen = sizeof(sBlt);
     1462  sBlt.fccSrcColorFormat = FOURCC_SCRN;
     1463  sBlt.ulSrcWidth        = dwWidth;
     1464  sBlt.ulSrcHeight       = dwHeight;
     1465  sBlt.ulSrcPosX         = 0;
     1466  sBlt.ulSrcPosY         = 0;
     1467  sBlt.fccDstColorFormat = FOURCC_SCRN;
     1468  sBlt.ulDstWidth        = dwWidth;
     1469  sBlt.ulDstHeight       = dwHeight;
     1470  sBlt.lDstPosX          = 0;
     1471  sBlt.lDstPosY          = 0;
     1472  sBlt.lScreenPosX       = 0;
     1473  sBlt.lScreenPosY       = me->dCaps.ulVerticalResolution-dwHeight;
     1474  sBlt.ulNumDstRects     = DIVE_FULLY_VISIBLE;
     1475
     1476  rc = DiveSetupBlitter( me->hDive,
     1477                         &sBlt);
     1478
    13881479  return(DD_OK);
    13891480}
  • trunk/src/ddraw/OS2PALETTE.CPP

    r587 r850  
    5050  memcpy((char *)os2pal, (char *)lpColorTable, palsize*sizeof(PALETTEENTRY));
    5151
     52  WriteLog("Init CC PalTable");
    5253  for(DWORD i=0;i<dwSize;i++)
    5354  {
     
    5556                ((lpColorTable[i].peGreen>>2) <<5) +
    5657                ((lpColorTable[i].peRed>>3) << 11);
     58    WriteLog( " # %d : RGB=%02X/%02X/%02X => %04X\n",
     59              i,
     60              lpColorTable[i].peRed,
     61              lpColorTable[i].peGreen,
     62              lpColorTable[i].peBlue,
     63              aPal16[i]);
    5764    aPal24[i] = (lpColorTable[i].peBlue <<8) +
    5865                (lpColorTable[i].peGreen<<16) +
     
    193200         dwNumEntries*sizeof(PALETTEENTRY));
    194201
     202  WriteLog("Setting up CC Palentries:\n");
    195203  for(DWORD i=0;i<dwNumEntries;i++)
    196204  {
     
    198206                           ((lpNewEntries[i].peGreen>>2) <<5) +
    199207                           ((lpNewEntries[i].peRed>>3) << 11);
     208    WriteLog( " # %d : RGB=%02X/%02X/%02X => %04X\n",
     209              dwBase+i,
     210              lpNewEntries[i].peRed,
     211              lpNewEntries[i].peGreen,
     212              lpNewEntries[i].peBlue,
     213              me->aPal16[dwBase+i]);
    200214    me->aPal24[dwBase+i] = (lpNewEntries[i].peBlue <<8) +
    201215                           (lpNewEntries[i].peGreen<<16) +
     
    213227      ((OS2IDirectDrawSurface*)((OS2IDirectDraw*)me->lpDraw)->pPrimSurf)->ColorConversion(NULL);;
    214228  }
    215   /*
    216   if(NULL!=me->hDiveCC)
    217   {
    218     DiveSetSourcePalette( me->hDiveCC,
    219                           dwBase,
    220                           dwNumEntries,
    221                           (PBYTE)lpNewEntries);
    222 
    223   }
    224   else
    225   {
    226     // Only usefull if system and game are in 8bit mode
    227     // 16bit games don't use palettes and setting the Phys palette
    228     // in >8Bit Modes has no effect.
    229 
    230     if(me->fAttachedToPrimary)
    231       me->SetPhysPalette();
    232   }
    233   */
    234229  return(DD_OK);
    235230}
  • trunk/src/ddraw/OS2SURFACE.CPP

    r587 r850  
    1717#include "asmutil.h"
    1818#include <winerror.h>
    19 
     19#include <os2win.h>
    2020#ifndef __WATCOMC__
    2121  #include <builtin.h>
     
    2424extern FOURCC  SupportedFourCCs[];
    2525// ToDo: Move the following 2 defines in the right WINE headers.
     26BYTE DefaultPalette[] = { 0x00,0x00,0x00,   // 0
     27                          0x80,0x00,0x00,   // 1
     28                          0x00,0x80,0x00,   // 2
     29                          0x80,0x80,0x00,   // 3
     30                          0x00,0x00,0x80,   // 4
     31                          0x80,0x00,0x80,   // 5
     32                          0x00,0x80,0x80,   // 6
     33                          0xC0,0xC0,0xC0,   // 7
     34                          0xC0,0xDC,0xC0,   // 8
     35                          0xA6,0xCA,0xF0,   // 9
     36                          0x04,0x04,0x04,   // 10
     37                          0x08,0x08,0x08,   // 11
     38                          0x0C,0x0C,0x0C,   // 12
     39                          0x11,0x11,0x11,   // 13
     40                          0x16,0x16,0x16,   // 14
     41                          0x1C,0x1C,0x1C,   // 15
     42                          0x22,0x22,0x22,   // 16
     43                          0x29,0x29,0x29,   // 17
     44                          0x55,0x55,0x55,   // 18
     45                          0x4D,0x4D,0x4D,
     46                          0x42,0x42,0x42,
     47                          0x39,0x39,0x39,
     48                          0x81,0x81,0x81,
     49                          0x81,0x00,0x00,
     50                          0x00,0x81,0x00,
     51                          0x81,0x81,0x00,
     52                          0x00,0x00,0x81,
     53                          0x81,0x00,0x81,
     54                          0x00,0x81,0x81,
     55                          0x33,0x00,0x00,
     56                          0x66,0x00,0x00,
     57                          0x99,0x00,0x00,
     58                          0xCC,0x00,0x00,
     59                          0x00,0x33,0x00,
     60                          0x33,0x33,0x00,
     61                          0x66,0x33,0x00,
     62                          0x99,0x33,0x00,
     63                          0xCC,0x33,0x00,
     64                          0xFF,0x33,0x00,
     65                          0x00,0x66,0x00,
     66                          0x33,0x66,0x00,
     67                          0x66,0x66,0x00,
     68                          0x99,0x66,0x00,
     69                          0xCC,0x66,0x00,
     70                          0xFF,0x66,0x00,
     71                          0x00,0x99,0x00,
     72                          0x33,0x99,0x00,
     73                          0x66,0x99,0x00,
     74                          0x99,0x99,0x00,
     75                          0xCC,0x99,0x00,
     76                          0xFF,0x99,0x00,
     77                          0x00,0xCC,0x00,
     78                          0x33,0xCC,0x00,
     79                          0x66,0xCC,0x00,
     80                          0x99,0xCC,0x00,
     81                          0xCC,0xCC,0x00,
     82                          0xFF,0xCC,0x00,
     83                          0x66,0xFF,0x00,
     84                          0x99,0xFF,0x00,
     85                          0xCC,0xFF,0x00,
     86                          0x00,0x00,0x33,
     87                          0x33,0x00,0x33,
     88                          0x66,0x00,0x33,
     89                          0x99,0x00,0x33,
     90                          0xCC,0x00,0x33,
     91                          0xFF,0x00,0x33,
     92                          0x00,0x33,0x33,
     93                          0x33,0x33,0x33,
     94                          0x66,0x33,0x33,
     95                          0x99,0x33,0x33,
     96                          0xCC,0x33,0x33,
     97                          0xFF,0x33,0x33,
     98                          0x00,0x66,0x33,
     99                          0x33,0x66,0x33,
     100                          0x66,0x66,0x33,
     101                          0x99,0x66,0x33,
     102                          0xCC,0x66,0x33,
     103                          0xFF,0x66,0x33,
     104                          0x00,0x99,0x33,
     105                          0x33,0x99,0x33,
     106                          0x66,0x99,0x33,
     107                          0x99,0x99,0x33,
     108                          0xCC,0x99,0x33,
     109                          0xFF,0x99,0x33,
     110                          0x00,0xCC,0x33,
     111                          0x33,0xCC,0x33,
     112                          0x66,0xCC,0x33,
     113                          0x99,0xCC,0x33,
     114                          0xCC,0xCC,0x33,
     115                          0xFF,0xCC,0x33,
     116                          0x33,0xFF,0x33,
     117                          0x66,0xFF,0x33,
     118                          0x99,0xFF,0x33,
     119                          0xCC,0xFF,0x33,
     120                          0xFF,0xFF,0x33,
     121                          0x00,0x00,0x66,
     122                          0x33,0x00,0x66,
     123                          0x66,0x00,0x66,
     124                          0x99,0x00,0x66,
     125                          0xCC,0x00,0x66,
     126                          0xFF,0x00,0x66,
     127                          0x00,0x33,0x66,
     128                          0x33,0x33,0x66,
     129                          0x66,0x33,0x66,
     130                          0x99,0x33,0x66,
     131                          0xCC,0x33,0x66,
     132                          0xFF,0x33,0x66,
     133                          0x00,0x66,0x66,
     134                          0x33,0x66,0x66,
     135                          0x66,0x66,0x66,
     136                          0x99,0x66,0x66,
     137                          0xCC,0x66,0x66,
     138                          0x00,0x99,0x66,
     139                          0x33,0x99,0x66,
     140                          0x66,0x99,0x66,
     141                          0x99,0x99,0x66,
     142                          0xCC,0x99,0x66,
     143                          0xFF,0x99,0x66,
     144                          0x00,0xCC,0x66,
     145                          0x33,0xCC,0x66,
     146                          0x99,0xCC,0x66,
     147                          0xCC,0xCC,0x66,
     148                          0xFF,0xCC,0x66,
     149                          0x00,0xFF,0x66,
     150                          0x33,0xFF,0x66,
     151                          0x99,0xFF,0x66,
     152                          0xCC,0xFF,0x66,
     153                          0xFF,0x00,0xCC,
     154                          0xCC,0x00,0xFF,
     155                          0x00,0x99,0x99,
     156                          0x99,0x33,0x99,
     157                          0x99,0x00,0x99,
     158                          0xCC,0x00,0x99,
     159                          0x00,0x00,0x99,
     160                          0x33,0x33,0x99,
     161                          0x66,0x00,0x99,
     162                          0xCC,0x33,0x99,
     163                          0xFF,0x00,0x99,
     164                          0x00,0x66,0x99,
     165                          0x33,0x33,0x99,
     166                          0x33,0x66,0x99,
     167                          0x66,0x33,0x99,
     168                          0x99,0x33,0x99,
     169                          0xCC,0x66,0x99,
     170                          0xFF,0x33,0x99,
     171                          0x33,0x99,0x99,
     172                          0x66,0x99,0x99,
     173                          0x99,0x99,0x99,
     174                          0xCC,0x99,0x99,
     175                          0xFF,0x99,0x99,
     176                          0x00,0xCC,0x99,
     177                          0x33,0xCC,0x99,
     178                          0x66,0xCC,0x66,
     179                          0x99,0xCC,0x99,
     180                          0xCC,0xCC,0x99,
     181                          0xFF,0xCC,0x99,
     182                          0x00,0xFF,0x99,
     183                          0x33,0xFF,0x99,
     184                          0x66,0xCC,0x99,
     185                          0x99,0xFF,0x99,
     186                          0xCC,0xFF,0x99,
     187                          0xFF,0xFF,0x99,
     188                          0x00,0x00,0xCC,
     189                          0x33,0x00,0x99,
     190                          0x66,0x00,0xCC,
     191                          0x99,0x00,0xCC,
     192                          0xCC,0x00,0xCC,
     193                          0x00,0x33,0x99,
     194                          0x33,0x33,0xCC,
     195                          0x66,0x33,0xCC,
     196                          0x99,0x33,0xCC,
     197                          0xCC,0x33,0xCC,
     198                          0xFF,0x33,0xCC,
     199                          0x00,0x66,0xCC,
     200                          0x33,0x66,0xCC,
     201                          0x66,0x66,0x99,
     202                          0x99,0x66,0xCC,
     203                          0xCC,0x66,0xCC,
     204                          0xFF,0x66,0x99,
     205                          0x00,0x99,0xCC,
     206                          0x33,0x99,0xCC,
     207                          0x66,0x99,0xCC,
     208                          0x99,0x99,0xCC,
     209                          0xCC,0x99,0xCC,
     210                          0xFF,0x99,0xCC,
     211                          0x00,0xCC,0xCC,
     212                          0x33,0xCC,0xCC,
     213                          0x66,0xCC,0xCC,
     214                          0x99,0xCC,0xCC,
     215                          0xCC,0xCC,0xCC,
     216                          0xFF,0xCC,0xCC,
     217                          0x00,0xFF,0xCC,
     218                          0x33,0xFF,0xCC,
     219                          0x66,0xFF,0x99,
     220                          0x99,0xFF,0xCC,
     221                          0xCC,0xFF,0xCC,
     222                          0xFF,0xFF,0xCC,
     223                          0x33,0x00,0xCC,
     224                          0x66,0x00,0xFF,
     225                          0x99,0x00,0xFF,
     226                          0x00,0x33,0xCC,
     227                          0x33,0x33,0xFF,
     228                          0x66,0x33,0xFF,
     229                          0x99,0x33,0xFF,
     230                          0xCC,0x33,0xFF,
     231                          0xFF,0x33,0xFF,
     232                          0x00,0x66,0xFF,
     233                          0x33,0x66,0xFF,
     234                          0x66,0x66,0xCC,
     235                          0x99,0x66,0xFF,
     236                          0xCC,0x66,0xFF,
     237                          0xFF,0x66,0xCC,
     238                          0x00,0x99,0xFF,
     239                          0x33,0x99,0xFF,
     240                          0x66,0x99,0xFF,
     241                          0x99,0x99,0xFF,
     242                          0xCC,0x99,0xFF,
     243                          0xFF,0x99,0xFF,
     244                          0x00,0xCC,0xFF,
     245                          0x33,0xCC,0xFF,
     246                          0x66,0xCC,0xFF,
     247                          0x99,0xCC,0xFF,
     248                          0xCC,0xCC,0xFF,
     249                          0xFF,0xCC,0xFF,
     250                          0x33,0xFF,0xFF,
     251                          0x66,0xFF,0xCC,
     252                          0x99,0xFF,0xFF,
     253                          0xCC,0xFF,0xFF,
     254                          0xFF,0x66,0x66,
     255                          0x66,0xFF,0x66,
     256                          0xFF,0xFF,0x66,
     257                          0x66,0x66,0xFF,
     258                          0xFF,0x66,0xFF,
     259                          0x66,0xFF,0xFF,
     260                          0xC1,0xC1,0xC1,
     261                          0x5F,0x5F,0x5F,
     262                          0x77,0x77,0x77,
     263                          0x86,0x86,0x86,
     264                          0x96,0x96,0x96,
     265                          0xCB,0xCB,0xCB,
     266                          0xB2,0xB2,0xB2,
     267                          0xD7,0xD7,0xD7,
     268                          0xDD,0xDD,0xDD,
     269                          0xE3,0xE3,0xE3,
     270                          0xEA,0xEA,0xEA,
     271                          0xF1,0xF1,0xF1,
     272                          0xF8,0xF8,0xF8,
     273                          0xFF,0xFB,0xF0,
     274                          0xA0,0xA0,0xA4,
     275                          0x80,0x80,0x80,
     276                          0xFF,0x00,0x00,
     277                          0x00,0xFF,0x00,
     278                          0xFF,0xFF,0x00,
     279                          0x00,0x00,0xFF,
     280                          0xFF,0x00,0xFF,
     281//                          0x00,0xFF,0xFF,
     282                          0xFF,0xFF,0xFF};
     283
     284WORD wDefaultPalete16[256];
     285BOOL fPalInit=FALSE;
    26286
    27287#define CBM_CREATEDIB   0x02L   /* create DIB bitmap */
     
    113373    if (flags[i].mask & flagmask)
    114374      WriteLog("%s ",flags[i].name);
     375  WriteLog("\n");
    115376}
    116377
     
    411672      // Check if OS/2 is running in the requested colormode
    412673
     674      diveBufNr    = DIVE_BUFFER_SCREEN;
    413675      if( lpDraw->dCaps.ulDepth == lpDraw->GetScreenBpp() )
    414676      {
     
    417679        // Yes so direct access to framebuffer is possible
    418680
    419         diveBufNr    = DIVE_BUFFER_SCREEN;
    420681        pFrameBuffer = lpDraw->GetFrameBuffer();
    421682        pDiveBuffer  = pFrameBuffer;
     
    557818
    558819          BackBuffer = new OS2IDirectDrawSurface(lpDraw, &ComplexSurfaceDesc, TRUE, TRUE);
     820
    559821          if (BackBuffer->GetLastError()==DD_OK)
    560822          {
     823            WriteLog("created backbuffer");
    561824            // Our Primary Buffer is also the frontbuffer of a flipchain
    562             DDSurfaceDesc.dwFlags |= DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP;
     825            DDSurfaceDesc.ddsCaps.dwCaps    |= DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP;
     826            lpDDSurfaceDesc->ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER | DDSCAPS_FLIP;
    563827            BackBuffer->SetFrontBuffer(this);
     828          }
     829          else
     830          {
     831            WriteLog("Error creating backbuffer");
    564832          }
    565833        }
     
    8101078            {
    8111079              WriteLog("with DIVE\n");
    812               // This surface is part of flipchain with the primary surface use dive to alloc
     1080              // This surface is part of flipchain with the primary surface use dive to assoc memory
     1081              pDiveBuffer = (char*)malloc( lpDDSurfaceDesc->dwHeight *
     1082                                           dwPitchDB);
    8131083              diveBufNr = 0;
    814               DiveAllocImageBuffer( hDive,
    815                                     &diveBufNr,
    816                                     lpDraw->dCaps.fccColorEncoding,
    817                                     lpDDSurfaceDesc->dwWidth,
    818                                     lpDDSurfaceDesc->dwHeight,
    819                                     dwPitchDB,
    820                                     (PBYTE)pDiveBuffer);
     1084              rc = DiveAllocImageBuffer( hDive,
     1085                                         &diveBufNr,
     1086                                         lpDraw->dCaps.fccColorEncoding,
     1087                                         lpDDSurfaceDesc->dwWidth,
     1088                                         lpDDSurfaceDesc->dwHeight,
     1089                                         dwPitchDB,
     1090                                         (PBYTE)pDiveBuffer);
     1091               WriteLog("rc = 0x%08X\n",rc);
    8211092            }
    8221093            else
     
    9521223
    9531224  DWORD *pColor, dwColor,y;
    954 
    955   #ifdef DEBUG
    956     WriteLog("ColorFill\n");
     1225  DWORD *pPal24;
     1226  WORD  *pPal16;
     1227  #ifdef DEBUG
     1228    WriteLog("ColorFill with %08X\n", dwFillColor);
    9571229  #endif
    9581230
     
    9711243  else
    9721244  {
     1245    WriteLog("Fill all at addr ");
    9731246    FillWidth  = width;
    9741247    FillHeight = height -1;
    9751248    pLine = pDiveBuffer;
    9761249  }
    977 
     1250  WriteLog("0x%08X (%d/%d) at\n", pLine,FillWidth,FillHeight);
     1251
     1252  if(pDiveBuffer!=pFrameBuffer)
     1253  {
     1254    if( (NULL== lpDraw->pPrimSurf) ||
     1255        (NULL== ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette) )
     1256    {
     1257      if(!fPalInit)
     1258      {
     1259        for(DWORD i=0;i<256;i++)
     1260        {
     1261          wDefaultPalete16[i] = (DefaultPalette[i*3+2]>>3) +
     1262                                ((DefaultPalette[i*3+1]>>2) <<5) +
     1263                                ((DefaultPalette[i*3]>>3) << 11);
     1264          WriteLog( " # %d : RGB=%02X/%02X/%02X => %04X\n",
     1265                    i,
     1266                    DefaultPalette[i*3],
     1267                    DefaultPalette[i*3+1],
     1268                    DefaultPalette[i*3+2],
     1269                    wDefaultPalete16[i]);
     1270         // aPal24[i] = (lpColorTable[i].peBlue <<8) +
     1271         //             (lpColorTable[i].peGreen<<16) +
     1272         //             (lpColorTable[i].peRed<<24);
     1273        }
     1274        fPalInit = TRUE;
     1275      }
     1276      pPal16 = &wDefaultPalete16[0];
     1277    }
     1278    else
     1279    {
     1280      pPal16 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal16;
     1281      pPal24 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal24;
     1282    }
     1283  }
    9781284
    9791285  switch(dwBytesPPDive)
    9801286  {
    9811287    case 1:
     1288      WriteLog("8 Bit\n");
    9821289      dwColor = (dwFillColor<<24) + (dwFillColor<<16) +
    9831290                (dwFillColor<<8)  + (dwFillColor);
     
    9881295         pFillPos = (char*) (&pColor[i-1]);
    9891296        for(i=0;i<FillWidth % 4;i++)
    990          pFillPos[i] = (UCHAR) dwColor;
     1297           pFillPos[i] = (UCHAR) dwColor;
    9911298      }
    9921299      break;
    9931300    case 2:
     1301      WriteLog("16 Bit\n");
     1302      if(pDiveBuffer!=pFrameBuffer)
     1303      {
     1304        if(8==lpDraw->GetScreenBpp())
     1305          dwFillColor = pPal16[dwFillColor];
     1306      }
    9941307      dwColor = (dwFillColor<<16) + (dwFillColor);
     1308      WriteLog("Fill with 0x%08X\n",dwColor);
    9951309      for(i=0,pColor = (DWORD*)pLine;i<(FillWidth/2);i++)
    9961310        pColor[i] = dwColor;
     
    10021316      break;
    10031317    case 3:
     1318      WriteLog("24 Bit\n");
     1319
    10041320      dwColor = (dwFillColor<<8);
    10051321      for(i=0 ; i<FillWidth ; i++)
     
    10101326      break;
    10111327    case 4:
     1328      WriteLog("32 Bit\n");
    10121329      dwColor = dwFillColor;
    10131330      for(i=0,pColor = (DWORD*)pLine;i<FillWidth;i++)
     
    10231340
    10241341  pFillPos = pLine + dwPitchDB;
    1025 
     1342  FillWidth = FillWidth*dwBytesPPDive;;
    10261343  for( y=0;y<FillHeight;y++,pFillPos+=dwPitchDB)
    10271344  {
     
    11901507  WORD  *pPal16;
    11911508
    1192   if(NULL== lpDraw->pPrimSurf)
    1193   {
    1194     WriteLog("No Primary Surface! => No CC\n");
    1195     return;
    1196   }
    1197 
    1198   if(NULL== ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette)
    1199   {
    1200     WriteLog("No DDrawpalette defined!=> No CC\n");
    1201     return;
     1509  if( (NULL== lpDraw->pPrimSurf) ||
     1510      (NULL== ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette) )
     1511  {
     1512    if(!fPalInit)
     1513    {
     1514      for(DWORD i=0;i<256;i++)
     1515      {
     1516          wDefaultPalete16[i] = (DefaultPalette[i*3+2]>>3) +
     1517                                ((DefaultPalette[i*3+1]>>2) <<5) +
     1518                                ((DefaultPalette[i*3]>>3) << 11);
     1519        WriteLog( " # %d : RGB=%02X/%02X/%02X => %04X\n",
     1520                  i,
     1521                  DefaultPalette[i*3],
     1522                  DefaultPalette[i*3+1],
     1523                  DefaultPalette[i*3+2],
     1524                  wDefaultPalete16[i]);
     1525       // aPal24[i] = (lpColorTable[i].peBlue <<8) +
     1526       //             (lpColorTable[i].peGreen<<16) +
     1527       //             (lpColorTable[i].peRed<<24);
     1528      }
     1529      fPalInit = TRUE;
     1530    }
     1531    pPal16 = &wDefaultPalete16[0];
     1532  }
     1533  else
     1534  {
     1535    pPal16 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal16;
     1536    pPal24 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal24;
    12021537  }
    12031538
     
    12441579      if(8==lpDraw->GetScreenBpp())
    12451580      {
    1246         pPal16 = ((OS2IDirectDrawSurface*)lpDraw->pPrimSurf)->lpPalette->aPal16;
    12471581        WriteLog("8->16Bit CC\n");
    12481582        for(y=0;CCheight;CCheight--,y++)
    12491583        {
    1250           WriteLog("Converting Line %d\n",y);
    12511584          for(x=0;x<width;x++)
    12521585          {
     
    12691602      else
    12701603      {
    1271         WriteLog("%d ->16Bit Not implemented",lpDraw->GetScreenBpp());
     1604        WriteLog("%d ->24Bit Not implemented",lpDraw->GetScreenBpp());
    12721605      }
    12731606      break;
     
    12791612      else
    12801613      {
    1281         WriteLog("%d ->16Bit Not implemented",lpDraw->GetScreenBpp());
     1614        WriteLog("%d ->32Bit Not implemented",lpDraw->GetScreenBpp());
    12821615      }
    12831616      break;
     
    14701803  if (NULL==NewFBuffer)
    14711804  {
     1805
     1806    WriteLog("Remove Frontbuffer\n");
     1807
    14721808    // The real Frontbuffer was removed check if I'm now the one
    14731809    if(NULL!=BackBuffer)
    14741810    {
     1811      WriteLog("We have the a backbuffer so we're the Frontbuffer\n");
     1812      NextFlip = BackBuffer;
    14751813      DDSurfaceDesc.ddsCaps.dwCaps &= ~DDSCAPS_BACKBUFFER;
    14761814      DDSurfaceDesc.ddsCaps.dwCaps |=  DDSCAPS_FRONTBUFFER;
     
    14801818    {
    14811819      // Flipchain is destroyed
     1820      WriteLog("No longer part of a flipchain\n");
    14821821      DDSurfaceDesc.ddsCaps.dwCaps &= ~(DDSCAPS_BACKBUFFER | DDSCAPS_FLIP);
    14831822    }
     
    14851824  else
    14861825  {
     1826    WriteLog("Set new Frontbuffer to 0x%08X\n",NewFBuffer);
    14871827    if(NULL==NewFBuffer->GetFrontBuffer())
    14881828    {
     1829      WriteLog("We're the 1st backbuffer\n");
    14891830      DDSurfaceDesc.ddsCaps.dwCaps |=  DDSCAPS_BACKBUFFER | DDSCAPS_FLIP;
     1831      FrontBuffer->NextFlip = this;
    14901832    }
    14911833    else
    14921834    {
     1835      WriteLog("We are oe of many buffers\n");
    14931836      DDSurfaceDesc.ddsCaps.dwCaps &=  ~DDSCAPS_BACKBUFFER ;
    14941837      DDSurfaceDesc.ddsCaps.dwCaps |=  DDSCAPS_FLIP;
     
    17702113    }
    17712114  }
    1772 
     2115  WriteLog("Surface attached\n");
    17732116  return(DD_OK);
    17742117}
     
    32733616  LPVOID Data;
    32743617  char *pcrFB,*pcFB,*pcrDB,*pcDB;
     3618  ULONG rc;
    32753619
    32763620  #ifdef DEBUG
     
    32843628      WriteLog("Flip called on none Frontbuffer/Flip surface\n Flags:\n");
    32853629      _dump_DDSCAPS(me->DDSurfaceDesc.ddsCaps.dwCaps);
     3630      WriteLog("\n");
    32863631    #endif
    32873632    return(DDERR_NOTFLIPPABLE);
     
    32903635  if(NULL!=lpDDSurf)
    32913636  {
     3637    #ifdef DEBUG
     3638      WriteLog("Check if Surface is in Flipchain!\n");
     3639    #endif
     3640
    32923641    // We got an override surface check if it is in the flipchain
    32933642    FlipSurface = (OS2IDirectDrawSurface*) lpDDSurf;
     
    33073656  }
    33083657  else
     3658  {
    33093659    FlipSurface = me->NextFlip; // Take the next Surface in the Flipchain
    3310 
     3660    #ifdef DEBUG
     3661      WriteLog("Next Surface @ 0x%08X\n",FlipSurface);
     3662    #endif
     3663  }
    33113664
    33123665  if((me->fLocked)||(FlipSurface->fLocked))
     
    33203673  if(-1 != me->diveBufNr)
    33213674  {
     3675    #ifdef DEBUG
     3676      WriteLog("DIVE Flipchain");
     3677    #endif
     3678
    33223679    // we got some DIVE surfaces
    33233680    // On Dive Buffers More then Double buffering won't get any perf. gain
     
    33253682    // Doulebuffering should work best.
    33263683
    3327     DiveBlitImage(me->hDive, FlipSurface->diveBufNr, me->diveBufNr);
     3684    rc = DiveBlitImage(me->hDive, FlipSurface->diveBufNr, me->diveBufNr);
     3685
     3686    #ifdef DEBUG
     3687      WriteLog("DiveBlitImage rc = 0x%08X\n");
     3688    #endif
    33283689
    33293690    if(NULL==lpDDSurf)
     
    33353696  else
    33363697  {
     3698    #ifdef DEBUG
     3699      WriteLog("Memory Flipchain");
     3700    #endif
    33373701    // Memory Flipchain
    33383702    //
     
    33463710    //                               Memory:      11  22  33     22  33  11
    33473711    //
     3712
    33483713    Data  = me->DDSurfaceDesc.lpSurface;
    33493714    pcrFB = me->pFBreal;
     
    35833948 DDSURFACEDESC2        LockedSurfaceDesc;
    35843949 HRESULT rc;
     3950 BITMAP bmpSurface;
    35853951 struct
    35863952 {
     
    36223988      (me->hbmImage == NULL) )
    36233989  {
     3990    WriteLog( "Trying to create Bitmap (%d/%d) at %d Bit\n",
     3991              LockedSurfaceDesc.lPitch/ (LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount>>3),
     3992              LockedSurfaceDesc.dwHeight,
     3993              LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount
     3994            );
     3995    #if 0
    36243996    memset(&BitmapInfo, 0, sizeof(BitmapInfo));
    36253997    BitmapInfo.bmiHead.biSize   = sizeof(BITMAPINFOHEADER);
     
    36284000    BitmapInfo.bmiHead.biPlanes = 1;
    36294001    BitmapInfo.bmiHead.biBitCount    = LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
     4002    #else
     4003    bmpSurface.bmType       = 0;
     4004    bmpSurface.bmWidth      = LockedSurfaceDesc.dwWidth;
     4005    bmpSurface.bmHeight     = LockedSurfaceDesc.dwHeight;
     4006    bmpSurface.bmWidthBytes = LockedSurfaceDesc.lPitch;
     4007    bmpSurface.bmPlanes     = 1;
     4008    bmpSurface.bmBits       = LockedSurfaceDesc.lpSurface;
     4009    #endif
    36304010    switch(LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
    36314011    {
    36324012      case 1:
    36334013      case 4:
     4014        WriteLog("1/4 Bit Not yet supported\n");
     4015        break;
    36344016      case 8:
     4017        #if 0
    36354018        BitmapInfo.bmiHead.biCompression = BI_RGB;
    36364019        GetSystemPaletteEntries(me->hdcImage,0,255,(PPALETTEENTRY)&BitmapInfo.bmiCols[0]);
     
    36414024                                       (PBITMAPINFO)&BitmapInfo,
    36424025                                       DIB_RGB_COLORS);
     4026        #else
     4027        bmpSurface.bmBitsPixel  = 8;
     4028        me->hbmImage = CreateBitmapIndirect( &bmpSurface);
     4029        #endif
    36434030        break;
    36444031      case 16:
    36454032      case 32:
    3646         BitmapInfo.bmiHead.biCompression = BI_BITFIELDS;
    3647         BitmapInfo.bmiHead.biClrUsed     = 3;
    3648         *((DWORD *) &(BitmapInfo.bmiCols[0])) = LockedSurfaceDesc.ddpfPixelFormat.dwRBitMask;
    3649         *((DWORD *) &(BitmapInfo.bmiCols[1])) = LockedSurfaceDesc.ddpfPixelFormat.dwGBitMask;
    3650         *((DWORD *) &(BitmapInfo.bmiCols[2])) = LockedSurfaceDesc.ddpfPixelFormat.dwBBitMask;
    3651         me->hbmImage = CreateDIBitmap(me->hdcImage,NULL,CBM_CREATEDIB,LockedSurfaceDesc.lpSurface,
    3652                                       (PBITMAPINFO)&BitmapInfo,DIB_RGB_COLORS);
     4033        WriteLog("16/32 Bit not supported by OS/2");
    36534034        break;
    36544035      case 24:
     4036        #if 0
    36554037        BitmapInfo.bmiHead.biCompression = BI_RGB;
    3656         me->hbmImage = CreateDIBitmap(me->hdcImage,NULL,CBM_CREATEDIB,LockedSurfaceDesc.lpSurface,
    3657                                       (PBITMAPINFO)&BitmapInfo,DIB_RGB_COLORS);
     4038        me->hbmImage = CreateDIBitmap( me->hdcImage,
     4039                                       NULL,
     4040                                       CBM_CREATEDIB,
     4041                                       LockedSurfaceDesc.lpSurface,
     4042                                       (PBITMAPINFO)&BitmapInfo,
     4043                                       DIB_RGB_COLORS);
     4044        #else
     4045        bmpSurface.bmBitsPixel  = 24;
     4046        me->hbmImage = CreateBitmapIndirect( &bmpSurface);
     4047        #endif
    36584048        break;
    36594049      default:
    36604050        #ifdef DEBUG
    3661           WriteLog("Unexptected BitCount %d \n",LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount);
     4051          WriteLog( "Unexptected BitCount %d \n",
     4052                    LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount);
    36624053        #endif
    36634054        me->hbmImage=NULL;
     
    40664457   RGBQUAD           bmiCols[256];
    40674458 } BitmapInfo;
    4068  int                    i;
     4459 BITMAP bmpData;
     4460 char szError[256];
     4461 int i,rc;
    40694462
    40704463  #ifdef DEBUG
     
    40754468    return(DDERR_INVALIDOBJECT);
    40764469
     4470  #if 1
    40774471  //unselect our bitmap
    40784472  SelectObject(me->hdcImage, me->hgdiOld);
    4079 
    40804473  memset(&BitmapInfo,0, sizeof(BitmapInfo));
    40814474  BitmapInfo.bmiHead.biSize     = sizeof(BITMAPINFOHEADER);
     
    40834476  BitmapInfo.bmiHead.biHeight   = me->DDSurfaceDesc.dwHeight;
    40844477  BitmapInfo.bmiHead.biPlanes   = 1;
    4085   BitmapInfo.bmiHead.biBitCount = me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
     4478  BitmapInfo.bmiHead.biBitCount = 0; // me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
    40864479
    40874480  switch(me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
     
    40914484    case 8:
    40924485      BitmapInfo.bmiHead.biCompression = BI_RGB;
    4093       GetSystemPaletteEntries(me->hdcImage,0,255,(PPALETTEENTRY)&BitmapInfo.bmiCols[0]);
    4094       GetDIBits(hdc, me->hbmImage, 0, me->DDSurfaceDesc.dwHeight,
     4486      //GetSystemPaletteEntries(me->hdcImage,0,255,(PPALETTEENTRY)&BitmapInfo.bmiCols[0]);
     4487      rc = GetDIBits(hdc, me->hbmImage, 0, me->DDSurfaceDesc.dwHeight,
     4488                NULL,(PBITMAPINFO)&BitmapInfo,DIB_PAL_COLORS);
     4489      WriteLog( "GetDIBits rc=%d\n Size   :%d\n Width  :%d\n Height :%d\n"
     4490                " Planes :%d\n BitCount :%d\nLastEror = %d\n",
     4491                rc,
     4492                BitmapInfo.bmiHead.biSize,
     4493                BitmapInfo.bmiHead.biWidth,
     4494                BitmapInfo.bmiHead.biHeight,
     4495                BitmapInfo.bmiHead.biPlanes,
     4496                BitmapInfo.bmiHead.biBitCount,
     4497                GetLastError());
     4498      /*
     4499      rc = GetDIBits(hdc, me->hbmImage, 0, me->DDSurfaceDesc.dwHeight,
    40954500                me->DDSurfaceDesc.lpSurface,(PBITMAPINFO)&BitmapInfo,DIB_PAL_COLORS);
     4501      WriteLog( "GetDIBits rc=%d\n LastEror = %d\n",
     4502                rc,
     4503                GetLastError());
     4504      */
    40964505      break;
    40974506    case 16:
     
    41174526      break;
    41184527  } // end switch (me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
    4119 
     4528  #else
     4529
     4530  rc = GetObjectA( me->hbmImage,
     4531                  sizeof(BITMAP),
     4532                  &bmpData);
     4533  WriteLog( "GetObject returned rc=%d\n BitmapInfo:\n Size:(%dx%d)\n Pitch: %d\n Bits %d\n @mem %08X",
     4534            rc,
     4535            bmpData.bmWidth, bmpData.bmHeight,
     4536            bmpData.bmWidthBytes,
     4537            bmpData.bmBitsPixel,
     4538            bmpData.bmBits);
     4539  #endif
    41204540  me->Vtbl.Unlock(me,NULL);
    41214541  me->dwLastDCUnique = me->dwUniqueValue; // Store this to see if the surface was locked after we released the DC
  • trunk/src/ddraw/ddraw.CPP

    r522 r850  
    9494                            NULL);
    9595
    96   WriteLog("Callback returned");
     96  WriteLog("Callback returned\n");
    9797  return rc;
    9898}
Note: See TracChangeset for help on using the changeset viewer.