}
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;
}