eina: Add convenience eina_rectangle_equal

@feature
This commit is contained in:
Jean-Philippe Andre 2017-08-30 13:55:47 +09:00
parent 6bb9f4fd16
commit 4a6b52465d
2 changed files with 21 additions and 0 deletions

View File

@ -47,6 +47,13 @@ eina_rectangle_coords_from(Eina_Rectangle *r, int x, int y, int w, int h)
r->h = h;
}
static inline Eina_Bool
eina_rectangle_equal(const Eina_Rectangle *rect1, const Eina_Rectangle *rect2)
{
return ((rect1->x == rect2->x) && (rect1->y == rect2->y) &&
(rect1->w == rect2->w) && (rect1->h == rect2->h));
}
static inline Eina_Bool
eina_rectangles_intersect(const Eina_Rectangle *r1, const Eina_Rectangle *r2)
{

View File

@ -531,6 +531,20 @@ EAPI void eina_rectangle_pool_packing_set(Eina_Rectangle_Pool *pool,E
*/
EAPI Eina_Rectangle_Outside eina_rectangle_outside_position(Eina_Rectangle *rect1, Eina_Rectangle *rect2);
/**
* @brief Compares two rectangles for equality
*
* @param rect1 First rectangle. Must not be NULL.
* @param rect2 Second rectangle. Must not be NULL.
*
* @return EINA_TRUE if the rectangles are equal (x, y, w and h are all equal).
* No safety check is made on the rectangles, so they should be valid and non
* NULL for this function to be meaningful.
*
* @since 1.21
*/
static inline Eina_Bool eina_rectangle_equal(const Eina_Rectangle *rect1, const Eina_Rectangle *rect2) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
#include "eina_inline_rectangle.x"
/**