Ignore:
Timestamp:
Jul 1, 2002, 9:15:26 PM (23 years ago)
Author:
sandervl
Message:

fill, SurfGetDC, SurfReleaseDC fixes & changes (see ChangeLog for details)

File:
1 edited

Legend:

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

    r8816 r8818  
    1 /* $Id: OS2SURFACE.CPP,v 1.43 2002-07-01 16:02:04 sandervl Exp $ */
     1/* $Id: OS2SURFACE.CPP,v 1.44 2002-07-01 19:15:24 sandervl Exp $ */
    22
    33/*
     
    3838#include <winerror.h>
    3939#include <os2win.h>
     40#include <cpuhlp.h>
     41#include "asmutil.h"
     42
    4043#ifndef __WATCOMC__
    4144  #include <builtin.h>
     
    15691572  }
    15701573
    1571   if(NULL!=ColorFill)
     1574  if(NULL!=ColorFill) {
    15721575    ColorFill( pDiveBuffer, pFrameBuffer, Top, Left,
    15731576              FillWidth, FillHeight, dwPitchDB,dwPitchFB,
    15741577              dwFillColor,(16==lpDraw->dCaps.ulDepth)?(VOID*)pPal16:(VOID*)pPal24);
     1578    SurfChangeUniquenessValue(this);
     1579  }
    15751580  else
    15761581  {
     
    25382543          }
    25392544#endif
     2545          SurfChangeUniquenessValue(dest);
    25402546          return DD_OK;
    25412547      }
     
    30583064                break;
    30593065            }  // end switch
    3060             //if(dest->lpVtbl == dest->Vtbl4)
    3061             //  dest->Vtbl4->ChangeUniquenessValue(dest);
     3066            SurfChangeUniquenessValue(dest);
    30623067            return DD_OK;
    30633068          }
     
    33043309            // Only Source colorkey
    33053310          }
    3306           // if(dest->lpVtbl == dest->Vtbl4)
    3307           //  dest->Vtbl4->ChangeUniquenessValue(dest);
     3311          SurfChangeUniquenessValue(dest);
    33083312          return DD_OK;
    33093313        }
     
    34193423  }// end handling destination not framebuffer
    34203424
    3421   // if(dest->lpVtbl == dest->Vtbl4)
    3422   //   dest->Vtbl4->ChangeUniquenessValue(dest);
     3425  SurfChangeUniquenessValue(dest);
    34233426  return(DD_OK);
    34243427}
     
    44054408 DDSURFACEDESC2        LockedSurfaceDesc;
    44064409 HRESULT               rc;
    4407  BITMAPINFOHEADER      bmihHdr;
    44084410 BITMAP bmpSurface;
    44094411 struct
     
    44544456    BitmapInfo.bmiHead.biPlanes   = 1;
    44554457    BitmapInfo.bmiHead.biBitCount = (WORD)LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
    4456     memset(&bmihHdr, 0, sizeof(bmihHdr));
    4457     bmihHdr.biSize     = sizeof(BITMAPINFOHEADER);
    4458     bmihHdr.biWidth    = LockedSurfaceDesc.dwWidth;
    4459     bmihHdr.biHeight   = LockedSurfaceDesc.dwHeight;
    4460     bmihHdr.biPlanes   = 1;
    4461     bmihHdr.biBitCount = (WORD)LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
    44624458
    44634459    switch(LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
     
    44874483        }
    44884484        me->hbmImage = CreateDIBitmap( me->hdcImage,
    4489                                        &bmihHdr,
     4485                                       &BitmapInfo.bmiHead,
    44904486                                       CBM_INIT,
    44914487                                       LockedSurfaceDesc.lpSurface,
     
    45034499        *((DWORD *) &(BitmapInfo.bmiCols[2])) = me->DDSurfaceDesc.ddpfPixelFormat.dwBBitMask;
    45044500        me->hbmImage = CreateDIBitmap( me->hdcImage,
    4505                                        &bmihHdr,
     4501                                       &BitmapInfo.bmiHead,
    45064502                                       CBM_INIT,
    45074503                                       LockedSurfaceDesc.lpSurface,
     
    49084904   RGBQUAD           bmiCols[256];
    49094905 } BitmapInfo;
    4910 // BITMAP bmpData;
    49114906 int rc;
    49124907
     
    49164911    return(DDERR_INVALIDOBJECT);
    49174912
    4918   #if 1
    49194913  //unselect our bitmap
    49204914  SelectObject(me->hdcImage, me->hgdiOld);
     4915
    49214916  memset(&BitmapInfo,0, sizeof(BitmapInfo));
    49224917  BitmapInfo.bmiHead.biSize     = sizeof(BITMAPINFOHEADER);
    4923   /*
    4924   BitmapInfo.bmiHead.biWidth    = me->DDSurfaceDesc.lPitch/ (me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount>>3);
     4918  BitmapInfo.bmiHead.biBitCount = me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
     4919  BitmapInfo.bmiHead.biPlanes   = 1;
     4920  BitmapInfo.bmiHead.biWidth    = me->DDSurfaceDesc.dwWidth; /// (me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount>>3);
    49254921  BitmapInfo.bmiHead.biHeight   = me->DDSurfaceDesc.dwHeight;
    4926   BitmapInfo.bmiHead.biPlanes   = 1;
    4927   BitmapInfo.bmiHead.biBitCount = 0; // me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount;
    4928   */
     4922
    49294923  switch(me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
    49304924  {
     
    49664960      break;
    49674961    case 16:
     4962      BitmapInfo.bmiHead.biCompression = BI_BITFIELDS;
     4963      BitmapInfo.bmiHead.biClrUsed     = 3;
     4964      *((DWORD *) &(BitmapInfo.bmiCols[0])) = me->DDSurfaceDesc.ddpfPixelFormat.dwRBitMask;
     4965      *((DWORD *) &(BitmapInfo.bmiCols[1])) = me->DDSurfaceDesc.ddpfPixelFormat.dwGBitMask;
     4966      *((DWORD *) &(BitmapInfo.bmiCols[2])) = me->DDSurfaceDesc.ddpfPixelFormat.dwBBitMask;
     4967      GetDIBits(hdc, me->hbmImage, 0, me->DDSurfaceDesc.dwHeight,
     4968                me->DDSurfaceDesc.lpSurface,(PBITMAPINFO)&BitmapInfo,DIB_RGB_COLORS);
     4969
     4970      //GetDIBits returns data in RGB555 format; convert if surface is in RGB565 format
     4971      if(me->DDSurfaceDesc.ddpfPixelFormat.dwGBitMask == 0x7E0) {
     4972        int imgsize = BitmapInfo.bmiHead.biWidth*BitmapInfo.bmiHead.biHeight*2;
     4973
     4974        if(CPUFeatures & CPUID_MMX) {
     4975             DDrawRGB555to565MMX((char *)me->DDSurfaceDesc.lpSurface, (char *)me->DDSurfaceDesc.lpSurface, imgsize/sizeof(WORD));
     4976        }
     4977        else DDrawRGB555to565((char *)me->DDSurfaceDesc.lpSurface, (char *)me->DDSurfaceDesc.lpSurface, imgsize/sizeof(WORD));
     4978      }
     4979      break;
     4980
    49684981    case 32:
    49694982      BitmapInfo.bmiHead.biCompression = BI_BITFIELDS;
     
    49754988                me->DDSurfaceDesc.lpSurface,(PBITMAPINFO)&BitmapInfo,DIB_RGB_COLORS);
    49764989      break;
     4990
    49774991    case 24:
    49784992      BitmapInfo.bmiHead.biCompression = BI_RGB;
     
    49854999      break;
    49865000  } // end switch (me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount)
    4987   #else
    4988 
    4989   rc = GetObjectA( me->hbmImage,
    4990                   sizeof(BITMAP),
    4991                   &bmpData);
    4992   dprintf( ("GetObject returned rc=%d\n BitmapInfo:\n Size:(%dx%d)\n Pitch: %d\n Bits %d\n @mem %08X",
    4993             rc,
    4994             bmpData.bmWidth, bmpData.bmHeight,
    4995             bmpData.bmWidthBytes,
    4996             bmpData.bmBitsPixel,
    4997             bmpData.bmBits));
    4998   #endif
     5001
    49995002  me->Vtbl.Unlock(me,NULL);
    50005003  me->dwLastDCUnique = me->dwUniqueValue; // Store this to see if the surface was locked after we released the DC
Note: See TracChangeset for help on using the changeset viewer.