summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2015-08-29 16:51:08 +0530
committerLuis de Bethencourt <luis@debethencourt.com>2015-08-29 17:27:45 +0100
commitdb49716c709cc515af7fc62e7c33fcc119b36347 (patch)
tree315a450bf9263524bb842fa5b6b56abafb1234e2
parent536e3742aa0dd4a3bc18249166a556067d96b8ba (diff)
downloadgstreamer-plugins-bad-db49716c709cc515af7fc62e7c33fcc119b36347.tar.gz
compositor: variables in clamp_rectangle() should be signed
x/y/w/h are signed integers. As can be seen in GstCompositorPad. The prototype for clamp_rectangle was wrong. This commit reverts the change and fixes the prototype. This reverts commit bca444ea4a84c39e9989681f892f6e4cb2033cf9.
-rw-r--r--gst/compositor/compositor.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gst/compositor/compositor.c b/gst/compositor/compositor.c
index 66927ba3a..64d05ac18 100644
--- a/gst/compositor/compositor.c
+++ b/gst/compositor/compositor.c
@@ -351,21 +351,21 @@ is_rectangle_contained (GstVideoRectangle rect1, GstVideoRectangle rect2)
}
static GstVideoRectangle
-clamp_rectangle (guint x, guint y, guint w, guint h, guint outer_width,
+clamp_rectangle (gint x, gint y, gint w, gint h, guint outer_width,
guint outer_height)
{
- guint x2 = x + w;
- guint y2 = y + h;
+ gint x2 = x + w;
+ gint y2 = y + h;
GstVideoRectangle clamped;
/* Clamp the x/y coordinates of this frame to the output boundaries to cover
* 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 = 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;
+ 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;
return clamped;
}