diff src/video/photon/SDL_phyuv.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 a1b03ba2fcd0
line wrap: on
line diff
--- a/src/video/photon/SDL_phyuv.c	Mon Apr 17 05:38:33 2006 +0000
+++ b/src/video/photon/SDL_phyuv.c	Mon Apr 17 06:47:23 2006 +0000
@@ -334,7 +334,7 @@
     overlay->hwdata->locked = 0;
 }
 
-int ph_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* dstrect)
+int ph_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* src, SDL_Rect* dst)
 {
     int rtncode;
     PhPoint_t pos;
@@ -362,10 +362,10 @@
     }
 
     /* If CurrentViewPort position/size has been changed, then move/resize the viewport */
-    if ((overlay->hwdata->CurrentViewPort.pos.x != dstrect->x) ||
-        (overlay->hwdata->CurrentViewPort.pos.y != dstrect->y) ||
-        (overlay->hwdata->CurrentViewPort.size.w != dstrect->w) ||
-        (overlay->hwdata->CurrentViewPort.size.h != dstrect->h) ||
+    if ((overlay->hwdata->CurrentViewPort.pos.x != dst->x) ||
+        (overlay->hwdata->CurrentViewPort.pos.y != dst->y) ||
+        (overlay->hwdata->CurrentViewPort.size.w != dst->w) ||
+        (overlay->hwdata->CurrentViewPort.size.h != dst->h) ||
         (overlay->hwdata->scaler_on==0) || (winchanged==1) ||
         (overlay->hwdata->forcedredraw==1))
     {
@@ -381,7 +381,7 @@
 
             /* Draw the new rectangle of the chroma color at the viewport position */
             PgSetFillColor(overlay->hwdata->chromakey);
-            PgDrawIRect(dstrect->x, dstrect->y, dstrect->x+dstrect->w-1, dstrect->y+dstrect->h-1, Pg_DRAW_FILL);
+            PgDrawIRect(dst->x, dst->y, dst->x+dst->w-1, dst->y+dst->h-1, Pg_DRAW_FILL);
             PgFlush();
         }
 
@@ -389,13 +389,13 @@
         overlay->hwdata->scaler_on = 1;
 
         PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, PtWidgetRid(window), &windowextent);
-        overlay->hwdata->CurrentViewPort.pos.x = pos.x-windowextent.ul.x+dstrect->x;
-        overlay->hwdata->CurrentViewPort.pos.y = pos.y-windowextent.ul.y+dstrect->y;
-        overlay->hwdata->CurrentViewPort.size.w = dstrect->w;
-        overlay->hwdata->CurrentViewPort.size.h = dstrect->h;
+        overlay->hwdata->CurrentViewPort.pos.x = pos.x-windowextent.ul.x+dst->x;
+        overlay->hwdata->CurrentViewPort.pos.y = pos.y-windowextent.ul.y+dst->y;
+        overlay->hwdata->CurrentViewPort.size.w = dst->w;
+        overlay->hwdata->CurrentViewPort.size.h = dst->h;
         PhAreaToRect(&overlay->hwdata->CurrentViewPort, &overlay->hwdata->props.viewport);
-        overlay->hwdata->CurrentViewPort.pos.x = dstrect->x;
-        overlay->hwdata->CurrentViewPort.pos.y = dstrect->y;
+        overlay->hwdata->CurrentViewPort.pos.x = dst->x;
+        overlay->hwdata->CurrentViewPort.pos.y = dst->y;
 
         rtncode = PgConfigScalerChannel(overlay->hwdata->channel, &(overlay->hwdata->props));