MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / stbrp_init_target

Function stbrp_init_target

KBotExt/imgui/imstb_rectpack.h:261–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261STBRP_DEF void stbrp_init_target(stbrp_context* context, int width, int height, stbrp_node* nodes, int num_nodes)
262{
263 int i;
264
265 for (i = 0; i < num_nodes - 1; ++i)
266 nodes[i].next = &nodes[i + 1];
267 nodes[i].next = NULL;
268 context->init_mode = STBRP__INIT_skyline;
269 context->heuristic = STBRP_HEURISTIC_Skyline_default;
270 context->free_head = &nodes[0];
271 context->active_head = &context->extra[0];
272 context->width = width;
273 context->height = height;
274 context->num_nodes = num_nodes;
275 stbrp_setup_allow_out_of_mem(context, 0);
276
277 // node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly)
278 context->extra[0].x = 0;
279 context->extra[0].y = 0;
280 context->extra[0].next = &context->extra[1];
281 context->extra[1].x = (stbrp_coord)width;
282 context->extra[1].y = (1 << 30);
283 context->extra[1].next = NULL;
284}
285
286// find minimum y position if it starts at x1
287static int stbrp__skyline_find_min_y(stbrp_context* c, stbrp_node* first, int x0, int width, int* pwaste)

Callers 1

Calls 1

Tested by

no test coverage detected