diff src/video/photon/SDL_ph_events.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 141528317f4f
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
line wrap: on
line diff
--- a/src/video/photon/SDL_ph_events.c	Mon Apr 17 05:38:33 2006 +0000
+++ b/src/video/photon/SDL_ph_events.c	Mon Apr 17 06:47:23 2006 +0000
@@ -245,15 +245,19 @@
                    int lockedstate=current_overlay->hwdata->locked;
                    int chromastate=current_overlay->hwdata->ischromakey;
                    int error;
-                   SDL_Rect target;
+                   SDL_Rect src, dst;
 
                    current_overlay->hwdata->locked=1;
-                   target.x=current_overlay->hwdata->CurrentViewPort.pos.x;
-                   target.y=current_overlay->hwdata->CurrentViewPort.pos.y;
-                   target.w=current_overlay->hwdata->CurrentViewPort.size.w;
-                   target.h=current_overlay->hwdata->CurrentViewPort.size.h;
+                   src.x = 0;
+                   src.y = 0;
+                   src.w = current_overlay->w;
+                   src.y = current_overlay->h;
+                   dst.x=current_overlay->hwdata->CurrentViewPort.pos.x;
+                   dst.y=current_overlay->hwdata->CurrentViewPort.pos.y;
+                   dst.w=current_overlay->hwdata->CurrentViewPort.size.w;
+                   dst.h=current_overlay->hwdata->CurrentViewPort.size.h;
                    current_overlay->hwdata->ischromakey=0;
-                   error=ph_DisplayYUVOverlay(this, current_overlay, &target);
+                   error=ph_DisplayYUVOverlay(this, current_overlay, &src, &dst);
                    if (!error)
                    {
                        current_overlay->hwdata->ischromakey=chromastate;
@@ -306,15 +310,19 @@
                     {
                         int lockedstate=current_overlay->hwdata->locked;
                         int error;
-                        SDL_Rect target;
+                        SDL_Rect src, dst;
 
                         current_overlay->hwdata->locked=1;
-                        target.x=current_overlay->hwdata->CurrentViewPort.pos.x;
-                        target.y=current_overlay->hwdata->CurrentViewPort.pos.y;
-                        target.w=current_overlay->hwdata->CurrentViewPort.size.w;
-                        target.h=current_overlay->hwdata->CurrentViewPort.size.h;
+                        src.x = 0;
+                        src.y = 0;
+                        src.w = current_overlay->w;
+                        src.y = current_overlay->h;
+                        dst.x=current_overlay->hwdata->CurrentViewPort.pos.x;
+                        dst.y=current_overlay->hwdata->CurrentViewPort.pos.y;
+                        dst.w=current_overlay->hwdata->CurrentViewPort.size.w;
+                        dst.h=current_overlay->hwdata->CurrentViewPort.size.h;
                         current_overlay->hwdata->forcedredraw=1;
-                        error=ph_DisplayYUVOverlay(this, current_overlay, &target);
+                        error=ph_DisplayYUVOverlay(this, current_overlay, &src, &dst);
                         if (!error)
                         {
                             current_overlay->hwdata->forcedredraw=0;