From 396594d7f39fa2128f6aac78e4c024310460f892 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Fri, 21 Apr 2023 14:13:10 +0900 Subject: [PATCH] video: Fix render failure for 1x1 size While determining whether the given vertices represent the portrait or the landscape rectangle, the margin of 1 pixel has been used because sometimes there has been 1 pixel difference between two adjacent vertices. This could be because of evas map algorithm, but I'm not sure. If the dimension of rectangle would be 1x1 it wouldn't be worked, so if the given vertices represent the rectangle that has 1x1 dimension, then no margin would be used. Change-Id: I0c776060ed3124dfd72717e474f193929ae51c6a --- src/bin/video/iface/e_video_hwc.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/bin/video/iface/e_video_hwc.c b/src/bin/video/iface/e_video_hwc.c index ab48990..d48db56 100644 --- a/src/bin/video/iface/e_video_hwc.c +++ b/src/bin/video/iface/e_video_hwc.c @@ -1047,37 +1047,43 @@ normal: #ifdef IS_CLOSE #undef IS_CLOSE #endif -#define IS_CLOSE(x, y) (abs((x - y)) < 2) +#define IS_CLOSE(x, y, m) (abs((x - y)) < m) #ifdef IS_PORTRAIT_RECT #undef IS_PORTRAIT_RECT #endif -#define IS_PORTRAIT_RECT(p) \ - (IS_CLOSE(p[0].y, p[1].y) && IS_CLOSE(p[1].x, p[2].x) && \ - IS_CLOSE(p[2].y, p[3].y) && IS_CLOSE(p[3].x, p[0].x)) +#define IS_PORTRAIT_RECT(p, m) \ + (IS_CLOSE(p[0].y, p[1].y, m) && IS_CLOSE(p[1].x, p[2].x, m) && \ + IS_CLOSE(p[2].y, p[3].y, m) && IS_CLOSE(p[3].x, p[0].x, m)) #ifdef IS_LANDSCAPE_RECT #undef IS_LANDSCAPE_RECT #endif -#define IS_LANDSCAPE_RECT(p) \ - (IS_CLOSE(p[0].x, p[1].x) && IS_CLOSE(p[1].y, p[2].y) && \ - IS_CLOSE(p[2].x, p[3].x) && IS_CLOSE(p[3].y, p[0].y)) +#define IS_LANDSCAPE_RECT(p, m) \ + (IS_CLOSE(p[0].x, p[1].x, m) && IS_CLOSE(p[1].y, p[2].y, m) && \ + IS_CLOSE(p[2].x, p[3].x, m) && IS_CLOSE(p[3].y, p[0].y, m)) #ifdef VERTICES_TO_RECT #undef VERTICES_TO_RECT #endif -#define VERTICES_TO_RECT(r, vs) \ - r->x = MIN(vs[0].x, vs[2].x); \ - r->y = MIN(vs[0].y, vs[2].y); \ - r->w = MAX(vs[0].x, vs[2].x) - r->x; \ - r->h = MAX(vs[0].y, vs[2].y) - r->y +#define VERTICES_TO_RECT(r, vs) \ + (r)->x = MIN(vs[0].x, vs[2].x); \ + (r)->y = MIN(vs[0].y, vs[2].y); \ + (r)->w = MAX(vs[0].x, vs[2].x) - (r)->x; \ + (r)->h = MAX(vs[0].y, vs[2].y) - (r)->y static Eina_Bool _e_video_hwc_coords_to_rectangle_convert(Evas_Point p[4], Eina_Rectangle *rect, uint *transform) { + Eina_Rectangle boundary = {0,}; Eina_Bool ret = EINA_FALSE; + int margin = 2; - if (IS_PORTRAIT_RECT(p)) + VERTICES_TO_RECT(&boundary, p); + if ((boundary.w < 2) || (boundary.h < 2)) + margin = 1; + + if (IS_PORTRAIT_RECT(p, margin)) { /* 0 or 180 */ if ((p[0].x < p[2].x) && (p[0].y < p[2].y)) @@ -1093,7 +1099,7 @@ _e_video_hwc_coords_to_rectangle_convert(Evas_Point p[4], Eina_Rectangle *rect, ret = EINA_TRUE; } } - else if (IS_LANDSCAPE_RECT(p)) + else if (IS_LANDSCAPE_RECT(p, margin)) { /* 90 or 270 */ if ((p[0].x > p[2].x) && (p[0].y < p[2].y)) -- 2.7.4