3131 * [your name could be here]
3232*/
3333
34+ #include <stdint.h>
35+ #include <retro_common_api.h>
36+ #include <retro_inline.h>
37+
38+ RETRO_BEGIN_DECLS
39+
3440#ifndef STB_INCLUDE_STB_RECT_PACK_H
3541#define STB_INCLUDE_STB_RECT_PACK_H
3642
37- #include <stdint.h>
38-
3943#define STB_RECT_PACK_VERSION 1
4044
4145#ifdef __cplusplus
@@ -46,43 +50,6 @@ typedef struct stbrp_context stbrp_context;
4650typedef struct stbrp_node stbrp_node ;
4751typedef struct stbrp_rect stbrp_rect ;
4852
49- void stbrp_pack_rects (stbrp_context * context ,
50- stbrp_rect * rects , int num_rects );
51-
52- /* Assign packed locations to rectangles. The rectangles are of type
53- * 'stbrp_rect' defined below, stored in the array 'rects', and there
54- * are 'num_rects' many of them.
55- *
56- * Rectangles which are successfully packed have the 'was_packed' flag
57- * set to a non-zero value and 'x' and 'y' store the minimum location
58- * on each axis (i.e. bottom-left in cartesian coordinates, top-left
59- * if you imagine y increasing downwards). Rectangles which do not fit
60- * have the 'was_packed' flag set to 0.
61- *
62- * You should not try to access the 'rects' array from another thread
63- * while this function is running, as the function temporarily reorders
64- * the array while it executes.
65- *
66- * To pack into another rectangle, you need to call stbrp_init_target
67- * again. To continue packing into the same rectangle, you can call
68- * this function again. Calling this multiple times with multiple rect
69- * arrays will probably produce worse packing results than calling it
70- * a single time with the full rectangle array, but the option is
71- * available.
72- */
73-
74- struct stbrp_rect
75- {
76- int id ; /* reserved for your use: */
77- uint16_t w , h ; /* input: */
78- uint16_t x , y ; /* output: */
79- int was_packed ; /* non-zero if valid packing */
80- }; /* 16 bytes, nominally */
81-
82-
83- void stbrp_init_target (stbrp_context * context ,
84- int width , int height , stbrp_node * nodes , int num_nodes );
85-
8653/* Initialize a rectangle packer to:
8754 * pack a rectangle that is 'width' by 'height' in dimensions
8855 * using temporary storage provided by the array 'nodes', which is 'num_nodes' long
@@ -134,8 +101,42 @@ struct stbrp_context
134101 stbrp_node extra [2 ]; /* we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' */
135102};
136103
137- #ifdef __cplusplus
138- }
139- #endif
104+ /* Assign packed locations to rectangles. The rectangles are of type
105+ * 'stbrp_rect' defined below, stored in the array 'rects', and there
106+ * are 'num_rects' many of them.
107+ *
108+ * Rectangles which are successfully packed have the 'was_packed' flag
109+ * set to a non-zero value and 'x' and 'y' store the minimum location
110+ * on each axis (i.e. bottom-left in cartesian coordinates, top-left
111+ * if you imagine y increasing downwards). Rectangles which do not fit
112+ * have the 'was_packed' flag set to 0.
113+ *
114+ * You should not try to access the 'rects' array from another thread
115+ * while this function is running, as the function temporarily reorders
116+ * the array while it executes.
117+ *
118+ * To pack into another rectangle, you need to call stbrp_init_target
119+ * again. To continue packing into the same rectangle, you can call
120+ * this function again. Calling this multiple times with multiple rect
121+ * arrays will probably produce worse packing results than calling it
122+ * a single time with the full rectangle array, but the option is
123+ * available.
124+ */
125+
126+ struct stbrp_rect
127+ {
128+ int id ; /* reserved for your use: */
129+ uint16_t w , h ; /* input: */
130+ uint16_t x , y ; /* output: */
131+ int was_packed ; /* non-zero if valid packing */
132+ }; /* 16 bytes, nominally */
133+
134+ void stbrp_pack_rects (stbrp_context * context ,
135+ stbrp_rect * rects , int num_rects );
136+
137+ void stbrp_init_target (stbrp_context * context ,
138+ int width , int height , stbrp_node * nodes , int num_nodes );
139+
140+ RETRO_END_DECLS
140141
141142#endif
0 commit comments