@@ -188,51 +188,51 @@ return true; } /** - * @struct of_dimension_t OFObject.h ObjFW/OFObject.h - * - * @brief A dimension. - */ -struct OF_BOXABLE of_dimension_t { - /** The width of the dimension */ - float width; - /** The height of the dimension */ - float height; -}; -typedef struct of_dimension_t of_dimension_t; - -/** - * @brief Creates a new of_dimension_t. - * - * @param width The width of the dimension - * @param height The height of the dimension - * @return An of_dimension_t with the specified width and height - */ -static OF_INLINE of_dimension_t OF_CONST_FUNC -of_dimension(float width, float height) -{ - of_dimension_t dimension = { width, height }; - - return dimension; -} - -/** - * @brief Returns whether the two dimensions are equal. - * - * @param dimension1 The first dimension for the comparison - * @param dimension2 The second dimension for the comparison - * @return Whether the two dimensions are equal - */ -static OF_INLINE bool -of_dimension_equal(of_dimension_t dimension1, of_dimension_t dimension2) -{ - if (dimension1.width != dimension2.width) - return false; - - if (dimension1.height != dimension2.height) + * @struct OFSize OFObject.h ObjFW/OFObject.h + * + * @brief A size. + */ +struct OF_BOXABLE OFSize { + /** The width of the size */ + float width; + /** The height of the size */ + float height; +}; +typedef struct OFSize OFSize; + +/** + * @brief Creates a new OFSize. + * + * @param width The width of the size + * @param height The height of the size + * @return An OFSize with the specified width and height + */ +static OF_INLINE OFSize OF_CONST_FUNC +OFMakeSize(float width, float height) +{ + OFSize size = { width, height }; + + return size; +} + +/** + * @brief Returns whether the two sizes are equal. + * + * @param size1 The first size for the comparison + * @param size2 The second size for the comparison + * @return Whether the two sizes are equal + */ +static OF_INLINE bool +OFEqualSizes(OFSize size1, OFSize size2) +{ + if (size1.width != size2.width) + return false; + + if (size1.height != size2.height) return false; return true; } @@ -243,11 +243,11 @@ */ struct OF_BOXABLE of_rectangle_t { /** The point from where the rectangle originates */ OFPoint origin; /** The size of the rectangle */ - of_dimension_t size; + OFSize size; }; typedef struct of_rectangle_t of_rectangle_t; /** * @brief Creates a new of_rectangle_t. @@ -261,11 +261,11 @@ static OF_INLINE of_rectangle_t OF_CONST_FUNC of_rectangle(float x, float y, float width, float height) { of_rectangle_t rectangle = { OFMakePoint(x, y), - of_dimension(width, height) + OFMakeSize(width, height) }; return rectangle; } @@ -280,11 +280,11 @@ of_rectangle_equal(of_rectangle_t rectangle1, of_rectangle_t rectangle2) { if (!OFEqualPoints(rectangle1.origin, rectangle2.origin)) return false; - if (!of_dimension_equal(rectangle1.size, rectangle2.size)) + if (!OFEqualSizes(rectangle1.size, rectangle2.size)) return false; return true; }