diff src/video/windx5/SDL_dx5yuv.c @ 1643:51038e80ae59

More general fix for bug #189 The clipping is done at a higher level, and the low level functions are passed clipped rectangles. Drivers which don't support source clipping have not been changed, so the image will be squished instead of clipped, but at least they will no longer crash when the destination rect was out of bounds.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 17 Apr 2006 06:47:23 +0000
parents d910939febfa
children 782fd950bd46 c121d94672cb 96ce26f24b01
line wrap: on
line diff
--- a/src/video/windx5/SDL_dx5yuv.c	Mon Apr 17 05:38:33 2006 +0000
+++ b/src/video/windx5/SDL_dx5yuv.c	Mon Apr 17 06:47:23 2006 +0000
@@ -247,30 +247,30 @@
 	IDirectDrawSurface3_Unlock(surface, NULL);
 }
 
-int DX5_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *dstrect)
+int DX5_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *src, SDL_Rect *dst)
 {
 	HRESULT result;
 	LPDIRECTDRAWSURFACE3 surface;
-	RECT src, dst;
+	RECT srcrect, dstrect;
 
 	surface = overlay->hwdata->surface;
-	src.top = 0;
-	src.bottom = overlay->h;
-	src.left = 0;
-	src.right = overlay->w;
-	dst.top = SDL_bounds.top+dstrect->y;
-	dst.left = SDL_bounds.left+dstrect->x;
-	dst.bottom = dst.top+dstrect->h;
-	dst.right = dst.left+dstrect->w;
+	srcrect.top = src->y;
+	srcrect.bottom = srcrect.top+src->h;
+	srcrect.left = src->x;
+	srcrect.right = srcrect.left+src->w;
+	dstrect.top = SDL_bounds.top+dst->y;
+	dstrect.left = SDL_bounds.left+dst->x;
+	dstrect.bottom = dstrect.top+dst->h;
+	dstrect.right = dstrect.left+dst->w;
 #ifdef USE_DIRECTX_OVERLAY
-	result = IDirectDrawSurface3_UpdateOverlay(surface, &src,
-				SDL_primary, &dst, DDOVER_SHOW, NULL);
+	result = IDirectDrawSurface3_UpdateOverlay(surface, &srcrect,
+				SDL_primary, &dstrect, DDOVER_SHOW, NULL);
 	if ( result != DD_OK ) {
 		SetDDerror("DirectDrawSurface3::UpdateOverlay", result);
 		return(-1);
 	}
 #else
-	result = IDirectDrawSurface3_Blt(SDL_primary, &dst, surface, &src,
+	result = IDirectDrawSurface3_Blt(SDL_primary, &dstrect, surface, &srcrect,
 							DDBLT_WAIT, NULL);
 	if ( result != DD_OK ) {
 		SetDDerror("DirectDrawSurface3::Blt", result);