comparison 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
comparison
equal deleted inserted replaced
1642:f1211a4b7380 1643:51038e80ae59
243 if (current_overlay!=NULL) 243 if (current_overlay!=NULL)
244 { 244 {
245 int lockedstate=current_overlay->hwdata->locked; 245 int lockedstate=current_overlay->hwdata->locked;
246 int chromastate=current_overlay->hwdata->ischromakey; 246 int chromastate=current_overlay->hwdata->ischromakey;
247 int error; 247 int error;
248 SDL_Rect target; 248 SDL_Rect src, dst;
249 249
250 current_overlay->hwdata->locked=1; 250 current_overlay->hwdata->locked=1;
251 target.x=current_overlay->hwdata->CurrentViewPort.pos.x; 251 src.x = 0;
252 target.y=current_overlay->hwdata->CurrentViewPort.pos.y; 252 src.y = 0;
253 target.w=current_overlay->hwdata->CurrentViewPort.size.w; 253 src.w = current_overlay->w;
254 target.h=current_overlay->hwdata->CurrentViewPort.size.h; 254 src.y = current_overlay->h;
255 dst.x=current_overlay->hwdata->CurrentViewPort.pos.x;
256 dst.y=current_overlay->hwdata->CurrentViewPort.pos.y;
257 dst.w=current_overlay->hwdata->CurrentViewPort.size.w;
258 dst.h=current_overlay->hwdata->CurrentViewPort.size.h;
255 current_overlay->hwdata->ischromakey=0; 259 current_overlay->hwdata->ischromakey=0;
256 error=ph_DisplayYUVOverlay(this, current_overlay, &target); 260 error=ph_DisplayYUVOverlay(this, current_overlay, &src, &dst);
257 if (!error) 261 if (!error)
258 { 262 {
259 current_overlay->hwdata->ischromakey=chromastate; 263 current_overlay->hwdata->ischromakey=chromastate;
260 current_overlay->hwdata->locked=lockedstate; 264 current_overlay->hwdata->locked=lockedstate;
261 } 265 }
304 308
305 if (current_overlay!=NULL) 309 if (current_overlay!=NULL)
306 { 310 {
307 int lockedstate=current_overlay->hwdata->locked; 311 int lockedstate=current_overlay->hwdata->locked;
308 int error; 312 int error;
309 SDL_Rect target; 313 SDL_Rect src, dst;
310 314
311 current_overlay->hwdata->locked=1; 315 current_overlay->hwdata->locked=1;
312 target.x=current_overlay->hwdata->CurrentViewPort.pos.x; 316 src.x = 0;
313 target.y=current_overlay->hwdata->CurrentViewPort.pos.y; 317 src.y = 0;
314 target.w=current_overlay->hwdata->CurrentViewPort.size.w; 318 src.w = current_overlay->w;
315 target.h=current_overlay->hwdata->CurrentViewPort.size.h; 319 src.y = current_overlay->h;
320 dst.x=current_overlay->hwdata->CurrentViewPort.pos.x;
321 dst.y=current_overlay->hwdata->CurrentViewPort.pos.y;
322 dst.w=current_overlay->hwdata->CurrentViewPort.size.w;
323 dst.h=current_overlay->hwdata->CurrentViewPort.size.h;
316 current_overlay->hwdata->forcedredraw=1; 324 current_overlay->hwdata->forcedredraw=1;
317 error=ph_DisplayYUVOverlay(this, current_overlay, &target); 325 error=ph_DisplayYUVOverlay(this, current_overlay, &src, &dst);
318 if (!error) 326 if (!error)
319 { 327 {
320 current_overlay->hwdata->forcedredraw=0; 328 current_overlay->hwdata->forcedredraw=0;
321 current_overlay->hwdata->locked=lockedstate; 329 current_overlay->hwdata->locked=lockedstate;
322 } 330 }