From: Luis de Bethencourt Date: Fri, 28 Aug 2015 14:21:11 +0000 (+0100) Subject: compositor: remove check for below zero for unsigned value X-Git-Tag: 1.16.2~260^2~168 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4b584b3e53e40c150c0d62a3b3a96d0346c86c4;p=platform%2Fupstream%2Fgst-plugins-base.git compositor: remove check for below zero for unsigned value CLAMP checks both if value is '< 0' and '> max'. Value will never be a negative number since it is an unsigned integer. Removing that check and only checking if it is bigger than max by using MIN(). CID 1320707 --- diff --git a/gst/compositor/compositor.c b/gst/compositor/compositor.c index 9aa651f..66927ba 100644 --- a/gst/compositor/compositor.c +++ b/gst/compositor/compositor.c @@ -362,10 +362,10 @@ clamp_rectangle (guint x, guint y, guint w, guint h, guint outer_width, * the case where (say, with negative xpos/ypos or w/h greater than the output * size) the non-obscured portion of the frame could be outside the bounds of * the video itself and hence not visible at all */ - clamped.x = CLAMP (x, 0, outer_width); - clamped.y = CLAMP (y, 0, outer_height); - clamped.w = CLAMP (x2, 0, outer_width) - clamped.x; - clamped.h = CLAMP (y2, 0, outer_height) - clamped.y; + clamped.x = MIN (x, outer_width); + clamped.y = MIN (y, outer_height); + clamped.w = MIN (x2, outer_width) - clamped.x; + clamped.h = MIN (y2, outer_height) - clamped.y; return clamped; }