client_video: Add e_client_video_is_viewport_offscreen 81/325581/2
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 11 Jun 2025 09:29:41 +0000 (18:29 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Thu, 12 Jun 2025 08:58:38 +0000 (08:58 +0000)
This commit introduces the e_client_is_viewport_offscreen API, which
checks whether the video viewport is positioned outside the visible
screen area.
The function returns true if the video viewport is outside of the screen
area, and false if any part of the viewport is still visible within the
screen boundaries.

Change-Id: I4fdbb5eb1ff952e7e8ae3a54bfc18d0a0350d04b

src/bin/core/e_client_video.c
src/bin/core/e_client_video_intern.h
src/bin/displaymgr/video/e_video_comp_iface.h
src/bin/displaymgr/video/e_video_hwc.c

index 664b5b4b502aa9cb63a8f2dfc5b5d156c3379828..113b4cfb4544094f7fbf1f9ed6ed1ecf17b90bef 100644 (file)
@@ -565,6 +565,14 @@ e_client_video_tbm_surface_get(E_Client *ec)
    return ecv->iface->tbm_surface_get(ecv->iface);
 }
 
+EINTERN Eina_Bool
+e_client_video_is_viewport_offscreen(E_Client *ec)
+{
+   IFACE_CHECK_RET(is_viewport_offscreen, EINA_FALSE);
+
+   return ecv->iface->is_viewport_offscreen(ecv->iface);
+}
+
 E_API Eina_Bool
 e_client_is_video(E_Client *ec)
 {
index c72aadc916dbcf6d8d628360c436dbc722d84184..c1d4b4d320ecf4d3c889f9ae36ea53642180db8b 100644 (file)
@@ -30,4 +30,13 @@ EINTERN tbm_surface_h  e_client_video_tbm_surface_get(E_Client *ec);
 
 EINTERN E_Client      *e_client_video_ec_get(E_Client_Video *ecv);
 
+/**
+ * Check whether the video viewport is fully outside the screen area
+ *
+ * This function returns true only if the entire video viewport lies outside the
+ * visible screen bounds. It returns false if any part of the viewport is still
+ * visible within the screen boundaries.
+ */
+Eina_Bool e_client_video_is_viewport_offscreen(E_Client *ec);
+
 #endif
index 22412c55619718f07eda9a9a8dd6fe6d48c86d73..32d635afb6422332f153d27bd7a3e1c9660393df 100644 (file)
@@ -17,6 +17,7 @@ struct _E_Video_Comp_Iface
    Eina_Bool       (*info_get)(E_Video_Comp_Iface *iface, E_Client_Video_Info *info);
    Eina_Bool       (*commit_data_release)(E_Video_Comp_Iface *iface, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec);
    tbm_surface_h   (*tbm_surface_get)(E_Video_Comp_Iface *iface);
+   Eina_Bool       (*is_viewport_offscreen)(E_Video_Comp_Iface *iface);
 };
 
 #endif
index b3e2a79a1e9e8e82c66a1ed86b546258223bf7dd..4f06724c9d75610c6b47eec3b0bbbdb427263791 100644 (file)
@@ -64,6 +64,8 @@ struct _E_Video_Hwc_Geometry
         Eina_Rectangle output_r; /* video plane rect in physical output coordinates */
         uint transform;          /* rotate, flip in physical output coordinates */
    } tdm;
+
+   Eina_Bool is_viewport_offscreen;
 };
 
 struct _E_Video_Hwc
@@ -1100,17 +1102,11 @@ _e_video_hwc_viewport_crop_by_screen(E_Video_Hwc_Geometry *in_out, E_Zone *zone,
    output_rect = &in_out->tdm.output_r;
    screen_rect = _screen_rect_get(zone, output_transform);
 
-   /* No need to crop in case output region doesn't stick out of screen region. */
-   if (E_CONTAINS(screen_rect.x, screen_rect.y,
-                  screen_rect.w, screen_rect.h,
-                  output_rect->x, output_rect->y,
-                  output_rect->w, output_rect->h))
-     return;
-
-   EINA_RECTANGLE_SET(&cropped_output_rect,
-                      output_rect->x, output_rect->y,
-                      output_rect->w, output_rect->h);
-   if (!eina_rectangle_intersection(&cropped_output_rect, &screen_rect))
+   in_out->is_viewport_offscreen = !E_INTERSECTS(screen_rect.x, screen_rect.y,
+                                                 screen_rect.w, screen_rect.h,
+                                                 output_rect->x, output_rect->y,
+                                                 output_rect->w, output_rect->h);
+   if (in_out->is_viewport_offscreen)
      {
         VER("Video won't be displayed because there is no intersection between "
             "screen region and output region.\n"
@@ -1122,11 +1118,23 @@ _e_video_hwc_viewport_crop_by_screen(E_Video_Hwc_Geometry *in_out, E_Zone *zone,
         return;
      }
 
+   /* No need to crop in case output region doesn't stick out of screen region. */
+   if (E_CONTAINS(screen_rect.x, screen_rect.y,
+                  screen_rect.w, screen_rect.h,
+                  output_rect->x, output_rect->y,
+                  output_rect->w, output_rect->h))
+     return;
+
    VIN("Crop video viewport by screen", NULL);
    VIN("Screen(%d,%d %dx%d)", NULL, EINA_RECTANGLE_ARGS(&screen_rect));
    VIN("Viewport: source of buffer(%d,%d %dx%d) destination of screen(%d,%d %dx%d)",
        NULL, EINA_RECTANGLE_ARGS(buffer_rect), EINA_RECTANGLE_ARGS(output_rect));
 
+   EINA_RECTANGLE_SET(&cropped_output_rect,
+                      output_rect->x, output_rect->y,
+                      output_rect->w, output_rect->h);
+   assert(eina_rectangle_intersection(&cropped_output_rect, &screen_rect) == EINA_TRUE);
+
    _rect_to_points(&cropped_output_rect, points);
 
    /* Get points of cropped rectangle mapped on output_rect-local coordinates. */
@@ -2173,6 +2181,14 @@ _e_video_hwc_iface_tbm_surface_get(E_Video_Comp_Iface *iface)
    return evh->commit_data.buffer;
 }
 
+static Eina_Bool
+_e_video_hwc_iface_is_viewport_offscreen(E_Video_Comp_Iface *iface)
+{
+   IFACE_ENTRY;
+
+   return evh->geo.is_viewport_offscreen;
+}
+
 static E_Video_Hwc *
 _e_video_hwc_create(E_Client *ec)
 {
@@ -2254,6 +2270,7 @@ e_video_hwc_iface_create(E_Client_Video *ecv)
    evh->iface.info_get = _e_video_hwc_iface_info_get;
    evh->iface.commit_data_release = _e_video_hwc_iface_commit_data_release;
    evh->iface.tbm_surface_get = _e_video_hwc_iface_tbm_surface_get;
+   evh->iface.is_viewport_offscreen = _e_video_hwc_iface_is_viewport_offscreen;
 
    /* This ec is a video client now. */
    e_client_video_hw_composition_set(ecv);