summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2023-02-27 11:19:54 +0100
committerMarius Vlad <marius.vlad@collabora.com>2023-04-19 09:38:09 +0300
commita3a843163451f0a07c5ce9980f27bb95ed7622cb (patch)
treeffc1a13106bcf3bdd6eae5a95c67ae28f4479c4e
parent3805bcad902871a878982a83ce00e4a7c03a384f (diff)
downloadweston-a3a843163451f0a07c5ce9980f27bb95ed7622cb.tar.gz
ivi-layout: simplify API
Use assert() to check for invalid NULL arguments. Something like that happens during development and assert() makes it easier to find the error. And it avoids unnecessary additional error handling. The hmi-controller asserted anyways so this just moves the assert on level deeper. Other controller probably do the same thing, or don't check the return values at all. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--ivi-shell/ivi-layout-export.h184
-rw-r--r--ivi-shell/ivi-layout-private.h10
-rw-r--r--ivi-shell/ivi-layout.c326
3 files changed, 157 insertions, 363 deletions
diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
index 4ff5abcc..8f934608 100644
--- a/ivi-shell/ivi-layout-export.h
+++ b/ivi-shell/ivi-layout-export.h
@@ -187,7 +187,7 @@ struct ivi_layout_interface {
* The pointer of the created ivi_surface is sent as the void *data argument
* to the wl_listener::notify callback function of the listener.
*/
- int32_t (*add_listener_create_surface)(struct wl_listener *listener);
+ void (*add_listener_create_surface)(struct wl_listener *listener);
/**
* \brief add a listener for notification when ivi_surface is removed
@@ -197,7 +197,7 @@ struct ivi_layout_interface {
* The pointer of the removed ivi_surface is sent as the void *data argument
* to the wl_listener::notify callback function of the listener.
*/
- int32_t (*add_listener_remove_surface)(struct wl_listener *listener);
+ void (*add_listener_remove_surface)(struct wl_listener *listener);
/**
* \brief add a listener for notification when ivi_surface is configured
@@ -207,7 +207,7 @@ struct ivi_layout_interface {
* The pointer of the configured ivi_surface is sent as the void *data argument
* to the wl_listener::notify callback function of the listener.
*/
- int32_t (*add_listener_configure_surface)(struct wl_listener *listener);
+ void (*add_listener_configure_surface)(struct wl_listener *listener);
/**
* \brief add a listener for notification when desktop_surface is configured
@@ -217,16 +217,13 @@ struct ivi_layout_interface {
* The pointer of the configured desktop_surface is sent as the void *data argument
* to the wl_listener::notify callback function of the listener.
*/
- int32_t (*add_listener_configure_desktop_surface)(struct wl_listener *listener);
+ void (*add_listener_configure_desktop_surface)(struct wl_listener *listener);
/**
* \brief Get all ivi_surfaces which are currently registered and managed
* by the services
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*get_surfaces)(int32_t *pLength, struct ivi_layout_surface ***ppArray);
+ void (*get_surfaces)(int32_t *pLength, struct ivi_layout_surface ***ppArray);
/**
* \brief get id of ivi_surface from ivi_layout_surface
@@ -258,56 +255,44 @@ struct ivi_layout_interface {
/**
* \brief Get all Surfaces which are currently registered to a given
* layer and are managed by the services
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*get_surfaces_on_layer)(struct ivi_layout_layer *ivilayer,
- int32_t *pLength,
- struct ivi_layout_surface ***ppArray);
+ void (*get_surfaces_on_layer)(struct ivi_layout_layer *ivilayer,
+ int32_t *pLength,
+ struct ivi_layout_surface ***ppArray);
/**
* \brief Set the visibility of a ivi_surface.
*
* If a surface is not visible it will not be rendered.
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*surface_set_visibility)(struct ivi_layout_surface *ivisurf,
- bool newVisibility);
+ void (*surface_set_visibility)(struct ivi_layout_surface *ivisurf,
+ bool newVisibility);
/**
* \brief Set the opacity of a surface.
*
* \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
+ * \return IVI_FAILED if the specified opacity is out of bounds
*/
int32_t (*surface_set_opacity)(struct ivi_layout_surface *ivisurf,
wl_fixed_t opacity);
/**
* \brief Set the area of a ivi_surface which should be used for the rendering.
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*surface_set_source_rectangle)(struct ivi_layout_surface *ivisurf,
- int32_t x, int32_t y,
- int32_t width, int32_t height);
+ void (*surface_set_source_rectangle)(struct ivi_layout_surface *ivisurf,
+ int32_t x, int32_t y,
+ int32_t width, int32_t height);
/**
* \brief Set the destination area of a ivi_surface within a ivi_layer
* for rendering.
*
* The surface will be scaled to this rectangle for rendering.
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*surface_set_destination_rectangle)(struct ivi_layout_surface *ivisurf,
- int32_t x, int32_t y,
- int32_t width, int32_t height);
+ void (*surface_set_destination_rectangle)(struct ivi_layout_surface *ivisurf,
+ int32_t x, int32_t y,
+ int32_t width, int32_t height);
/**
* \brief add a listener to listen property changes of ivi_surface
@@ -316,11 +301,8 @@ struct ivi_layout_interface {
* signal is emitted to the listening controller plugins.
* The pointer of the ivi_surface is sent as the void *data argument
* to the wl_listener::notify callback function of the listener.
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*surface_add_listener)(struct ivi_layout_surface *ivisurf,
+ void (*surface_add_listener)(struct ivi_layout_surface *ivisurf,
struct wl_listener *listener);
/**
@@ -332,16 +314,15 @@ struct ivi_layout_interface {
/**
* \brief set type of transition animation
*/
- int32_t (*surface_set_transition)(struct ivi_layout_surface *ivisurf,
- enum ivi_layout_transition_type type,
- uint32_t duration);
+ void (*surface_set_transition)(struct ivi_layout_surface *ivisurf,
+ enum ivi_layout_transition_type type,
+ uint32_t duration);
/**
* \brief set duration of transition animation
*/
- int32_t (*surface_set_transition_duration)(
- struct ivi_layout_surface *ivisurf,
- uint32_t duration);
+ void (*surface_set_transition_duration)(struct ivi_layout_surface *ivisurf,
+ uint32_t duration);
/**
* \brief set id of ivi_layout_surface
@@ -361,7 +342,7 @@ struct ivi_layout_interface {
* The pointer of the created ivi_layer is sent as the void *data argument
* to the wl_listener::notify callback function of the listener.
*/
- int32_t (*add_listener_create_layer)(struct wl_listener *listener);
+ void (*add_listener_create_layer)(struct wl_listener *listener);
/**
* \brief add a listener for notification when ivi_layer is removed
@@ -371,7 +352,7 @@ struct ivi_layout_interface {
* The pointer of the removed ivi_layer is sent as the void *data argument
* to the wl_listener::notify callback function of the listener.
*/
- int32_t (*add_listener_remove_layer)(struct wl_listener *listener);
+ void (*add_listener_remove_layer)(struct wl_listener *listener);
/**
* \brief Create a ivi_layer which should be managed by the service
@@ -392,11 +373,8 @@ struct ivi_layout_interface {
/**
* \brief Get all ivi_layers which are currently registered and managed
* by the services
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*get_layers)(int32_t *pLength, struct ivi_layout_layer ***ppArray);
+ void (*get_layers)(int32_t *pLength, struct ivi_layout_layer ***ppArray);
/**
* \brief get id of ivi_layer from ivi_layout_layer
@@ -430,39 +408,30 @@ struct ivi_layout_interface {
*
* This means all the ivi-layers the ivi-surface was added to. It has
* no relation to geometric overlaps.
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*get_layers_under_surface)(struct ivi_layout_surface *ivisurf,
- int32_t *pLength,
+ void (*get_layers_under_surface)(struct ivi_layout_surface *ivisurf,
+ int32_t *pLength,
struct ivi_layout_layer ***ppArray);
/**
* \brief Get all Layers of the given weston_output
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*get_layers_on_screen)(struct weston_output *output,
- int32_t *pLength,
- struct ivi_layout_layer ***ppArray);
+ void (*get_layers_on_screen)(struct weston_output *output,
+ int32_t *pLength,
+ struct ivi_layout_layer ***ppArray);
/**
* \brief Set the visibility of a ivi_layer. If a ivi_layer is not visible,
* the ivi_layer and its ivi_surfaces will not be rendered.
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*layer_set_visibility)(struct ivi_layout_layer *ivilayer,
- bool newVisibility);
+ void (*layer_set_visibility)(struct ivi_layout_layer *ivilayer,
+ bool newVisibility);
/**
* \brief Set the opacity of a ivi_layer.
*
* \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
+ * \return IVI_FAILED if the specified opacity is out of bounds
*/
int32_t (*layer_set_opacity)(struct ivi_layout_layer *ivilayer,
wl_fixed_t opacity);
@@ -471,34 +440,25 @@ struct ivi_layout_interface {
* \brief Set the area of a ivi_layer which should be used for the rendering.
*
* Only this part will be visible.
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*layer_set_source_rectangle)(struct ivi_layout_layer *ivilayer,
- int32_t x, int32_t y,
- int32_t width, int32_t height);
+ void (*layer_set_source_rectangle)(struct ivi_layout_layer *ivilayer,
+ int32_t x, int32_t y,
+ int32_t width, int32_t height);
/**
* \brief Set the destination area on the display for a ivi_layer.
*
* The ivi_layer will be scaled and positioned to this rectangle
* for rendering
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*layer_set_destination_rectangle)(struct ivi_layout_layer *ivilayer,
- int32_t x, int32_t y,
- int32_t width, int32_t height);
+ void (*layer_set_destination_rectangle)(struct ivi_layout_layer *ivilayer,
+ int32_t x, int32_t y,
+ int32_t width, int32_t height);
/**
* \brief Add a ivi_surface to a ivi_layer which is currently managed by the service
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*layer_add_surface)(struct ivi_layout_layer *ivilayer,
+ void (*layer_add_surface)(struct ivi_layout_layer *ivilayer,
struct ivi_layout_surface *addsurf);
/**
@@ -509,13 +469,10 @@ struct ivi_layout_interface {
/**
* \brief Sets render order of ivi_surfaces within a ivi_layer
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*layer_set_render_order)(struct ivi_layout_layer *ivilayer,
- struct ivi_layout_surface **pSurface,
- int32_t number);
+ void (*layer_set_render_order)(struct ivi_layout_layer *ivilayer,
+ struct ivi_layout_surface **pSurface,
+ int32_t number);
/**
* \brief add a listener to listen property changes of ivi_layer
@@ -524,19 +481,16 @@ struct ivi_layout_interface {
* signal is emitted to the listening controller plugins.
* The pointer of the ivi_layer is sent as the void *data argument
* to the wl_listener::notify callback function of the listener.
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*layer_add_listener)(struct ivi_layout_layer *ivilayer,
- struct wl_listener *listener);
+ void (*layer_add_listener)(struct ivi_layout_layer *ivilayer,
+ struct wl_listener *listener);
/**
* \brief set type of transition animation
*/
- int32_t (*layer_set_transition)(struct ivi_layout_layer *ivilayer,
- enum ivi_layout_transition_type type,
- uint32_t duration);
+ void (*layer_set_transition)(struct ivi_layout_layer *ivilayer,
+ enum ivi_layout_transition_type type,
+ uint32_t duration);
/**
* screen controller interface
@@ -544,31 +498,22 @@ struct ivi_layout_interface {
/**
* \brief Get the weston_outputs under the given ivi_layer
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*get_screens_under_layer)(struct ivi_layout_layer *ivilayer,
- int32_t *pLength,
- struct weston_output ***ppArray);
+ void (*get_screens_under_layer)(struct ivi_layout_layer *ivilayer,
+ int32_t *pLength,
+ struct weston_output ***ppArray);
/**
* \brief Add a ivi_layer to a weston_output which is currently managed
* by the service
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*screen_add_layer)(struct weston_output *output,
+ void (*screen_add_layer)(struct weston_output *output,
struct ivi_layout_layer *addlayer);
/**
* \brief Sets render order of ivi_layers on a weston_output
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*screen_set_render_order)(struct weston_output *output,
+ void (*screen_set_render_order)(struct weston_output *output,
struct ivi_layout_layer **pLayer,
const int32_t number);
@@ -576,16 +521,16 @@ struct ivi_layout_interface {
* transition animation for layer
*/
void (*transition_move_layer_cancel)(struct ivi_layout_layer *layer);
- int32_t (*layer_set_fade_info)(struct ivi_layout_layer* ivilayer,
- uint32_t is_fade_in,
- double start_alpha, double end_alpha);
+ void (*layer_set_fade_info)(struct ivi_layout_layer* ivilayer,
+ uint32_t is_fade_in,
+ double start_alpha, double end_alpha);
/**
* surface content dumping for debugging
*/
- int32_t (*surface_get_size)(struct ivi_layout_surface *ivisurf,
- int32_t *width, int32_t *height,
- int32_t *stride);
+ void (*surface_get_size)(struct ivi_layout_surface *ivisurf,
+ int32_t *width, int32_t *height,
+ int32_t *stride);
int32_t (*surface_dump)(struct weston_surface *surface,
void *target, size_t size,
@@ -604,12 +549,9 @@ struct ivi_layout_interface {
/**
* \brief Remove a ivi_layer to a weston_output which is currently managed
* by the service
- *
- * \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
*/
- int32_t (*screen_remove_layer)(struct weston_output *output,
- struct ivi_layout_layer *removelayer);
+ void (*screen_remove_layer)(struct weston_output *output,
+ struct ivi_layout_layer *removelayer);
/**
* \brief Add a shell destroy listener only once.
@@ -620,7 +562,7 @@ struct ivi_layout_interface {
* to the wl_listener::notify callback function of the listener.
*
* \return IVI_SUCCEEDED if the method call was successful
- * \return IVI_FAILED if the method call was failed
+ * \return IVI_FAILED if the method was called before
*/
int32_t (*shell_add_destroy_listener_once)(struct wl_listener *listener,
wl_notify_func_t destroy_handler);
diff --git a/ivi-shell/ivi-layout-private.h b/ivi-shell/ivi-layout-private.h
index e74ff3e2..21261e54 100644
--- a/ivi-shell/ivi-layout-private.h
+++ b/ivi-shell/ivi-layout-private.h
@@ -191,14 +191,14 @@ int32_t
ivi_layout_commit_changes(void);
uint32_t
ivi_layout_get_id_of_surface(struct ivi_layout_surface *ivisurf);
-int32_t
+void
ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,
int32_t x, int32_t y,
int32_t width, int32_t height);
int32_t
ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
wl_fixed_t opacity);
-int32_t
+void
ivi_layout_surface_set_visibility(struct ivi_layout_surface *ivisurf,
bool newVisibility);
void
@@ -209,14 +209,14 @@ ivi_layout_get_surface_from_id(uint32_t id_surface);
int32_t
ivi_layout_layer_set_opacity(struct ivi_layout_layer *ivilayer,
wl_fixed_t opacity);
-int32_t
+void
ivi_layout_layer_set_visibility(struct ivi_layout_layer *ivilayer,
bool newVisibility);
-int32_t
+void
ivi_layout_layer_set_destination_rectangle(struct ivi_layout_layer *ivilayer,
int32_t x, int32_t y,
int32_t width, int32_t height);
-int32_t
+void
ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
struct ivi_layout_surface **pSurface,
int32_t number);
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 19dbe339..af204a1d 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -938,104 +938,73 @@ clear_view_pending_list(struct ivi_layout_layer *ivilayer)
* Exported APIs of ivi-layout library are implemented from here.
* Brief of APIs is described in ivi-layout-export.h.
*/
-static int32_t
+static void
ivi_layout_add_listener_create_layer(struct wl_listener *listener)
{
struct ivi_layout *layout = get_instance();
- if (listener == NULL) {
- weston_log("ivi_layout_add_listener_create_layer: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(listener);
wl_signal_add(&layout->layer_notification.created, listener);
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_add_listener_remove_layer(struct wl_listener *listener)
{
struct ivi_layout *layout = get_instance();
- if (listener == NULL) {
- weston_log("ivi_layout_add_listener_remove_layer: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(listener);
wl_signal_add(&layout->layer_notification.removed, listener);
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_add_listener_create_surface(struct wl_listener *listener)
{
struct ivi_layout *layout = get_instance();
- if (listener == NULL) {
- weston_log("ivi_layout_add_listener_create_surface: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(listener);
wl_signal_add(&layout->surface_notification.created, listener);
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_add_listener_remove_surface(struct wl_listener *listener)
{
struct ivi_layout *layout = get_instance();
- if (listener == NULL) {
- weston_log("ivi_layout_add_listener_remove_surface: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(listener);
wl_signal_add(&layout->surface_notification.removed, listener);
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_add_listener_configure_surface(struct wl_listener *listener)
{
struct ivi_layout *layout = get_instance();
- if (listener == NULL) {
- weston_log("ivi_layout_add_listener_configure_surface: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(listener);
wl_signal_add(&layout->surface_notification.configure_changed, listener);
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_add_listener_configure_desktop_surface(struct wl_listener *listener)
{
struct ivi_layout *layout = get_instance();
- if (!listener) {
- weston_log("ivi_layout_add_listener_configure_desktop_surface: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(listener);
wl_signal_add(&layout->surface_notification.configure_desktop_changed, listener);
-
- return IVI_SUCCEEDED;
}
static int32_t
ivi_layout_shell_add_destroy_listener_once(struct wl_listener *listener, wl_notify_func_t destroy_handler)
{
struct ivi_layout *layout = get_instance();
- if (!listener || !destroy_handler) {
- weston_log("ivi_layout_shell_add_destroy_listener_once: invalid argument\n");
- return IVI_FAILED;
- }
+
+ assert(listener);
+ assert(destroy_handler);
if (wl_signal_get(&layout->shell_notification.destroy_signal, destroy_handler))
return IVI_FAILED;
@@ -1087,32 +1056,25 @@ ivi_layout_get_surface_from_id(uint32_t id_surface)
return NULL;
}
-static int32_t
+static void
ivi_layout_surface_add_listener(struct ivi_layout_surface *ivisurf,
struct wl_listener *listener)
{
- if (ivisurf == NULL || listener == NULL) {
- weston_log("ivi_layout_surface_add_listener: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivisurf);
+ assert(listener);
wl_signal_add(&ivisurf->property_changed, listener);
-
- return IVI_SUCCEEDED;
}
static const struct ivi_layout_layer_properties *
ivi_layout_get_properties_of_layer(struct ivi_layout_layer *ivilayer)
{
- if (ivilayer == NULL) {
- weston_log("ivi_layout_get_properties_of_layer: invalid argument\n");
- return NULL;
- }
+ assert(ivilayer);
return &ivilayer->prop;
}
-static int32_t
+static void
ivi_layout_get_screens_under_layer(struct ivi_layout_layer *ivilayer,
int32_t *pLength,
struct weston_output ***ppArray)
@@ -1120,10 +1082,9 @@ ivi_layout_get_screens_under_layer(struct ivi_layout_layer *ivilayer,
int32_t length = 0;
int32_t n = 0;
- if (ivilayer == NULL || pLength == NULL || ppArray == NULL) {
- weston_log("ivi_layout_get_screens_under_layer: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivilayer);
+ assert(pLength);
+ assert(ppArray);
if (ivilayer->on_screen != NULL)
length = 1;
@@ -1136,11 +1097,9 @@ ivi_layout_get_screens_under_layer(struct ivi_layout_layer *ivilayer,
}
*pLength = length;
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_get_layers(int32_t *pLength, struct ivi_layout_layer ***ppArray)
{
struct ivi_layout *layout = get_instance();
@@ -1148,10 +1107,8 @@ ivi_layout_get_layers(int32_t *pLength, struct ivi_layout_layer ***ppArray)
int32_t length = 0;
int32_t n = 0;
- if (pLength == NULL || ppArray == NULL) {
- weston_log("ivi_layout_get_layers: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(pLength);
+ assert(ppArray);
length = wl_list_length(&layout->layer_list);
@@ -1165,11 +1122,9 @@ ivi_layout_get_layers(int32_t *pLength, struct ivi_layout_layer ***ppArray)
}
*pLength = length;
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_get_layers_on_screen(struct weston_output *output,
int32_t *pLength,
struct ivi_layout_layer ***ppArray)
@@ -1179,10 +1134,9 @@ ivi_layout_get_layers_on_screen(struct weston_output *output,
int32_t length = 0;
int32_t n = 0;
- if (output == NULL || pLength == NULL || ppArray == NULL) {
- weston_log("ivi_layout_get_layers_on_screen: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(output);
+ assert(pLength);
+ assert(ppArray);
iviscrn = get_screen_from_output(output);
length = wl_list_length(&iviscrn->order.layer_list);
@@ -1197,11 +1151,9 @@ ivi_layout_get_layers_on_screen(struct weston_output *output,
}
*pLength = length;
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_get_layers_under_surface(struct ivi_layout_surface *ivisurf,
int32_t *pLength,
struct ivi_layout_layer ***ppArray)
@@ -1210,10 +1162,9 @@ ivi_layout_get_layers_under_surface(struct ivi_layout_surface *ivisurf,
int32_t length = 0;
int32_t n = 0;
- if (ivisurf == NULL || pLength == NULL || ppArray == NULL) {
- weston_log("ivi_layout_getLayers: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivisurf);
+ assert(pLength);
+ assert(ppArray);
if (!wl_list_empty(&ivisurf->view_list)) {
/* the Array must be free by module which called this function */
@@ -1233,12 +1184,9 @@ ivi_layout_get_layers_under_surface(struct ivi_layout_surface *ivisurf,
}
*pLength = length;
-
- return IVI_SUCCEEDED;
}
-static
-int32_t
+static void
ivi_layout_get_surfaces(int32_t *pLength, struct ivi_layout_surface ***ppArray)
{
struct ivi_layout *layout = get_instance();
@@ -1246,10 +1194,8 @@ ivi_layout_get_surfaces(int32_t *pLength, struct ivi_layout_surface ***ppArray)
int32_t length = 0;
int32_t n = 0;
- if (pLength == NULL || ppArray == NULL) {
- weston_log("ivi_layout_get_surfaces: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(pLength);
+ assert(ppArray);
length = wl_list_length(&layout->surface_list);
@@ -1263,11 +1209,9 @@ ivi_layout_get_surfaces(int32_t *pLength, struct ivi_layout_surface ***ppArray)
}
*pLength = length;
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_get_surfaces_on_layer(struct ivi_layout_layer *ivilayer,
int32_t *pLength,
struct ivi_layout_surface ***ppArray)
@@ -1276,10 +1220,9 @@ ivi_layout_get_surfaces_on_layer(struct ivi_layout_layer *ivilayer,
int32_t length = 0;
int32_t n = 0;
- if (ivilayer == NULL || pLength == NULL || ppArray == NULL) {
- weston_log("ivi_layout_getSurfaceIDsOnLayer: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivilayer);
+ assert(pLength);
+ assert(ppArray);
length = wl_list_length(&ivilayer->order.view_list);
@@ -1293,8 +1236,6 @@ ivi_layout_get_surfaces_on_layer(struct ivi_layout_layer *ivilayer,
}
*pLength = length;
-
- return IVI_SUCCEEDED;
}
static struct ivi_layout_layer *
@@ -1340,10 +1281,7 @@ ivi_layout_layer_destroy(struct ivi_layout_layer *ivilayer)
struct ivi_layout *layout = get_instance();
struct ivi_layout_view *ivi_view, *next;
- if (ivilayer == NULL) {
- weston_log("ivi_layout_layer_destroy: invalid argument\n");
- return;
- }
+ assert(ivilayer);
if (--ivilayer->ref_count > 0)
return;
@@ -1363,16 +1301,13 @@ ivi_layout_layer_destroy(struct ivi_layout_layer *ivilayer)
free(ivilayer);
}
-int32_t
+void
ivi_layout_layer_set_visibility(struct ivi_layout_layer *ivilayer,
bool newVisibility)
{
struct ivi_layout_layer_properties *prop = NULL;
- if (ivilayer == NULL) {
- weston_log("ivi_layout_layer_set_visibility: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivilayer);
prop = &ivilayer->pending.prop;
prop->visibility = newVisibility;
@@ -1381,8 +1316,6 @@ ivi_layout_layer_set_visibility(struct ivi_layout_layer *ivilayer,
prop->event_mask |= IVI_NOTIFICATION_VISIBILITY;
else
prop->event_mask &= ~IVI_NOTIFICATION_VISIBILITY;
-
- return IVI_SUCCEEDED;
}
int32_t
@@ -1391,8 +1324,9 @@ ivi_layout_layer_set_opacity(struct ivi_layout_layer *ivilayer,
{
struct ivi_layout_layer_properties *prop = NULL;
- if (ivilayer == NULL ||
- opacity < wl_fixed_from_double(0.0) ||
+ assert(ivilayer);
+
+ if (opacity < wl_fixed_from_double(0.0) ||
wl_fixed_from_double(1.0) < opacity) {
weston_log("ivi_layout_layer_set_opacity: invalid argument\n");
return IVI_FAILED;
@@ -1409,17 +1343,14 @@ ivi_layout_layer_set_opacity(struct ivi_layout_layer *ivilayer,
return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_layer_set_source_rectangle(struct ivi_layout_layer *ivilayer,
int32_t x, int32_t y,
int32_t width, int32_t height)
{
struct ivi_layout_layer_properties *prop = NULL;
- if (ivilayer == NULL) {
- weston_log("ivi_layout_layer_set_source_rectangle: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivilayer);
prop = &ivilayer->pending.prop;
prop->source_x = x;
@@ -1433,21 +1364,16 @@ ivi_layout_layer_set_source_rectangle(struct ivi_layout_layer *ivilayer,
prop->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
else
prop->event_mask &= ~IVI_NOTIFICATION_SOURCE_RECT;
-
- return IVI_SUCCEEDED;
}
-int32_t
+void
ivi_layout_layer_set_destination_rectangle(struct ivi_layout_layer *ivilayer,
int32_t x, int32_t y,
int32_t width, int32_t height)
{
struct ivi_layout_layer_properties *prop = NULL;
- if (ivilayer == NULL) {
- weston_log("ivi_layout_layer_set_destination_rectangle: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivilayer);
prop = &ivilayer->pending.prop;
prop->dest_x = x;
@@ -1461,11 +1387,9 @@ ivi_layout_layer_set_destination_rectangle(struct ivi_layout_layer *ivilayer,
prop->event_mask |= IVI_NOTIFICATION_DEST_RECT;
else
prop->event_mask &= ~IVI_NOTIFICATION_DEST_RECT;
-
- return IVI_SUCCEEDED;
}
-int32_t
+void
ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
struct ivi_layout_surface **pSurface,
int32_t number)
@@ -1473,10 +1397,7 @@ ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
int32_t i = 0;
struct ivi_layout_view * ivi_view;
- if (ivilayer == NULL) {
- weston_log("ivi_layout_layer_set_render_order: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivilayer);
clear_view_pending_list(ivilayer);
@@ -1492,20 +1413,15 @@ ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
}
ivilayer->order.dirty = 1;
-
- return IVI_SUCCEEDED;
}
-int32_t
+void
ivi_layout_surface_set_visibility(struct ivi_layout_surface *ivisurf,
bool newVisibility)
{
struct ivi_layout_surface_properties *prop = NULL;
- if (ivisurf == NULL) {
- weston_log("ivi_layout_surface_set_visibility: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivisurf);
prop = &ivisurf->pending.prop;
prop->visibility = newVisibility;
@@ -1514,8 +1430,6 @@ ivi_layout_surface_set_visibility(struct ivi_layout_surface *ivisurf,
prop->event_mask |= IVI_NOTIFICATION_VISIBILITY;
else
prop->event_mask &= ~IVI_NOTIFICATION_VISIBILITY;
-
- return IVI_SUCCEEDED;
}
int32_t
@@ -1524,8 +1438,9 @@ ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
{
struct ivi_layout_surface_properties *prop = NULL;
- if (ivisurf == NULL ||
- opacity < wl_fixed_from_double(0.0) ||
+ assert(ivisurf);
+
+ if (opacity < wl_fixed_from_double(0.0) ||
wl_fixed_from_double(1.0) < opacity) {
weston_log("ivi_layout_surface_set_opacity: invalid argument\n");
return IVI_FAILED;
@@ -1542,17 +1457,14 @@ ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
return IVI_SUCCEEDED;
}
-int32_t
+void
ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,
int32_t x, int32_t y,
int32_t width, int32_t height)
{
struct ivi_layout_surface_properties *prop = NULL;
- if (ivisurf == NULL) {
- weston_log("ivi_layout_surface_set_destination_rectangle: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivisurf);
prop = &ivisurf->pending.prop;
prop->start_x = prop->dest_x;
@@ -1570,8 +1482,6 @@ ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,
prop->event_mask |= IVI_NOTIFICATION_DEST_RECT;
else
prop->event_mask &= ~IVI_NOTIFICATION_DEST_RECT;
-
- return IVI_SUCCEEDED;
}
void
@@ -1594,16 +1504,14 @@ ivi_layout_surface_set_size(struct ivi_layout_surface *ivisurf,
assert(0);
}
-static int32_t
+static void
ivi_layout_screen_add_layer(struct weston_output *output,
struct ivi_layout_layer *addlayer)
{
struct ivi_layout_screen *iviscrn;
- if (output == NULL || addlayer == NULL) {
- weston_log("ivi_layout_screen_add_layer: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(output);
+ assert(addlayer);
iviscrn = get_screen_from_output(output);
@@ -1616,20 +1524,16 @@ ivi_layout_screen_add_layer(struct weston_output *output,
wl_list_insert(&iviscrn->pending.layer_list, &addlayer->pending.link);
iviscrn->order.dirty = 1;
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_screen_remove_layer(struct weston_output *output,
struct ivi_layout_layer *removelayer)
{
struct ivi_layout_screen *iviscrn;
- if (output == NULL || removelayer == NULL) {
- weston_log("ivi_layout_screen_remove_layer: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(output);
+ assert(removelayer);
iviscrn = get_screen_from_output(output);
@@ -1637,11 +1541,9 @@ ivi_layout_screen_remove_layer(struct weston_output *output,
wl_list_init(&removelayer->pending.link);
iviscrn->order.dirty = 1;
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_screen_set_render_order(struct weston_output *output,
struct ivi_layout_layer **pLayer,
const int32_t number)
@@ -1651,10 +1553,7 @@ ivi_layout_screen_set_render_order(struct weston_output *output,
struct ivi_layout_layer *next = NULL;
int32_t i = 0;
- if (output == NULL) {
- weston_log("ivi_layout_screen_set_render_order: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(output);
iviscrn = get_screen_from_output(output);
@@ -1673,8 +1572,6 @@ ivi_layout_screen_set_render_order(struct weston_output *output,
}
iviscrn->order.dirty = 1;
-
- return IVI_SUCCEEDED;
}
/**
@@ -1688,7 +1585,7 @@ ivi_layout_surface_get_weston_surface(struct ivi_layout_surface *ivisurf)
return ivisurf != NULL ? ivisurf->surface : NULL;
}
-static int32_t
+static void
ivi_layout_surface_get_size(struct ivi_layout_surface *ivisurf,
int32_t *width, int32_t *height,
int32_t *stride)
@@ -1697,10 +1594,7 @@ ivi_layout_surface_get_size(struct ivi_layout_surface *ivisurf,
int32_t h;
const size_t bytespp = 4; /* PIXMAN_a8b8g8r8 */
- if (ivisurf == NULL || ivisurf->surface == NULL) {
- weston_log("%s: invalid argument\n", __func__);
- return IVI_FAILED;
- }
+ assert(ivisurf);
weston_surface_get_content_size(ivisurf->surface, &w, &h);
@@ -1712,45 +1606,34 @@ ivi_layout_surface_get_size(struct ivi_layout_surface *ivisurf,
if (stride != NULL)
*stride = w * bytespp;
-
- return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_layer_add_listener(struct ivi_layout_layer *ivilayer,
struct wl_listener *listener)
{
- if (ivilayer == NULL || listener == NULL) {
- weston_log("ivi_layout_layer_add_listener: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivilayer);
+ assert(listener);
wl_signal_add(&ivilayer->property_changed, listener);
-
- return IVI_SUCCEEDED;
}
static const struct ivi_layout_surface_properties *
ivi_layout_get_properties_of_surface(struct ivi_layout_surface *ivisurf)
{
- if (ivisurf == NULL) {
- weston_log("ivi_layout_get_properties_of_surface: invalid argument\n");
- return NULL;
- }
+ assert(ivisurf);
return &ivisurf->prop;
}
-static int32_t
+static void
ivi_layout_layer_add_surface(struct ivi_layout_layer *ivilayer,
struct ivi_layout_surface *addsurf)
{
struct ivi_layout_view *ivi_view;
- if (ivilayer == NULL || addsurf == NULL) {
- weston_log("ivi_layout_layer_add_surface: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivilayer);
+ assert(addsurf);
ivi_view = get_ivi_view(ivilayer, addsurf);
if (!ivi_view)
@@ -1760,8 +1643,6 @@ ivi_layout_layer_add_surface(struct ivi_layout_layer *ivilayer,
wl_list_insert(&ivilayer->pending.view_list, &ivi_view->pending_link);
ivilayer->order.dirty = 1;
-
- return IVI_SUCCEEDED;
}
static void
@@ -1784,17 +1665,14 @@ ivi_layout_layer_remove_surface(struct ivi_layout_layer *ivilayer,
}
}
-static int32_t
+static void
ivi_layout_surface_set_source_rectangle(struct ivi_layout_surface *ivisurf,
int32_t x, int32_t y,
int32_t width, int32_t height)
{
struct ivi_layout_surface_properties *prop = NULL;
- if (ivisurf == NULL) {
- weston_log("ivi_layout_surface_set_source_rectangle: invalid argument\n");
- return IVI_FAILED;
- }
+ assert(ivisurf);
prop = &ivisurf->pending.prop;
prop->source_x = x;
@@ -1808,8 +1686,6 @@ ivi_layout_surface_set_source_rectangle(struct ivi_layout_surface *ivisurf,
prop->event_mask |= IVI_NOTIFICATION_SOURCE_RECT;
else
prop->event_mask &= ~IVI_NOTIFICATION_SOURCE_RECT;
-
- return IVI_SUCCEEDED;
}
int32_t
@@ -1840,53 +1716,39 @@ ivi_layout_commit_current(void)
return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_layer_set_transition(struct ivi_layout_layer *ivilayer,
enum ivi_layout_transition_type type,
uint32_t duration)
{
- if (ivilayer == NULL) {
- weston_log("%s: invalid argument\n", __func__);
- return -1;
- }
+ assert(ivilayer);
ivilayer->pending.prop.transition_type = type;
ivilayer->pending.prop.transition_duration = duration;
-
- return 0;
}
-static int32_t
+static void
ivi_layout_layer_set_fade_info(struct ivi_layout_layer* ivilayer,
uint32_t is_fade_in,
double start_alpha, double end_alpha)
{
- if (ivilayer == NULL) {
- weston_log("%s: invalid argument\n", __func__);
- return -1;
- }
+ assert(ivilayer);
ivilayer->pending.prop.is_fade_in = is_fade_in;
ivilayer->pending.prop.start_alpha = start_alpha;
ivilayer->pending.prop.end_alpha = end_alpha;
-
- return 0;
}
-static int32_t
+static void
ivi_layout_surface_set_transition_duration(struct ivi_layout_surface *ivisurf,
uint32_t duration)
{
struct ivi_layout_surface_properties *prop;
- if (ivisurf == NULL) {
- weston_log("%s: invalid argument\n", __func__);
- return -1;
- }
+ assert(ivisurf);
prop = &ivisurf->pending.prop;
prop->transition_duration = duration*10;
- return 0;
}
/*
@@ -1902,10 +1764,7 @@ ivi_layout_surface_set_id(struct ivi_layout_surface *ivisurf,
struct ivi_layout *layout = get_instance();
struct ivi_layout_surface *search_ivisurf = NULL;
- if (!ivisurf) {
- weston_log("%s: invalid argument\n", __func__);
- return IVI_FAILED;
- }
+ assert(ivisurf);
if (ivisurf->id_surface != IVI_INVALID_ID) {
weston_log("surface id can only be set once\n");
@@ -1926,22 +1785,18 @@ ivi_layout_surface_set_id(struct ivi_layout_surface *ivisurf,
return IVI_SUCCEEDED;
}
-static int32_t
+static void
ivi_layout_surface_set_transition(struct ivi_layout_surface *ivisurf,
enum ivi_layout_transition_type type,
uint32_t duration)
{
struct ivi_layout_surface_properties *prop;
- if (ivisurf == NULL) {
- weston_log("%s: invalid argument\n", __func__);
- return -1;
- }
+ assert(ivisurf);
prop = &ivisurf->pending.prop;
prop->transition_type = type;
prop->transition_duration = duration;
- return 0;
}
static int32_t
@@ -1951,10 +1806,7 @@ ivi_layout_surface_dump(struct weston_surface *surface,
{
int result = 0;
- if (surface == NULL) {
- weston_log("%s: invalid argument\n", __func__);
- return IVI_FAILED;
- }
+ assert(surface);
result = weston_surface_copy_content(
surface, target, size,