Changeset 8816 for trunk/src


Ignore:
Timestamp:
Jul 1, 2002, 6:02:05 PM (23 years ago)
Author:
sandervl
Message:

color fill fixes (heap corruption & missing lines)

Location:
trunk/src/ddraw
Files:
2 edited

Legend:

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

    r8605 r8816  
    1 /* $Id: OS2SURFACE.CPP,v 1.42 2002-06-08 14:20:06 sandervl Exp $ */
     1/* $Id: OS2SURFACE.CPP,v 1.43 2002-07-01 16:02:04 sandervl Exp $ */
    22
    33/*
     
    15021502  if(NULL!=lpDestRect)
    15031503  {
    1504     dprintf(("DDRAW: Fill only Rect(%d,%d)(%d,%d)\n", lpDestRect->left, lpDestRect->top,
    1505              lpDestRect->right, lpDestRect->bottom));
    1506     FillWidth  = lpDestRect->right - lpDestRect->left;
    1507     FillHeight = lpDestRect->bottom - lpDestRect->top -1;
    1508     Top = lpDestRect->top;
    1509     Left = lpDestRect->left;
     1504    dprintf(("DDRAW: Fill only Rect(%d,%d)(%d,%d) (%d,%d)", lpDestRect->left, lpDestRect->top,
     1505             lpDestRect->right, lpDestRect->bottom, width, height));
     1506    FillWidth  = RECT_WIDTH(lpDestRect);
     1507    FillHeight = RECT_HEIGHT(lpDestRect);
     1508    Top        = lpDestRect->top;
     1509    Left       = lpDestRect->left;
     1510    if(Top + FillHeight > height) {
     1511        FillHeight = height - Top;
     1512        dprintf(("correcting FillHeight to %d", FillHeight));
     1513    }
     1514    if(Left + FillWidth > width) {
     1515        FillWidth = width - Left;
     1516        dprintf(("correcting FillWidth to %d", FillWidth));
     1517    }
    15101518  }
    15111519  else
     
    15151523    Left = 0;
    15161524    FillWidth  = width;
    1517     FillHeight = height -1;
     1525    FillHeight = height;
    15181526    //pLine = pDiveBuffer;
    15191527  }
     
    27112719    dprintf(("DDRAW: Blitting with scaling\n Not supported.\n"));
    27122720
    2713 //    return DDERR_NOSTRETCHHW;
     2721    return DDERR_NOSTRETCHHW;
    27142722  }
    27152723
     
    44404448              LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount
    44414449            ));
    4442     #if 1
    44434450    memset(&BitmapInfo, 0, sizeof(BitmapInfo));
    44444451    BitmapInfo.bmiHead.biSize     = sizeof(BITMAPINFOHEADER);
     
    44534460    bmihHdr.biPlanes   = 1;
    44544461    bmihHdr.biBitCount = (WORD)LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
    4455     #else
    4456     bmpSurface.bmType       = 0;
    4457     bmpSurface.bmWidth      = LockedSurfaceDesc.dwWidth;
    4458     bmpSurface.bmHeight     = LockedSurfaceDesc.dwHeight;
    4459     bmpSurface.bmWidthBytes = LockedSurfaceDesc.lPitch;
    4460     bmpSurface.bmPlanes     = 1;
    4461     bmpSurface.bmBits       = LockedSurfaceDesc.lpSurface;
    4462     #endif
     4462
    44634463    switch(LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
    44644464    {
     
    44684468        break;
    44694469      case 8:
    4470         #if 1
    44714470        BitmapInfo.bmiHead.biCompression = BI_RGB;
    44724471        if (me->lpPalette != NULL)
     
    44934492                                       (PBITMAPINFO)&BitmapInfo,
    44944493                                       DIB_RGB_COLORS);
    4495         #else
    4496         bmpSurface.bmBitsPixel  = 8;
    4497         me->hbmImage = CreateBitmapIndirect( &bmpSurface);
    4498         #endif
    44994494        break;
     4495
    45004496      case 16:
     4497      case 24:
    45014498      case 32:
    4502         dprintf(("DDRAW: 16/32 Bit not supported by OS/2"));
    4503         break;
    4504       case 24:
    4505         #if 0
    4506         BitmapInfo.bmiHead.biCompression = BI_RGB;
     4499        BitmapInfo.bmiHead.biCompression = BI_BITFIELDS;
     4500        BitmapInfo.bmiHead.biClrUsed     = 3;
     4501        *((DWORD *) &(BitmapInfo.bmiCols[0])) = me->DDSurfaceDesc.ddpfPixelFormat.dwRBitMask;
     4502        *((DWORD *) &(BitmapInfo.bmiCols[1])) = me->DDSurfaceDesc.ddpfPixelFormat.dwGBitMask;
     4503        *((DWORD *) &(BitmapInfo.bmiCols[2])) = me->DDSurfaceDesc.ddpfPixelFormat.dwBBitMask;
    45074504        me->hbmImage = CreateDIBitmap( me->hdcImage,
    4508                                        NULL,
    4509                                        CBM_CREATEDIB,
     4505                                       &bmihHdr,
     4506                                       CBM_INIT,
    45104507                                       LockedSurfaceDesc.lpSurface,
    45114508                                       (PBITMAPINFO)&BitmapInfo,
    45124509                                       DIB_RGB_COLORS );
    4513         #else
    4514         bmpSurface.bmBitsPixel  = 24;
    4515         me->hbmImage = CreateBitmapIndirect( &bmpSurface);
    4516         #endif
    45174510        break;
     4511
    45184512      default:
    45194513        dprintf( ("Unexpected BitCount %d \n",
  • trunk/src/ddraw/fillfunc.cpp

    r5472 r8816  
    1 /* $Id: fillfunc.cpp,v 1.4 2001-04-04 09:02:15 sandervl Exp $ */
     1/* $Id: fillfunc.cpp,v 1.5 2002-07-01 16:02:05 sandervl Exp $ */
    22
    33/*
     
    4040  if(dwWidth % 4)
    4141  {
     42    if(i==0) i = 1;     //or else next line will corrupt heap
    4243    pFillPos = (char*) (&pColor[i-1]);
    4344    for(i=0;i<dwWidth % 4;i++)
     
    8182  if(dwWidth % 2)
    8283  {
     84     if(i==0) i = 1;    //or else next line will corrupt heap
    8385     pFillPos = (char*)(&pColor[i-1]);
    8486    *((USHORT*)pFillPos) = (USHORT)dwColor;
     
    222224                        )
    223225{
    224   dprintf(("Fill16on16\n"));
     226  dprintf(("Fill16on16 %x (%d,%d)(%d,%d) %d %x", pDB+(dwTop*dwPitchDB)+(dwLeft*2), dwLeft, dwTop, dwWidth, dwHeight, dwPitchDB, dwColor));
    225227  dwColor = (dwColor&0xFFFF)+((dwColor&0xFFFF)<<16);
    226228
Note: See TracChangeset for help on using the changeset viewer.