Changeset 8818 for trunk/src/ddraw/OS2SURFACE.CPP
- Timestamp:
- Jul 1, 2002, 9:15:26 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/OS2SURFACE.CPP
r8816 r8818 1 /* $Id: OS2SURFACE.CPP,v 1.4 3 2002-07-01 16:02:04 sandervl Exp $ */1 /* $Id: OS2SURFACE.CPP,v 1.44 2002-07-01 19:15:24 sandervl Exp $ */ 2 2 3 3 /* … … 38 38 #include <winerror.h> 39 39 #include <os2win.h> 40 #include <cpuhlp.h> 41 #include "asmutil.h" 42 40 43 #ifndef __WATCOMC__ 41 44 #include <builtin.h> … … 1569 1572 } 1570 1573 1571 if(NULL!=ColorFill) 1574 if(NULL!=ColorFill) { 1572 1575 ColorFill( pDiveBuffer, pFrameBuffer, Top, Left, 1573 1576 FillWidth, FillHeight, dwPitchDB,dwPitchFB, 1574 1577 dwFillColor,(16==lpDraw->dCaps.ulDepth)?(VOID*)pPal16:(VOID*)pPal24); 1578 SurfChangeUniquenessValue(this); 1579 } 1575 1580 else 1576 1581 { … … 2538 2543 } 2539 2544 #endif 2545 SurfChangeUniquenessValue(dest); 2540 2546 return DD_OK; 2541 2547 } … … 3058 3064 break; 3059 3065 } // end switch 3060 //if(dest->lpVtbl == dest->Vtbl4) 3061 // dest->Vtbl4->ChangeUniquenessValue(dest); 3066 SurfChangeUniquenessValue(dest); 3062 3067 return DD_OK; 3063 3068 } … … 3304 3309 // Only Source colorkey 3305 3310 } 3306 // if(dest->lpVtbl == dest->Vtbl4) 3307 // dest->Vtbl4->ChangeUniquenessValue(dest); 3311 SurfChangeUniquenessValue(dest); 3308 3312 return DD_OK; 3309 3313 } … … 3419 3423 }// end handling destination not framebuffer 3420 3424 3421 // if(dest->lpVtbl == dest->Vtbl4) 3422 // dest->Vtbl4->ChangeUniquenessValue(dest); 3425 SurfChangeUniquenessValue(dest); 3423 3426 return(DD_OK); 3424 3427 } … … 4405 4408 DDSURFACEDESC2 LockedSurfaceDesc; 4406 4409 HRESULT rc; 4407 BITMAPINFOHEADER bmihHdr;4408 4410 BITMAP bmpSurface; 4409 4411 struct … … 4454 4456 BitmapInfo.bmiHead.biPlanes = 1; 4455 4457 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;4462 4458 4463 4459 switch(LockedSurfaceDesc.ddpfPixelFormat.dwRGBBitCount) … … 4487 4483 } 4488 4484 me->hbmImage = CreateDIBitmap( me->hdcImage, 4489 & bmihHdr,4485 &BitmapInfo.bmiHead, 4490 4486 CBM_INIT, 4491 4487 LockedSurfaceDesc.lpSurface, … … 4503 4499 *((DWORD *) &(BitmapInfo.bmiCols[2])) = me->DDSurfaceDesc.ddpfPixelFormat.dwBBitMask; 4504 4500 me->hbmImage = CreateDIBitmap( me->hdcImage, 4505 & bmihHdr,4501 &BitmapInfo.bmiHead, 4506 4502 CBM_INIT, 4507 4503 LockedSurfaceDesc.lpSurface, … … 4908 4904 RGBQUAD bmiCols[256]; 4909 4905 } BitmapInfo; 4910 // BITMAP bmpData;4911 4906 int rc; 4912 4907 … … 4916 4911 return(DDERR_INVALIDOBJECT); 4917 4912 4918 #if 14919 4913 //unselect our bitmap 4920 4914 SelectObject(me->hdcImage, me->hgdiOld); 4915 4921 4916 memset(&BitmapInfo,0, sizeof(BitmapInfo)); 4922 4917 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); 4925 4921 BitmapInfo.bmiHead.biHeight = me->DDSurfaceDesc.dwHeight; 4926 BitmapInfo.bmiHead.biPlanes = 1; 4927 BitmapInfo.bmiHead.biBitCount = 0; // me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount; 4928 */ 4922 4929 4923 switch(me->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount) 4930 4924 { … … 4966 4960 break; 4967 4961 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 4968 4981 case 32: 4969 4982 BitmapInfo.bmiHead.biCompression = BI_BITFIELDS; … … 4975 4988 me->DDSurfaceDesc.lpSurface,(PBITMAPINFO)&BitmapInfo,DIB_RGB_COLORS); 4976 4989 break; 4990 4977 4991 case 24: 4978 4992 BitmapInfo.bmiHead.biCompression = BI_RGB; … … 4985 4999 break; 4986 5000 } // 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 4999 5002 me->Vtbl.Unlock(me,NULL); 5000 5003 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.