Mercurial > sdl-ios-xcode
comparison src/video/windx5/SDL_dx5video.c @ 296:fab1ddc4d7bf
Removed the API changes to preserve SDL 1.2 stability
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 06 Mar 2002 11:05:47 +0000 |
parents | eadc0746dfaf |
children | f6ffac90895c |
comparison
equal
deleted
inserted
replaced
295:54ad1d2f1325 | 296:fab1ddc4d7bf |
---|---|
419 static int DX5_CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst); | 419 static int DX5_CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst); |
420 static int DX5_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); | 420 static int DX5_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); |
421 static int DX5_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key); | 421 static int DX5_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key); |
422 static int DX5_SetHWAlpha(_THIS, SDL_Surface *surface, Uint8 alpha); | 422 static int DX5_SetHWAlpha(_THIS, SDL_Surface *surface, Uint8 alpha); |
423 static int DX5_LockHWSurface(_THIS, SDL_Surface *surface); | 423 static int DX5_LockHWSurface(_THIS, SDL_Surface *surface); |
424 static int DX5_LockHWSurfaceRect(_THIS, SDL_Surface *surface, SDL_Rect *rect, void **pixels, int *pitch); | |
425 static void DX5_UnlockHWSurface(_THIS, SDL_Surface *surface); | 424 static void DX5_UnlockHWSurface(_THIS, SDL_Surface *surface); |
426 static int DX5_FlipHWSurface(_THIS, SDL_Surface *surface); | 425 static int DX5_FlipHWSurface(_THIS, SDL_Surface *surface); |
427 static void DX5_FreeHWSurface(_THIS, SDL_Surface *surface); | 426 static void DX5_FreeHWSurface(_THIS, SDL_Surface *surface); |
428 | 427 |
429 static int DX5_AllocDDSurface(_THIS, SDL_Surface *surface, | 428 static int DX5_AllocDDSurface(_THIS, SDL_Surface *surface, |
590 device->CheckHWBlit = DX5_CheckHWBlit; | 589 device->CheckHWBlit = DX5_CheckHWBlit; |
591 device->FillHWRect = DX5_FillHWRect; | 590 device->FillHWRect = DX5_FillHWRect; |
592 device->SetHWColorKey = DX5_SetHWColorKey; | 591 device->SetHWColorKey = DX5_SetHWColorKey; |
593 device->SetHWAlpha = DX5_SetHWAlpha; | 592 device->SetHWAlpha = DX5_SetHWAlpha; |
594 device->LockHWSurface = DX5_LockHWSurface; | 593 device->LockHWSurface = DX5_LockHWSurface; |
595 device->LockHWSurfaceRect = DX5_LockHWSurfaceRect; | |
596 device->UnlockHWSurface = DX5_UnlockHWSurface; | 594 device->UnlockHWSurface = DX5_UnlockHWSurface; |
597 device->UnlockHWSurfaceRect = DX5_UnlockHWSurface; | |
598 device->FlipHWSurface = DX5_FlipHWSurface; | 595 device->FlipHWSurface = DX5_FlipHWSurface; |
599 device->FreeHWSurface = DX5_FreeHWSurface; | 596 device->FreeHWSurface = DX5_FreeHWSurface; |
600 #ifdef IID_IDirectDrawGammaControl | 597 #ifdef IID_IDirectDrawGammaControl |
601 device->SetGammaRamp = DX5_SetGammaRamp; | 598 device->SetGammaRamp = DX5_SetGammaRamp; |
602 device->GetGammaRamp = DX5_GetGammaRamp; | 599 device->GetGammaRamp = DX5_GetGammaRamp; |
1911 surface->format->BytesPerPixel; | 1908 surface->format->BytesPerPixel; |
1912 } | 1909 } |
1913 surface->pixels = ddsd.lpSurface; | 1910 surface->pixels = ddsd.lpSurface; |
1914 return(0); | 1911 return(0); |
1915 } | 1912 } |
1916 static int DX5_LockHWSurfaceRect(_THIS, SDL_Surface *surface, SDL_Rect *rect, void **pixels, int *pitch) | |
1917 { | |
1918 HRESULT result; | |
1919 LPDIRECTDRAWSURFACE3 dd_surface; | |
1920 DDSURFACEDESC ddsd; | |
1921 RECT ddrect; | |
1922 | |
1923 /* Calculate the lock rectangle */ | |
1924 ddrect.top = rect->y; | |
1925 ddrect.bottom = rect->y+rect->h; | |
1926 ddrect.left = rect->x; | |
1927 ddrect.right = rect->x+rect->w; | |
1928 | |
1929 /* Lock and load! */ | |
1930 dd_surface = surface->hwdata->dd_writebuf; | |
1931 memset(&ddsd, 0, sizeof(ddsd)); | |
1932 ddsd.dwSize = sizeof(ddsd); | |
1933 result = IDirectDrawSurface3_Lock(dd_surface, &ddrect, &ddsd, | |
1934 (DDLOCK_NOSYSLOCK|DDLOCK_WAIT), NULL); | |
1935 if ( result == DDERR_SURFACELOST ) { | |
1936 result = IDirectDrawSurface3_Restore( | |
1937 surface->hwdata->dd_surface); | |
1938 result = IDirectDrawSurface3_Lock(dd_surface, &ddrect, &ddsd, | |
1939 (DDLOCK_NOSYSLOCK|DDLOCK_WAIT), NULL); | |
1940 } | |
1941 if ( result != DD_OK ) { | |
1942 SetDDerror("DirectDrawSurface3::Lock", result); | |
1943 return(-1); | |
1944 } | |
1945 *pixels = ddsd.lpSurface; | |
1946 #if defined(NONAMELESSUNION) | |
1947 *pitch = ddsd.u1.lPitch; | |
1948 #else | |
1949 *pitch = (Uint16)ddsd.lPitch; | |
1950 #endif | |
1951 return(0); | |
1952 } | |
1953 | 1913 |
1954 static void DX5_UnlockHWSurface(_THIS, SDL_Surface *surface) | 1914 static void DX5_UnlockHWSurface(_THIS, SDL_Surface *surface) |
1955 { | 1915 { |
1956 IDirectDrawSurface3_Unlock(surface->hwdata->dd_writebuf, NULL); | 1916 IDirectDrawSurface3_Unlock(surface->hwdata->dd_writebuf, NULL); |
1957 surface->pixels = NULL; | 1917 surface->pixels = NULL; |