Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
1642:f1211a4b7380 | 1643:51038e80ae59 |
---|---|
332 } | 332 } |
333 | 333 |
334 overlay->hwdata->locked = 0; | 334 overlay->hwdata->locked = 0; |
335 } | 335 } |
336 | 336 |
337 int ph_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* dstrect) | 337 int ph_DisplayYUVOverlay(_THIS, SDL_Overlay* overlay, SDL_Rect* src, SDL_Rect* dst) |
338 { | 338 { |
339 int rtncode; | 339 int rtncode; |
340 PhPoint_t pos; | 340 PhPoint_t pos; |
341 SDL_Rect backrect; | 341 SDL_Rect backrect; |
342 PhRect_t windowextent; | 342 PhRect_t windowextent; |
360 overlay->hwdata->CurrentWindowPos.x=pos.x; | 360 overlay->hwdata->CurrentWindowPos.x=pos.x; |
361 overlay->hwdata->CurrentWindowPos.y=pos.y; | 361 overlay->hwdata->CurrentWindowPos.y=pos.y; |
362 } | 362 } |
363 | 363 |
364 /* If CurrentViewPort position/size has been changed, then move/resize the viewport */ | 364 /* If CurrentViewPort position/size has been changed, then move/resize the viewport */ |
365 if ((overlay->hwdata->CurrentViewPort.pos.x != dstrect->x) || | 365 if ((overlay->hwdata->CurrentViewPort.pos.x != dst->x) || |
366 (overlay->hwdata->CurrentViewPort.pos.y != dstrect->y) || | 366 (overlay->hwdata->CurrentViewPort.pos.y != dst->y) || |
367 (overlay->hwdata->CurrentViewPort.size.w != dstrect->w) || | 367 (overlay->hwdata->CurrentViewPort.size.w != dst->w) || |
368 (overlay->hwdata->CurrentViewPort.size.h != dstrect->h) || | 368 (overlay->hwdata->CurrentViewPort.size.h != dst->h) || |
369 (overlay->hwdata->scaler_on==0) || (winchanged==1) || | 369 (overlay->hwdata->scaler_on==0) || (winchanged==1) || |
370 (overlay->hwdata->forcedredraw==1)) | 370 (overlay->hwdata->forcedredraw==1)) |
371 { | 371 { |
372 | 372 |
373 if (overlay->hwdata->ischromakey==1) | 373 if (overlay->hwdata->ischromakey==1) |
379 backrect.h=overlay->hwdata->CurrentViewPort.size.h; | 379 backrect.h=overlay->hwdata->CurrentViewPort.size.h; |
380 this->UpdateRects(this, 1, &backrect); | 380 this->UpdateRects(this, 1, &backrect); |
381 | 381 |
382 /* Draw the new rectangle of the chroma color at the viewport position */ | 382 /* Draw the new rectangle of the chroma color at the viewport position */ |
383 PgSetFillColor(overlay->hwdata->chromakey); | 383 PgSetFillColor(overlay->hwdata->chromakey); |
384 PgDrawIRect(dstrect->x, dstrect->y, dstrect->x+dstrect->w-1, dstrect->y+dstrect->h-1, Pg_DRAW_FILL); | 384 PgDrawIRect(dst->x, dst->y, dst->x+dst->w-1, dst->y+dst->h-1, Pg_DRAW_FILL); |
385 PgFlush(); | 385 PgFlush(); |
386 } | 386 } |
387 | 387 |
388 overlay->hwdata->props.flags |= Pg_SCALER_PROP_SCALER_ENABLE; | 388 overlay->hwdata->props.flags |= Pg_SCALER_PROP_SCALER_ENABLE; |
389 overlay->hwdata->scaler_on = 1; | 389 overlay->hwdata->scaler_on = 1; |
390 | 390 |
391 PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, PtWidgetRid(window), &windowextent); | 391 PhWindowQueryVisible(Ph_QUERY_CONSOLE, 0, PtWidgetRid(window), &windowextent); |
392 overlay->hwdata->CurrentViewPort.pos.x = pos.x-windowextent.ul.x+dstrect->x; | 392 overlay->hwdata->CurrentViewPort.pos.x = pos.x-windowextent.ul.x+dst->x; |
393 overlay->hwdata->CurrentViewPort.pos.y = pos.y-windowextent.ul.y+dstrect->y; | 393 overlay->hwdata->CurrentViewPort.pos.y = pos.y-windowextent.ul.y+dst->y; |
394 overlay->hwdata->CurrentViewPort.size.w = dstrect->w; | 394 overlay->hwdata->CurrentViewPort.size.w = dst->w; |
395 overlay->hwdata->CurrentViewPort.size.h = dstrect->h; | 395 overlay->hwdata->CurrentViewPort.size.h = dst->h; |
396 PhAreaToRect(&overlay->hwdata->CurrentViewPort, &overlay->hwdata->props.viewport); | 396 PhAreaToRect(&overlay->hwdata->CurrentViewPort, &overlay->hwdata->props.viewport); |
397 overlay->hwdata->CurrentViewPort.pos.x = dstrect->x; | 397 overlay->hwdata->CurrentViewPort.pos.x = dst->x; |
398 overlay->hwdata->CurrentViewPort.pos.y = dstrect->y; | 398 overlay->hwdata->CurrentViewPort.pos.y = dst->y; |
399 | 399 |
400 rtncode = PgConfigScalerChannel(overlay->hwdata->channel, &(overlay->hwdata->props)); | 400 rtncode = PgConfigScalerChannel(overlay->hwdata->channel, &(overlay->hwdata->props)); |
401 | 401 |
402 switch(rtncode) | 402 switch(rtncode) |
403 { | 403 { |