e_comp: change return type of ...edge_detection_param_set api 80/323980/1
authorhojoon-ryou <hojoon.ryou@samsung.com>
Tue, 29 Apr 2025 03:14:20 +0000 (12:14 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 12 May 2025 04:04:50 +0000 (13:04 +0900)
full function name: e_comp_image_filter_edge_detection_param_set
and add more exception check

Change-Id: I462a49e53eb573cebfa593f89e980f07313970ca

src/bin/compmgr/e_comp.c
src/include/e_comp.h

index f5a038f386f312bbf77b5e10ef7dcab63a984c02..4173bdcaa463002db40b1444cca1c02e85758cb6 100644 (file)
@@ -1307,7 +1307,7 @@ e_comp_image_filter_set(E_Comp_Image_Filter filter)
    return EINA_FALSE;
 }
 
-E_API void
+E_API Eina_Bool
 e_comp_image_filter_edge_detection_param_set(double thickness, unsigned int color_id)
 {
    E_Zone *zone;
@@ -1318,19 +1318,21 @@ e_comp_image_filter_edge_detection_param_set(double thickness, unsigned int colo
    if (thickness <= 0.0 || thickness >= 5.0)
      {
         ERR("Invalid edge detection thickness value: %f", thickness);
-        return;
+        return EINA_FALSE;
      }
 
    if (color_id < 1 || color_id > 4)
      {
         ERR("Invalid edge detection color_id value: %u", color_id);
-        return;
+        return EINA_FALSE;
      }
 
+   EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE);
+
    e_comp->edge_detection_thickness = thickness;
    e_comp->edge_detection_color_id = color_id;
 
-   if (e_comp->image_filter != E_COMP_IMAGE_FILTER_EDGE_DETECTION) return;
+   if (e_comp->image_filter != E_COMP_IMAGE_FILTER_EDGE_DETECTION) return EINA_FALSE;
    EINA_LIST_FOREACH(e_comp->zones, l, zone)
      E_ZONE_CLIENT_FOREACH(zone, ec)
        {
@@ -1340,6 +1342,8 @@ e_comp_image_filter_edge_detection_param_set(double thickness, unsigned int colo
           e_view_client_dirty(view_client);
           e_view_client_render(view_client);
        }
+
+   return EINA_TRUE;
 }
 
 E_API E_Comp_Image_Filter
index 9cf3e7cd62267e38ee35d4c3d683484c55425426..2030707e3c62b5f82b4ca90e3924f558d902f211 100644 (file)
@@ -200,7 +200,7 @@ E_API int             e_comp_nocomp_override_get(void);
 E_API Eina_Bool           e_comp_image_filter_set(E_Comp_Image_Filter filter);
 // 0.0 < thickness < 5.0 (default = 1.0)
 // color_id = 1: Optimized(black or white), 2: Black, 3: White, 4: Green (default = 1)
-E_API void                e_comp_image_filter_edge_detection_param_set(double thickness, unsigned int color_id);
+E_API Eina_Bool           e_comp_image_filter_edge_detection_param_set(double thickness, unsigned int color_id);
 E_API E_Comp_Image_Filter e_comp_image_filter_get(void);
 
 E_API void            e_comp_ec_list_lock(void);