vlc | branch: master | Francois Cartegnie <[email protected]> | Thu Jun 1 18:32:21 2017 +0200| [956af56870bf3218fa0dae4933a45631bebd27b3] | committer: Francois Cartegnie
vout: change spu_area to unsigned > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=956af56870bf3218fa0dae4933a45631bebd27b3 --- src/video_output/vout_subpictures.c | 43 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c index 2eb9fd8870..10ba9b053c 100644 --- a/src/video_output/vout_subpictures.c +++ b/src/video_output/vout_subpictures.c @@ -329,15 +329,15 @@ static int spu_invscale_h(unsigned v, const spu_scale_t s) * A few area functions helpers */ typedef struct { - int x; - int y; - int width; - int height; + unsigned x; + unsigned y; + unsigned width; + unsigned height; spu_scale_t scale; } spu_area_t; -static spu_area_t spu_area_create(int x, int y, int w, int h, spu_scale_t s) +static spu_area_t spu_area_create(unsigned x, unsigned y, unsigned w, unsigned h, spu_scale_t s) { spu_area_t a = { .x = x, .y = y, .width = w, .height = h, .scale = s }; return a; @@ -372,14 +372,11 @@ static spu_area_t spu_area_unscaled(spu_area_t a, spu_scale_t s) } static bool spu_area_overlap(spu_area_t a, spu_area_t b) { - const int dx = 0; - const int dy = 0; - a = spu_area_scaled(a); b = spu_area_scaled(b); - return __MAX(a.x - dx, b.x) < __MIN(a.x + a.width + dx, b.x + b.width ) && - __MAX(a.y - dy, b.y) < __MIN(a.y + a.height + dy, b.y + b.height); + return __MAX(a.x, b.x) < __MIN(a.x + a.width, b.x + b.width ) && + __MAX(a.y, b.y) < __MIN(a.y + a.height, b.y + b.height); } /** @@ -432,17 +429,21 @@ static void SpuAreaFitInside(spu_area_t *area, const spu_area_t *boundary) { spu_area_t a = spu_area_scaled(*area); - const int i_error_x = (a.x + a.width) - boundary->width; - if (i_error_x > 0) - a.x -= i_error_x; - if (a.x < 0) - a.x = 0; - - const int i_error_y = (a.y + a.height) - boundary->height; - if (i_error_y > 0) - a.y -= i_error_y; - if (a.y < 0) - a.y = 0; + if((a.x + a.width) > boundary->width) + { + if(boundary->width > a.width) + a.x = boundary->width - a.width; + else + a.x = 0; + } + + if((a.y + a.height) > boundary->height) + { + if(boundary->height > a.height) + a.y = boundary->height - a.height; + else + a.y = 0; + } *area = spu_area_unscaled(a, area->scale); } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
