summaryrefslogtreecommitdiff
path: root/apps/plugins/xrick/rects.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/xrick/rects.c')
-rw-r--r--apps/plugins/xrick/rects.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/apps/plugins/xrick/rects.c b/apps/plugins/xrick/rects.c
new file mode 100644
index 0000000000..9324426060
--- /dev/null
+++ b/apps/plugins/xrick/rects.c
@@ -0,0 +1,57 @@
1/*
2 * xrick/rects.c
3 *
4 * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net).
5 * Copyright (C) 2008-2014 Pierluigi Vicinanza.
6 * All rights reserved.
7 *
8 * The use and distribution terms for this software are contained in the file
9 * named README, which can be found in the root of this distribution. By
10 * using this software in any fashion, you are agreeing to be bound by the
11 * terms of this license.
12 *
13 * You must not remove this notice, or any other, from this software.
14 */
15
16#include "xrick/rects.h"
17#include "xrick/system/system.h"
18
19/*
20 * Free a list of rectangles and set the pointer to NULL.
21 *
22 * p: rectangle list CHANGED to NULL
23 */
24void
25rects_free(rect_t *r)
26{
27 while (r)
28 {
29 rect_t * next = r->next;
30 sysmem_pop(r);
31 r = next;
32 }
33}
34
35
36/*
37 * Add a rectangle to a list of rectangles
38 */
39rect_t *
40rects_new(U16 x, U16 y, U16 width, U16 height, rect_t *next)
41{
42 rect_t *r;
43
44 r = sysmem_push(sizeof(*r));
45 if (!r)
46 {
47 return NULL;
48 }
49 r->x = x;
50 r->y = y;
51 r->width = width;
52 r->height = height;
53 r->next = next;
54 return r;
55}
56
57/* eof */