|
25 | 25 | #include <media/v4l2-device.h> |
26 | 26 | #include <media/v4l2-ioctl.h> |
27 | 27 | #include <media/v4l2-mem2mem.h> |
| 28 | +#include <media/v4l2-rect.h> |
28 | 29 | #include <media/videobuf2-v4l2.h> |
29 | 30 | #include <media/videobuf2-dma-contig.h> |
30 | 31 | #include <media/drv-intf/exynos-fimc.h> |
@@ -868,19 +869,6 @@ static int fimc_lite_reqbufs(struct file *file, void *priv, |
868 | 869 | return ret; |
869 | 870 | } |
870 | 871 |
|
871 | | -/* Return 1 if rectangle a is enclosed in rectangle b, or 0 otherwise. */ |
872 | | -static int enclosed_rectangle(struct v4l2_rect *a, struct v4l2_rect *b) |
873 | | -{ |
874 | | - if (a->left < b->left || a->top < b->top) |
875 | | - return 0; |
876 | | - if (a->left + a->width > b->left + b->width) |
877 | | - return 0; |
878 | | - if (a->top + a->height > b->top + b->height) |
879 | | - return 0; |
880 | | - |
881 | | - return 1; |
882 | | -} |
883 | | - |
884 | 872 | static int fimc_lite_g_selection(struct file *file, void *fh, |
885 | 873 | struct v4l2_selection *sel) |
886 | 874 | { |
@@ -922,11 +910,11 @@ static int fimc_lite_s_selection(struct file *file, void *fh, |
922 | 910 | fimc_lite_try_compose(fimc, &rect); |
923 | 911 |
|
924 | 912 | if ((sel->flags & V4L2_SEL_FLAG_LE) && |
925 | | - !enclosed_rectangle(&rect, &sel->r)) |
| 913 | + !v4l2_rect_enclosed(&rect, &sel->r)) |
926 | 914 | return -ERANGE; |
927 | 915 |
|
928 | 916 | if ((sel->flags & V4L2_SEL_FLAG_GE) && |
929 | | - !enclosed_rectangle(&sel->r, &rect)) |
| 917 | + !v4l2_rect_enclosed(&sel->r, &rect)) |
930 | 918 | return -ERANGE; |
931 | 919 |
|
932 | 920 | sel->r = rect; |
|
0 commit comments