comparison src/video/ps2gs/SDL_gsyuv.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 14717b52abc0
comparison
equal deleted inserted replaced
1642:f1211a4b7380 1643:51038e80ae59
313 void GS_UnlockYUVOverlay(_THIS, SDL_Overlay *overlay) 313 void GS_UnlockYUVOverlay(_THIS, SDL_Overlay *overlay)
314 { 314 {
315 return; 315 return;
316 } 316 }
317 317
318 int GS_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *dstrect) 318 int GS_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *src, SDL_Rect *dst)
319 { 319 {
320 struct private_yuvhwdata *hwdata; 320 struct private_yuvhwdata *hwdata;
321 __u32 cmd; 321 __u32 cmd;
322 struct ps2_packet packet; 322 struct ps2_packet packet;
323 int h, w, i; 323 int h, w, i;
421 /* Wait for previous DMA to complete */ 421 /* Wait for previous DMA to complete */
422 ioctl(console_fd, PS2IOC_SENDQCT, 1); 422 ioctl(console_fd, PS2IOC_SENDQCT, 1);
423 423
424 /* Send the current image to the screen and scale it */ 424 /* Send the current image to the screen and scale it */
425 screen = this->screen; 425 screen = this->screen;
426 x = (unsigned int)dstrect->x; 426 x = (unsigned int)dst->x;
427 y = (unsigned int)dstrect->y; 427 y = (unsigned int)dst->y;
428 if ( screen->offset ) { 428 if ( screen->offset ) {
429 x += (screen->offset % screen->pitch) / 429 x += (screen->offset % screen->pitch) /
430 screen->format->BytesPerPixel; 430 screen->format->BytesPerPixel;
431 y += (screen->offset / screen->pitch); 431 y += (screen->offset / screen->pitch);
432 } 432 }
433 y += screen_image.y; 433 y += screen_image.y;
434 *hwdata->stretch_x1y1 = (x * 16) + ((y * 16) << 16); 434 *hwdata->stretch_x1y1 = (x * 16) + ((y * 16) << 16);
435 x += (unsigned int)dstrect->w; 435 x += (unsigned int)dst->w;
436 y += (unsigned int)dstrect->h; 436 y += (unsigned int)dst->h;
437 *hwdata->stretch_x2y2 = (x * 16) + ((y * 16) << 16); 437 *hwdata->stretch_x2y2 = (x * 16) + ((y * 16) << 16);
438 return ioctl(console_fd, PS2IOC_SENDL, &hwdata->plist); 438 return ioctl(console_fd, PS2IOC_SENDL, &hwdata->plist);
439 } 439 }
440 440
441 void GS_FreeYUVOverlay(_THIS, SDL_Overlay *overlay) 441 void GS_FreeYUVOverlay(_THIS, SDL_Overlay *overlay)