parent
ca4fa3936a
commit
4bbfbb6b33
|
@ -21,6 +21,14 @@
|
||||||
|
|
||||||
#include "eina_types.h"
|
#include "eina_types.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup Eina_Rectangle_Group Rectangle
|
||||||
|
*
|
||||||
|
* @brief These functions provide rectangle management.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup Eina_Tools_Group Tools
|
* @addtogroup Eina_Tools_Group Tools
|
||||||
*
|
*
|
||||||
|
@ -63,14 +71,115 @@ static inline Eina_Bool eina_rectangle_intersection(Eina_Rectangle *dst, const
|
||||||
static inline void eina_rectangle_rescale_in(const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) EINA_ARG_NONNULL(1, 2, 3);
|
static inline void eina_rectangle_rescale_in(const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) EINA_ARG_NONNULL(1, 2, 3);
|
||||||
static inline void eina_rectangle_rescale_out(const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) EINA_ARG_NONNULL(1, 2, 3);
|
static inline void eina_rectangle_rescale_out(const Eina_Rectangle *out, const Eina_Rectangle *in, Eina_Rectangle *res) EINA_ARG_NONNULL(1, 2, 3);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a rectangle in a new pool.
|
||||||
|
*
|
||||||
|
* @param w The width of the rectangle.
|
||||||
|
* @param h The height of the rectangle.
|
||||||
|
* @return A newly allocated pool on success, @c NULL otherwise.
|
||||||
|
*
|
||||||
|
* This function adds the rectangle of size (@p width, @p height) to a
|
||||||
|
* new pool. If the pool can not be created, @c NULL is
|
||||||
|
* returned. Otherwise the newly allocated pool is returned.
|
||||||
|
*/
|
||||||
EAPI Eina_Rectangle_Pool *eina_rectangle_pool_new(int w, int h) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
|
EAPI Eina_Rectangle_Pool *eina_rectangle_pool_new(int w, int h) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return the pool of the given rectangle.
|
||||||
|
*
|
||||||
|
* @param rect The rectangle.
|
||||||
|
* @return The pool of the given rectangle.
|
||||||
|
*
|
||||||
|
* This function returns the pool in which @p rect is. If @p rect is
|
||||||
|
* @c NULL, @c NULL is returned.
|
||||||
|
*/
|
||||||
EAPI Eina_Rectangle_Pool *eina_rectangle_pool_get(Eina_Rectangle *rect) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
|
EAPI Eina_Rectangle_Pool *eina_rectangle_pool_get(Eina_Rectangle *rect) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return the width and height of the given pool.
|
||||||
|
*
|
||||||
|
* @param pool The pool.
|
||||||
|
* @param w The returned width.
|
||||||
|
* @param h The returned height.
|
||||||
|
* @return #EINA_TRUE on success, #EINA_FALSE otherwise.
|
||||||
|
*
|
||||||
|
* This function returns the width and height of @p pool and store
|
||||||
|
* them in respectively @p w and @p h if they are not @c NULL. If
|
||||||
|
* @p pool is @c NULL, #EINA_FALSE is returned. Otherwise #EINA_TRUE is
|
||||||
|
* returned.
|
||||||
|
*/
|
||||||
EAPI Eina_Bool eina_rectangle_pool_geometry_get(Eina_Rectangle_Pool *pool, int *w, int *h) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
|
EAPI Eina_Bool eina_rectangle_pool_geometry_get(Eina_Rectangle_Pool *pool, int *w, int *h) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the data from the given pool.
|
||||||
|
*
|
||||||
|
* @param pool The pool.
|
||||||
|
* @return The returned data.
|
||||||
|
*
|
||||||
|
* This function gets the data from @p pool set by
|
||||||
|
* eina_rectangle_pool_data_set(). If @p pool is @c NULL, this
|
||||||
|
* function returns @c NULL.
|
||||||
|
*/
|
||||||
EAPI void *eina_rectangle_pool_data_get(Eina_Rectangle_Pool *pool) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
|
EAPI void *eina_rectangle_pool_data_get(Eina_Rectangle_Pool *pool) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the data to the given pool.
|
||||||
|
*
|
||||||
|
* @param pool The pool.
|
||||||
|
* @param data The data to set.
|
||||||
|
*
|
||||||
|
* This function sets @p data to @p pool. If @p pool is @c NULL, this
|
||||||
|
* function does nothing.
|
||||||
|
*/
|
||||||
EAPI void eina_rectangle_pool_data_set(Eina_Rectangle_Pool *pool, const void *data) EINA_ARG_NONNULL(1);
|
EAPI void eina_rectangle_pool_data_set(Eina_Rectangle_Pool *pool, const void *data) EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Free the given pool.
|
||||||
|
*
|
||||||
|
* @param pool The pool to free.
|
||||||
|
*
|
||||||
|
* This function frees the allocated data of @p pool. If @p pool is
|
||||||
|
* @c NULL, ths function returned immediately.
|
||||||
|
*/
|
||||||
EAPI void eina_rectangle_pool_free(Eina_Rectangle_Pool *pool) EINA_ARG_NONNULL(1);
|
EAPI void eina_rectangle_pool_free(Eina_Rectangle_Pool *pool) EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return the number of rectangles in the given pool.
|
||||||
|
*
|
||||||
|
* @param pool The pool.
|
||||||
|
* @return The number of rectangles in the pool.
|
||||||
|
*
|
||||||
|
* This function returns the number of rectangles in @p pool.
|
||||||
|
*/
|
||||||
EAPI int eina_rectangle_pool_count(Eina_Rectangle_Pool *pool) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
|
EAPI int eina_rectangle_pool_count(Eina_Rectangle_Pool *pool) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Request a rectangle of given size in the given pool.
|
||||||
|
*
|
||||||
|
* @param pool The pool.
|
||||||
|
* @param w The width of the rectangle to request.
|
||||||
|
* @param h The height of the rectangle to request.
|
||||||
|
* @return The requested rectangle on success, @c NULL otherwise.
|
||||||
|
*
|
||||||
|
* This function retrieve from @p pool the rectangle of width @p w and
|
||||||
|
* height @p h. If @p pool is @c NULL, or @p w or @p h are non-positive,
|
||||||
|
* the function returns @c NULL. If @p w or @p h are greater than the
|
||||||
|
* pool size, the function returns @c NULL. On success, the function
|
||||||
|
* returns the rectangle which matches the size (@p w, @p h).
|
||||||
|
* Otherwise it returns @c NULL.
|
||||||
|
*/
|
||||||
EAPI Eina_Rectangle *eina_rectangle_pool_request(Eina_Rectangle_Pool *pool, int w, int h) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
|
EAPI Eina_Rectangle *eina_rectangle_pool_request(Eina_Rectangle_Pool *pool, int w, int h) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove the given rectangle from the pool.
|
||||||
|
*
|
||||||
|
* @param rect The rectangle to remove from the pool.
|
||||||
|
*
|
||||||
|
* This function removes @p rect from the pool. If @p rect is
|
||||||
|
* @c NULL, the function returns immediately. Otherwise it remoes @p
|
||||||
|
* rect from the pool.
|
||||||
|
*/
|
||||||
EAPI void eina_rectangle_pool_release(Eina_Rectangle *rect) EINA_ARG_NONNULL(1);
|
EAPI void eina_rectangle_pool_release(Eina_Rectangle *rect) EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,7 +202,30 @@ EAPI void eina_rectangle_pool_release(Eina_Rectangle *rect) EINA
|
||||||
(Rectangle)->w = W; \
|
(Rectangle)->w = W; \
|
||||||
(Rectangle)->h = H;
|
(Rectangle)->h = H;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create a new rectangle.
|
||||||
|
*
|
||||||
|
* @param x The X coordinate of the top left corner of the rectangle.
|
||||||
|
* @param y The Y coordinate of the top left corner of the rectangle.
|
||||||
|
* @param w The width of the rectangle.
|
||||||
|
* @param h The height of the rectangle.
|
||||||
|
* @return The new rectangle on success, @ NULL otherwise.
|
||||||
|
*
|
||||||
|
* This function creates a rectangle which top left corner has the
|
||||||
|
* coordinates (@p x, @p y), with height @p w and height @p h and adds
|
||||||
|
* it to the rectangles pool. No check is done on @p w and @p h. This
|
||||||
|
* function returns a new rectangle on success, @c NULL otherwhise.
|
||||||
|
*/
|
||||||
EAPI Eina_Rectangle *eina_rectangle_new(int x, int y, int w, int h) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
|
EAPI Eina_Rectangle *eina_rectangle_new(int x, int y, int w, int h) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Free the given rectangle.
|
||||||
|
*
|
||||||
|
* @param rect The rectangle to free.
|
||||||
|
*
|
||||||
|
* This function removes @p rect from the rectangles pool.
|
||||||
|
*/
|
||||||
EAPI void eina_rectangle_free(Eina_Rectangle *rect) EINA_ARG_NONNULL(1);
|
EAPI void eina_rectangle_free(Eina_Rectangle *rect) EINA_ARG_NONNULL(1);
|
||||||
|
|
||||||
#include "eina_inline_rectangle.x"
|
#include "eina_inline_rectangle.x"
|
||||||
|
@ -106,4 +238,8 @@ EAPI void eina_rectangle_free(Eina_Rectangle *rect) EINA_ARG_NONNULL(
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
#endif /*_EINA_RECTANGLE_H_*/
|
#endif /*_EINA_RECTANGLE_H_*/
|
||||||
|
|
|
@ -321,28 +321,6 @@ eina_rectangle_shutdown(void)
|
||||||
* API *
|
* API *
|
||||||
*============================================================================*/
|
*============================================================================*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup Eina_Rectangle_Group Rectangle
|
|
||||||
*
|
|
||||||
* @brief These functions provide rectangle management.
|
|
||||||
*
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Create a new rectangle.
|
|
||||||
*
|
|
||||||
* @param x The X coordinate of the top left corner of the rectangle.
|
|
||||||
* @param y The Y coordinate of the top left corner of the rectangle.
|
|
||||||
* @param w The width of the rectangle.
|
|
||||||
* @param h The height of the rectangle.
|
|
||||||
* @return The new rectangle on success, @ NULL otherwise.
|
|
||||||
*
|
|
||||||
* This function creates a rectangle which top left corner has the
|
|
||||||
* coordinates (@p x, @p y), with height @p w and height @p h and adds
|
|
||||||
* it to the rectangles pool. No check is done on @p w and @p h. This
|
|
||||||
* function returns a new rectangle on success, @c NULL otherwhise.
|
|
||||||
*/
|
|
||||||
EAPI Eina_Rectangle *
|
EAPI Eina_Rectangle *
|
||||||
eina_rectangle_new(int x, int y, int w, int h)
|
eina_rectangle_new(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -364,13 +342,6 @@ eina_rectangle_new(int x, int y, int w, int h)
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Free the given rectangle.
|
|
||||||
*
|
|
||||||
* @param rect The rectangle to free.
|
|
||||||
*
|
|
||||||
* This function removes @p rect from the rectangles pool.
|
|
||||||
*/
|
|
||||||
EAPI void
|
EAPI void
|
||||||
eina_rectangle_free(Eina_Rectangle *rect)
|
eina_rectangle_free(Eina_Rectangle *rect)
|
||||||
{
|
{
|
||||||
|
@ -385,17 +356,6 @@ eina_rectangle_free(Eina_Rectangle *rect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Add a rectangle in a new pool.
|
|
||||||
*
|
|
||||||
* @param w The width of the rectangle.
|
|
||||||
* @param h The height of the rectangle.
|
|
||||||
* @return A newly allocated pool on success, @c NULL otherwise.
|
|
||||||
*
|
|
||||||
* This function adds the rectangle of size (@p width, @p height) to a
|
|
||||||
* new pool. If the pool can not be created, @c NULL is
|
|
||||||
* returned. Otherwise the newly allocated pool is returned.
|
|
||||||
*/
|
|
||||||
EAPI Eina_Rectangle_Pool *
|
EAPI Eina_Rectangle_Pool *
|
||||||
eina_rectangle_pool_new(int w, int h)
|
eina_rectangle_pool_new(int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -420,14 +380,6 @@ eina_rectangle_pool_new(int w, int h)
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Free the given pool.
|
|
||||||
*
|
|
||||||
* @param pool The pool to free.
|
|
||||||
*
|
|
||||||
* This function frees the allocated data of @p pool. If @p pool is
|
|
||||||
* @c NULL, ths function returned immediately.
|
|
||||||
*/
|
|
||||||
EAPI void
|
EAPI void
|
||||||
eina_rectangle_pool_free(Eina_Rectangle_Pool *pool)
|
eina_rectangle_pool_free(Eina_Rectangle_Pool *pool)
|
||||||
{
|
{
|
||||||
|
@ -455,14 +407,6 @@ eina_rectangle_pool_free(Eina_Rectangle_Pool *pool)
|
||||||
MAGIC_FREE(pool);
|
MAGIC_FREE(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the number of rectangles in the given pool.
|
|
||||||
*
|
|
||||||
* @param pool The pool.
|
|
||||||
* @return The number of rectangles in the pool.
|
|
||||||
*
|
|
||||||
* This function returns the number of rectangles in @p pool.
|
|
||||||
*/
|
|
||||||
EAPI int
|
EAPI int
|
||||||
eina_rectangle_pool_count(Eina_Rectangle_Pool *pool)
|
eina_rectangle_pool_count(Eina_Rectangle_Pool *pool)
|
||||||
{
|
{
|
||||||
|
@ -470,21 +414,6 @@ eina_rectangle_pool_count(Eina_Rectangle_Pool *pool)
|
||||||
return pool->references;
|
return pool->references;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Request a rectangle of given size in the given pool.
|
|
||||||
*
|
|
||||||
* @param pool The pool.
|
|
||||||
* @param w The width of the rectangle to request.
|
|
||||||
* @param h The height of the rectangle to request.
|
|
||||||
* @return The requested rectangle on success, @c NULL otherwise.
|
|
||||||
*
|
|
||||||
* This function retrieve from @p pool the rectangle of width @p w and
|
|
||||||
* height @p h. If @p pool is @c NULL, or @p w or @p h are non-positive,
|
|
||||||
* the function returns @c NULL. If @p w or @p h are greater than the
|
|
||||||
* pool size, the function returns @c NULL. On success, the function
|
|
||||||
* returns the rectangle which matches the size (@p w, @p h).
|
|
||||||
* Otherwise it returns @c NULL.
|
|
||||||
*/
|
|
||||||
EAPI Eina_Rectangle *
|
EAPI Eina_Rectangle *
|
||||||
eina_rectangle_pool_request(Eina_Rectangle_Pool *pool, int w, int h)
|
eina_rectangle_pool_request(Eina_Rectangle_Pool *pool, int w, int h)
|
||||||
{
|
{
|
||||||
|
@ -546,15 +475,6 @@ eina_rectangle_pool_request(Eina_Rectangle_Pool *pool, int w, int h)
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Remove the given rectangle from the pool.
|
|
||||||
*
|
|
||||||
* @param rect The rectangle to remove from the pool.
|
|
||||||
*
|
|
||||||
* This function removes @p rect from the pool. If @p rect is
|
|
||||||
* @c NULL, the function returns immediately. Otherwise it remoes @p
|
|
||||||
* rect from the pool.
|
|
||||||
*/
|
|
||||||
EAPI void
|
EAPI void
|
||||||
eina_rectangle_pool_release(Eina_Rectangle *rect)
|
eina_rectangle_pool_release(Eina_Rectangle *rect)
|
||||||
{
|
{
|
||||||
|
@ -595,15 +515,6 @@ eina_rectangle_pool_release(Eina_Rectangle *rect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the pool of the given rectangle.
|
|
||||||
*
|
|
||||||
* @param rect The rectangle.
|
|
||||||
* @return The pool of the given rectangle.
|
|
||||||
*
|
|
||||||
* This function returns the pool in which @p rect is. If @p rect is
|
|
||||||
* @c NULL, @c NULL is returned.
|
|
||||||
*/
|
|
||||||
EAPI Eina_Rectangle_Pool *
|
EAPI Eina_Rectangle_Pool *
|
||||||
eina_rectangle_pool_get(Eina_Rectangle *rect)
|
eina_rectangle_pool_get(Eina_Rectangle *rect)
|
||||||
{
|
{
|
||||||
|
@ -617,15 +528,6 @@ eina_rectangle_pool_get(Eina_Rectangle *rect)
|
||||||
return era->pool;
|
return era->pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set the data to the given pool.
|
|
||||||
*
|
|
||||||
* @param pool The pool.
|
|
||||||
* @param data The data to set.
|
|
||||||
*
|
|
||||||
* This function sets @p data to @p pool. If @p pool is @c NULL, this
|
|
||||||
* function does nothing.
|
|
||||||
*/
|
|
||||||
EAPI void
|
EAPI void
|
||||||
eina_rectangle_pool_data_set(Eina_Rectangle_Pool *pool, const void *data)
|
eina_rectangle_pool_data_set(Eina_Rectangle_Pool *pool, const void *data)
|
||||||
{
|
{
|
||||||
|
@ -638,16 +540,6 @@ eina_rectangle_pool_data_set(Eina_Rectangle_Pool *pool, const void *data)
|
||||||
pool->data = (void *)data;
|
pool->data = (void *)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the data from the given pool.
|
|
||||||
*
|
|
||||||
* @param pool The pool.
|
|
||||||
* @return The returned data.
|
|
||||||
*
|
|
||||||
* This function gets the data from @p pool set by
|
|
||||||
* eina_rectangle_pool_data_set(). If @p pool is @c NULL, this
|
|
||||||
* function returns @c NULL.
|
|
||||||
*/
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eina_rectangle_pool_data_get(Eina_Rectangle_Pool *pool)
|
eina_rectangle_pool_data_get(Eina_Rectangle_Pool *pool)
|
||||||
{
|
{
|
||||||
|
@ -657,19 +549,6 @@ eina_rectangle_pool_data_get(Eina_Rectangle_Pool *pool)
|
||||||
return pool->data;
|
return pool->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return the width and height of the given pool.
|
|
||||||
*
|
|
||||||
* @param pool The pool.
|
|
||||||
* @param w The returned width.
|
|
||||||
* @param h The returned height.
|
|
||||||
* @return #EINA_TRUE on success, #EINA_FALSE otherwise.
|
|
||||||
*
|
|
||||||
* This function returns the width and height of @p pool and store
|
|
||||||
* them in respectively @p w and @p h if they are not @c NULL. If
|
|
||||||
* @p pool is @c NULL, #EINA_FALSE is returned. Otherwise #EINA_TRUE is
|
|
||||||
* returned.
|
|
||||||
*/
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eina_rectangle_pool_geometry_get(Eina_Rectangle_Pool *pool, int *w, int *h)
|
eina_rectangle_pool_geometry_get(Eina_Rectangle_Pool *pool, int *w, int *h)
|
||||||
{
|
{
|
||||||
|
@ -687,7 +566,3 @@ eina_rectangle_pool_geometry_get(Eina_Rectangle_Pool *pool, int *w, int *h)
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
Loading…
Reference in New Issue