Changeset 405
- Timestamp:
- Aug 3, 1999, 10:16:20 PM (26 years ago)
- Location:
- trunk/src/ddraw
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/ddraw/OS2SURFACE.CPP ¶
r352 r405 277 277 Vtbl.SetOverlayPosition = SurfSetOverlayPosition; 278 278 Vtbl.SetPalette = SurfSetPalette; 279 Vtbl.Unlock = SurfUnlock ;279 Vtbl.Unlock = SurfUnlock4; 280 280 Vtbl.UpdateOverlay = SurfUpdateOverlay4; 281 281 Vtbl.UpdateOverlayDisplay = SurfUpdateOverlayDisplay; … … 351 351 } 352 352 353 /*354 try355 {356 SurfaceCursorMipMap = SurfaceSequenceMipMap.newCursor();357 }358 catch(IOutOfMemory)359 {360 #ifdef DEBUG361 WriteLog("Internal : Error creating Cursor\n");362 #endif363 lastError = DDERR_OUTOFMEMORY ;364 return;365 }366 367 try368 {369 SurfaceCursorAttached = SurfaceSequenceAttached.newCursor();370 }371 catch(IOutOfMemory)372 {373 #ifdef DEBUG374 WriteLog("Internal : Error creating Cursor\n");375 #endif376 lastError = DDERR_OUTOFMEMORY ;377 return;378 }379 */380 353 if( lpDDSurfaceDesc->dwFlags & DDSD_CAPS ) 381 354 { … … 570 543 } //endif Backbuffer 571 544 } // endif DDSCAPS_COMPLEX 545 546 width = DDSurfaceDesc.dwWidth; 547 height = DDSurfaceDesc.dwHeight; 548 572 549 lastError = DD_OK; 573 550 return; … … 751 728 } // End of alloc surfaces 752 729 730 width = DDSurfaceDesc.dwWidth; 731 height = DDSurfaceDesc.dwHeight; 732 753 733 if( dwCaps & DDSCAPS_COMPLEX) 754 734 { … … 819 799 if(MipMapSurface->GetLastError() != DD_OK) 820 800 { 821 lastError = AttachedSurface->GetLastError();801 lastError = MipMapSurface->GetLastError(); 822 802 #ifdef DEBUG 823 803 WriteLog("Attached surface creation returned error %d\n",lastError); … … 3599 3579 //****************************************************************************** 3600 3580 //****************************************************************************** 3601 HRESULT __stdcall SurfLock(THIS This, LPRECT lpRect, LPDDSURFACEDESC lpSurfaceDesc, 3602 DWORD dwFlags, HANDLE hEvent) 3581 HRESULT __stdcall SurfLock( THIS This, 3582 LPRECT lpRect, 3583 LPDDSURFACEDESC lpSurfaceDesc, 3584 DWORD dwFlags, 3585 HANDLE hEvent) 3603 3586 { 3604 3587 DDSURFACEDESC2 SurfaceDesc4; … … 3606 3589 3607 3590 #ifdef DEBUG 3608 WriteLog("SurfLock %d % d%d %d\n", (int)lpRect, (int)lpSurfaceDesc, dwFlags, hEvent);3591 WriteLog("SurfLock %d %08X %d %d\n", (int)lpRect, (int)lpSurfaceDesc, dwFlags, hEvent); 3609 3592 #endif 3610 3593 … … 3627 3610 //****************************************************************************** 3628 3611 //****************************************************************************** 3629 HRESULT __stdcall SurfLock4(THIS This, LPRECT lpRect, LPDDSURFACEDESC2 lpSurfaceDesc, 3630 DWORD dwFlags, HANDLE hEvent) 3612 HRESULT __stdcall SurfLock4( THIS This, 3613 LPRECT lpRect, 3614 LPDDSURFACEDESC2 lpSurfaceDesc, 3615 DWORD dwFlags, 3616 HANDLE hEvent) 3631 3617 { 3632 3618 … … 3641 3627 3642 3628 #ifdef DEBUG 3643 WriteLog("SurfLock4 %d % d%d %d\n", (int)lpRect, (int)lpSurfaceDesc, dwFlags, hEvent);3629 WriteLog("SurfLock4 %d %08X %d %d\n", (int)lpRect, (int)lpSurfaceDesc, dwFlags, hEvent); 3644 3630 #endif 3645 3631 … … 3655 3641 3656 3642 // ToDo : the lockchecking should be done in a critcal seq. 3643 WriteLog( "Lock Rectangle (%d/%d) x (%d/%d)\n", 3644 pIRectNew->Top(), 3645 pIRectNew->Left(), 3646 pIRectNew->Bottom(), 3647 pIRectNew->Right() ); 3657 3648 3658 3649 if(me->fLocked) … … 3661 3652 { 3662 3653 // If anything is locked we can't locke the complete surface 3654 WriteLog("Surface has locked Rectangles, and we want to complete lock it"); 3663 3655 Found = TRUE; 3664 3656 } … … 3668 3660 // be locked so check for this 3669 3661 3662 WriteLog("Surface has locked Rectangles, check if the overlap"); 3663 3670 3664 i=0; 3671 3665 Found = FALSE; … … 3674 3668 { 3675 3669 pIRectCurrent = (DDRectangle*) DPA_FastGetPtr(me->DPA_LockedRects,i); 3670 WriteLog( "Test with Rectangle (%d/%d) x (%d/%d)\n", 3671 pIRectCurrent->Top(), 3672 pIRectCurrent->Left(), 3673 pIRectCurrent->Bottom(), 3674 pIRectCurrent->Right() ); 3676 3675 Found = pIRectCurrent->intersects(*pIRectNew); 3677 3676 i++; … … 3698 3697 (lpRect->left * (lpSurfaceDesc->ddpfPixelFormat.dwRGBBitCount>>3))); 3699 3698 #ifdef DEBUG 3700 WriteLog("SurfLock4 % d(x,y) = (%d,%d)\n", lpSurfaceDesc->lpSurface, lpRect->top, lpRect->left);3699 WriteLog("SurfLock4 %08X (x,y) = (%d,%d)\n", lpSurfaceDesc->lpSurface, lpRect->top, lpRect->left); 3701 3700 #endif 3702 3701 } … … 3704 3703 { 3705 3704 #ifdef DEBUG 3706 WriteLog("SurfLock4 % d\n", lpSurfaceDesc->lpSurface);3705 WriteLog("SurfLock4 %08X \n", lpSurfaceDesc->lpSurface); 3707 3706 #endif 3708 3707 } 3709 3708 // Add the rectangle to the list of locked rectangles 3709 3710 pIRectNew->SetMemPtr(lpSurfaceDesc->lpSurface); 3710 3711 3711 3712 DPA_InsertPtr( me->DPA_LockedRects, … … 3955 3956 //****************************************************************************** 3956 3957 //****************************************************************************** 3957 HRESULT __stdcall SurfUnlock(THIS This, LPRECT lpSurfaceRect) 3958 { 3959 3958 HRESULT __stdcall SurfUnlock(THIS This, LPVOID lpSurfaceData) 3959 { 3960 3960 3961 3961 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 3962 3962 int i; 3963 DDRectangle *pIRectUnlock ;3963 DDRectangle *pIRectUnlock, *pIRectEnum; 3964 3964 BOOL Found = FALSE; 3965 3966 #ifdef DEBUG 3967 WriteLog("SurfUnlock\n"); 3965 OS2RECTL CCRect; 3966 3967 #ifdef DEBUG 3968 WriteLog("SurfUnlock at %08X\n",lpSurfaceData); 3969 #endif 3970 3971 if(me->fLocked == FALSE) 3972 { 3973 #ifdef DEBUG 3974 WriteLog("Surface not locked!\n"); 3975 #endif 3976 return(DDERR_NOTLOCKED); 3977 } 3978 3979 #ifdef DEBUG 3980 WriteLog("Start Emuneration of Locked Rects\n"); 3981 #endif 3982 3983 i=0; 3984 if(NULL!=lpSurfaceData) 3985 { 3986 WriteLog("Buffer Pointer Compare"); 3987 3988 // We got a pinter to the surface memory so we must search for 3989 // this pointer in the locked rects DPA to unlock the right rect. 3990 3991 while(i<DPA_GetPtrCount(me->DPA_LockedRects) && !Found) 3992 { 3993 pIRectEnum = (DDRectangle*)DPA_FastGetPtr(me->DPA_LockedRects,i); 3994 WriteLog( "Test with Rectangle %d (%d/%d) x (%d/%d) Mem at %08X\n", 3995 i, 3996 pIRectEnum->Top(), 3997 pIRectEnum->Left(), 3998 pIRectEnum->Bottom(), 3999 pIRectEnum->Right(), 4000 pIRectEnum->GetMemPtr() ); 4001 4002 Found = ( pIRectEnum->GetMemPtr() == lpSurfaceData); 4003 if(!Found) 4004 { 4005 #ifdef DEBUG 4006 WriteLog("Not Found, try Next rect\n"); 4007 #endif 4008 i++; 4009 } 4010 #ifdef DEBUG 4011 else 4012 { 4013 WriteLog("Found Rect\n"); 4014 } 4015 #endif 4016 } 4017 } 4018 else 4019 { 4020 // If a NULL pointer was passed in the SW tries to unlock the 4021 // complete surface so we must compare the rects. 4022 WriteLog("Rectangle compare"); 4023 4024 pIRectUnlock = new DDRectangle( 0, 0, me->height, me->width); 4025 4026 while(i<DPA_GetPtrCount(me->DPA_LockedRects) && !Found) 4027 { 4028 pIRectEnum = (DDRectangle*)DPA_FastGetPtr(me->DPA_LockedRects,i); 4029 WriteLog( "Test with Rectangle %d (%d/%d) x (%d/%d) Mem at %08X\n", 4030 i, 4031 pIRectEnum->Top(), 4032 pIRectEnum->Left(), 4033 pIRectEnum->Bottom(), 4034 pIRectEnum->Right(), 4035 pIRectEnum->GetMemPtr() ); 4036 4037 Found = (*pIRectEnum == *pIRectUnlock); 4038 if(!Found) 4039 { 4040 #ifdef DEBUG 4041 WriteLog("Not Found, try Next rect\n"); 4042 #endif 4043 i++; 4044 } 4045 #ifdef DEBUG 4046 else 4047 { 4048 WriteLog("Found Rect\n"); 4049 } 4050 #endif 4051 } 4052 delete pIRectUnlock; 4053 } 4054 4055 if(!Found) 4056 { 4057 #ifdef DEBUG 4058 WriteLog("Rectangle not locked, wrong Rect!\n\n"); 4059 #endif 4060 return(DDERR_INVALIDRECT); 4061 } 4062 4063 #ifdef DEBUG 4064 WriteLog("Remove Rect %d from Seq.\n",i); 4065 #endif 4066 4067 DPA_DeletePtr(me->DPA_LockedRects,i); 4068 4069 #ifdef DEBUG 4070 WriteLog("Test if locked Rects main\n"); 4071 #endif 4072 4073 if(0==DPA_GetPtrCount(me->DPA_LockedRects)) // Do we have unlocked last rectangle 4074 { 4075 #ifdef DEBUG 4076 WriteLog("No Locked Rects left for surface\n"); 4077 #endif 4078 me->fLocked = FALSE; 4079 } 4080 #ifdef DEBUG 4081 else 4082 WriteLog( "%d Rects in Seq\n", 4083 DPA_GetPtrCount(me->DPA_LockedRects)); 4084 #endif 4085 4086 if(me->pFrameBuffer != me->pDiveBuffer) 4087 { 4088 #ifdef DEBUG 4089 WriteLog( "ColorConversion Needed %08X != %08X\n", 4090 me->pFrameBuffer, 4091 me->pDiveBuffer); 4092 #endif 4093 if(NULL!=lpSurfaceData) 4094 { 4095 CCRect.yTop = pIRectEnum->Top(); 4096 CCRect.xLeft = pIRectEnum->Left(); 4097 CCRect.xRight = pIRectEnum->Right(); 4098 CCRect.yBottom = pIRectEnum->Bottom(); 4099 4100 me->ColorConversion( (LPRECT)&CCRect); 4101 } 4102 else 4103 { 4104 me->ColorConversion(NULL); 4105 } 4106 } 4107 #ifdef DEBUG 4108 else 4109 WriteLog( "No ColorConversion Needed"); 4110 #endif 4111 4112 // delete tne DDRectobject of the found rectangle 4113 delete pIRectEnum; 4114 4115 me->lpVtbl->ChangeUniquenessValue(me); 4116 4117 WriteLog("Unlock OK\n\n"); 4118 4119 return(DD_OK); 4120 } 4121 //****************************************************************************** 4122 //****************************************************************************** 4123 HRESULT __stdcall SurfUnlock4(THIS This, LPRECT lpSurfaceRect) 4124 { 4125 // MS changed the parameter from LPVOID to LPRECT with DX6 4126 // as DX-6 allways returns a DDSurface4 on create surface this 4127 // is a problem i not NULL is passed in. 4128 // Solution We first test with the pointer ns assuming a rectangle 4129 // if we don't find a rect Which is very likely if we get a pointer 4130 // SurfaceMemory we call SurfUnlock and test for the pointer there. 4131 4132 4133 OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; 4134 int i; 4135 DDRectangle *pIRectUnlock, *pIRectEnum; 4136 BOOL Found = FALSE; 4137 4138 #ifdef DEBUG 4139 WriteLog("SurfUnlock4\n"); 3968 4140 #endif 3969 4141 … … 3990 4162 } 3991 4163 3992 #ifdef DEBUG 3993 WriteLog("StartEmuneration of Locked Rects\n"); 4164 WriteLog( "Try to Unlock Rectangle (%d/%d) x (%d/%d)\n", 4165 pIRectUnlock->Top(), 4166 pIRectUnlock->Left(), 4167 pIRectUnlock->Bottom(), 4168 pIRectUnlock->Right() ); 4169 4170 #ifdef DEBUG 4171 WriteLog("Start Emuneration of Locked Rects\n"); 3994 4172 #endif 3995 4173 … … 3997 4175 while(i<DPA_GetPtrCount(me->DPA_LockedRects) && !Found) 3998 4176 { 3999 Found = (*((DDRectangle*)DPA_FastGetPtr(me->DPA_LockedRects,i)) == *pIRectUnlock); 4177 pIRectEnum = (DDRectangle*)DPA_FastGetPtr(me->DPA_LockedRects,i); 4178 WriteLog( "Test with Rectangle (%d/%d) x (%d/%d)\n", 4179 pIRectEnum->Top(), 4180 pIRectEnum->Left(), 4181 pIRectEnum->Bottom(), 4182 pIRectEnum->Right() ); 4183 4184 Found = (*pIRectEnum == *pIRectUnlock); 4000 4185 if(!Found) 4001 4186 { … … 4015 4200 if(!Found) 4016 4201 { 4017 #ifdef DEBUG 4018 WriteLog("Rectangle not locked, wrong Rect!\n\n"); 4019 #endif 4020 return(DDERR_INVALIDRECT); 4202 4203 if(NULL==lpSurfaceRect) 4204 { 4205 #ifdef DEBUG 4206 WriteLog("Rectangle not locked, wrong Rect!\n\n"); 4207 #endif 4208 return(DDERR_INVALIDRECT); 4209 } 4210 else 4211 return SurfUnlock(This, (LPVOID)lpSurfaceRect); 4021 4212 } 4022 4213 -
TabularUnified trunk/src/ddraw/OS2SURFACE.H ¶
r352 r405 145 145 friend HRESULT __stdcall SurfSetOverlayPosition(THIS, LONG, LONG ); 146 146 friend HRESULT __stdcall SurfSetPalette(THIS, LPDIRECTDRAWPALETTE); 147 friend HRESULT __stdcall SurfUnlock(THIS, LPRECT); 147 friend HRESULT __stdcall SurfUnlock(THIS, LPVOID); 148 friend HRESULT __stdcall SurfUnlock4(THIS, LPRECT); 148 149 friend HRESULT __stdcall SurfUpdateOverlay(THIS, LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX); 149 150 friend HRESULT __stdcall SurfUpdateOverlay4(THIS, LPRECT, LPDIRECTDRAWSURFACE4,LPRECT,DWORD, LPDDOVERLAYFX); … … 211 212 HRESULT __stdcall SurfSetOverlayPosition(THIS, LONG, LONG ); 212 213 HRESULT __stdcall SurfSetPalette(THIS, LPDIRECTDRAWPALETTE); 213 HRESULT __stdcall SurfUnlock(THIS, LPRECT); 214 HRESULT __stdcall SurfUnlock(THIS, LPVOID); 215 HRESULT __stdcall SurfUnlock4(THIS, LPRECT); 214 216 HRESULT __stdcall SurfUpdateOverlay(THIS, LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX); 215 217 HRESULT __stdcall SurfUpdateOverlay4(THIS, LPRECT, LPDIRECTDRAWSURFACE4,LPRECT,DWORD, LPDDOVERLAYFX); -
TabularUnified trunk/src/ddraw/rectangle.cpp ¶
r352 r405 10 10 lBottom = y2; 11 11 lRight = x2; 12 pMemPtr = 0; 12 13 } 13 14 … … 39 40 } 40 41 42 DDRectangle::Coord DDRectangle::Top() const 43 { 44 return lTop; 45 } 46 47 DDRectangle::Coord DDRectangle::Left() const 48 { 49 return lLeft; 50 } 51 52 DDRectangle::Coord DDRectangle::Bottom() const 53 { 54 return lBottom; 55 } 56 57 DDRectangle::Coord DDRectangle::Right() const 58 { 59 return lRight; 60 } 61 62 void DDRectangle::SetMemPtr(void* NewMemPtr) 63 { 64 pMemPtr = NewMemPtr; 65 } 66 67 void* DDRectangle::GetMemPtr() 68 { 69 return pMemPtr; 70 } -
TabularUnified trunk/src/ddraw/rectangle.h ¶
r352 r405 32 32 Coord 33 33 width() const, 34 height() const; 34 height() const, 35 Top() const, 36 Left() const, 37 Bottom() const, 38 Right() const; 39 40 void* GetMemPtr(); 41 void SetMemPtr(void* NewMemPtr); 35 42 36 43 private: 44 void* pMemPtr; // Pointer to surface memory for this rectangle 37 45 long lTop,lLeft; 38 46 long lBottom,lRight;
Note:
See TracChangeset
for help on using the changeset viewer.