From c0f16f31c611403bfd9eab94f4ac2e5372985240 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Thu, 12 Mar 2020 10:51:36 +0900 Subject: [PATCH] video: enhanced readability Change-Id: I8e2681161b31cba06de3f2fd06977e610928d344 --- src/bin/video/iface/e_video_hwc.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/bin/video/iface/e_video_hwc.c b/src/bin/video/iface/e_video_hwc.c index a9e8965e2b..e8d26afab8 100644 --- a/src/bin/video/iface/e_video_hwc.c +++ b/src/bin/video/iface/e_video_hwc.c @@ -1008,12 +1008,24 @@ normal: * 1. The given coordinates are not represented by rectangle. * 2. All angles except for 0, 90, 180, 270. */ +#ifdef IS_PORTRAIT_RECT +#undef IS_PORTRAIT_RECT +#endif +#define IS_PORTRAIT_RECT(p) \ + ((p[0].y == p[1].y) && (p[1].x == p[2].x) && (p[2].y == p[3].y) && (p[3].x == p[0].x)) + +#ifdef IS_LANDSCAPE_RECT +#undef IS_LANDSCAPE_RECT +#endif +#define IS_LANDSCAPE_RECT(p) \ + ((p[0].x == p[1].x) && (p[1].y == p[2].y) && (p[2].x == p[3].x) && (p[3].y == p[0].y)) + static Eina_Bool _e_video_hwc_coords_to_rectangle_convert(Evas_Point p[4], Eina_Rectangle *rect, uint *transform) { Eina_Bool ret = EINA_FALSE; - if ((p[0].y == p[1].y) && (p[1].x == p[2].x) && (p[2].y == p[3].y) && (p[3].x == p[0].x)) + if (IS_PORTRAIT_RECT(p)) { /* 0 or 180 */ if ((p[0].x < p[2].x) && (p[0].y < p[2].y)) @@ -1029,7 +1041,7 @@ _e_video_hwc_coords_to_rectangle_convert(Evas_Point p[4], Eina_Rectangle *rect, ret = EINA_TRUE; } } - else if ((p[0].x == p[1].x) && (p[1].y == p[2].y) && (p[2].x == p[3].x) && (p[3].y == p[0].y)) + else if (IS_LANDSCAPE_RECT(p)) { /* 90 or 270 */ if ((p[0].x > p[2].x) && (p[0].y < p[2].y)) @@ -1049,6 +1061,9 @@ _e_video_hwc_coords_to_rectangle_convert(Evas_Point p[4], Eina_Rectangle *rect, return ret; } +#undef IS_PORTRAIT_RECT +#undef IS_LANDSCAPE_RECT + /** * Merge transform value of E_Comp_Wl_Buffer_Viewport with given transform. * @in vp A 'E_Comp_Wl_Buffer_Viewport' instance to be merged -- 2.34.1