ObjFW  Diff

Differences From Artifact [cae8b45bf8]:

To Artifact [257923a725]:


139
140
141
142
143
144
145
146

147
148
149
150

151
152
153
154
155
156

157
158
159

160
161
162
163

164
165
166


167
168

169
170
171
172
173
174
175
176
177
178
179
180
181

182
183
184
185
186
187
188
139
140
141
142
143
144
145

146
147
148
149

150
151
152
153
154
155

156
157
158

159
160
161
162

163
164


165
166
167

168
169
170
171
172
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
188







-
+



-
+





-
+


-
+



-
+

-
-
+
+

-
+












-
+








/**
 * @brief A time interval in seconds.
 */
typedef double OFTimeInterval;

/**
 * @struct of_point_t OFObject.h ObjFW/OFObject.h
 * @struct OFPoint OFObject.h ObjFW/OFObject.h
 *
 * @brief A point.
 */
struct OF_BOXABLE of_point_t {
struct OF_BOXABLE OFPoint {
	/** The x coordinate of the point */
	float x;
	/** The y coordinate of the point */
	float y;
};
typedef struct of_point_t of_point_t;
typedef struct OFPoint OFPoint;

/**
 * @brief Creates a new of_point_t.
 * @brief Creates a new OFPoint.
 *
 * @param x The x coordinate of the point
 * @param y The x coordinate of the point
 * @return An of_point_t with the specified coordinates
 * @return An OFPoint with the specified coordinates
 */
static OF_INLINE of_point_t OF_CONST_FUNC
of_point(float x, float y)
static OF_INLINE OFPoint OF_CONST_FUNC
OFMakePoint(float x, float y)
{
	of_point_t point = { x, y };
	OFPoint point = { x, y };

	return point;
}

/**
 * @brief Returns whether the two points are equal.
 *
 * @param point1 The first point for the comparison
 * @param point2 The second point for the comparison
 * @return Whether the two points are equal
 */
static OF_INLINE bool
of_point_equal(of_point_t point1, of_point_t point2)
OFEqualPoints(OFPoint point1, OFPoint point2)
{
	if (point1.x != point2.x)
		return false;

	if (point1.y != point2.y)
		return false;

239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265

266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282

283
284
285
286
287
288
289
239
240
241
242
243
244
245

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281

282
283
284
285
286
287
288
289







-
+


















-
+
















-
+







/**
 * @struct of_rectangle_t OFObject.h ObjFW/OFObject.h
 *
 * @brief A rectangle.
 */
struct OF_BOXABLE of_rectangle_t {
	/** The point from where the rectangle originates */
	of_point_t origin;
	OFPoint origin;
	/** The size of the rectangle */
	of_dimension_t size;
};
typedef struct of_rectangle_t of_rectangle_t;

/**
 * @brief Creates a new of_rectangle_t.
 *
 * @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 width The width of the rectangle
 * @param height The height of the rectangle
 * @return An of_rectangle_t with the specified origin and size
 */
static OF_INLINE of_rectangle_t OF_CONST_FUNC
of_rectangle(float x, float y, float width, float height)
{
	of_rectangle_t rectangle = {
		of_point(x, y),
		OFMakePoint(x, y),
		of_dimension(width, height)
	};

	return rectangle;
}

/**
 * @brief Returns whether the two rectangles are equal.
 *
 * @param rectangle1 The first rectangle for the comparison
 * @param rectangle2 The second rectangle for the comparison
 * @return Whether the two rectangles are equal
 */
static OF_INLINE bool
of_rectangle_equal(of_rectangle_t rectangle1, of_rectangle_t rectangle2)
{
	if (!of_point_equal(rectangle1.origin, rectangle2.origin))
	if (!OFEqualPoints(rectangle1.origin, rectangle2.origin))
		return false;

	if (!of_dimension_equal(rectangle1.size, rectangle2.size))
		return false;

	return true;
}