viewport: Raise errors when bad src or dst values are used.
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 12 Nov 2020 00:52:34 +0000 (09:52 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 20 Nov 2020 04:48:50 +0000 (13:48 +0900)
The detail error cases are described at 'scaler.xml' in
wayland-extension project.

Change-Id: Idff11a08ed8c0f4d2f95909fda6230b623e208d1

src/bin/e_comp_wl_viewport.c

index c2d110f5c0a2f71224c1d5c3e99d911aae66068e..36f96a9217b6cb33c16fc3e8bf6ce76bd2cca818 100644 (file)
@@ -1942,12 +1942,23 @@ _e_viewport_cb_set(struct wl_client *client EINA_UNUSED,
      {
         ERR("source dimensions must be non-negative (%fx%f)",
             wl_fixed_to_double(src_width), wl_fixed_to_double(src_height));
+        wl_resource_post_error(resource,
+                               WL_VIEWPORT_ERROR_BAD_VALUE,
+                               "wl_surface@%d viewport source "
+                               "w=%f < 0 or h=%f < 0",
+                               wl_resource_get_id(ec->comp_data->surface),
+                               wl_fixed_to_double(src_width),
+                               wl_fixed_to_double(src_height));
         return;
      }
 
    if (dst_width <= 0 || dst_height <= 0)
      {
         ERR("destination dimensions must be positive (%dx%d)", dst_width, dst_height);
+        wl_resource_post_error(resource,
+                               WL_VIEWPORT_ERROR_BAD_VALUE,
+                               "destination size must be positive (%dx%d)",
+                               dst_width, dst_height);
         return;
      }
 
@@ -1987,6 +1998,13 @@ _e_viewport_cb_set_source(struct wl_client *client EINA_UNUSED,
      {
         ERR("source size must be positive (%fx%f)",
             wl_fixed_to_double(src_width), wl_fixed_to_double(src_height));
+        wl_resource_post_error(resource,
+                               WL_VIEWPORT_ERROR_BAD_VALUE,
+                               "wl_surface@%d viewport source "
+                               "w=%f <= 0 or h=%f <= 0",
+                               wl_resource_get_id(ec->comp_data->surface),
+                               wl_fixed_to_double(src_width),
+                               wl_fixed_to_double(src_height));
         return;
      }
 
@@ -2021,6 +2039,10 @@ _e_viewport_cb_set_destination(struct wl_client *client EINA_UNUSED,
    if (dst_width <= 0 || dst_height <= 0)
      {
         ERR("destination size must be positive (%dx%d)", dst_width, dst_height);
+        wl_resource_post_error(resource,
+                               WL_VIEWPORT_ERROR_BAD_VALUE,
+                               "destination size must be positive (%dx%d)",
+                               dst_width, dst_height);
         return;
      }