You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
591 B
22 lines
591 B
#include "mark.h"
|
|
|
|
void markmap_reusable_init(Markmap_reusable* map) {
|
|
map->buffer = NULL;
|
|
map->capacity = 0;
|
|
}
|
|
|
|
void markmap_reusable_ensure_size(Markmap_reusable* map, Usz height,
|
|
Usz width) {
|
|
Usz capacity = height * width;
|
|
if (map->capacity < capacity) {
|
|
map->buffer = realloc(map->buffer, capacity);
|
|
map->capacity = capacity;
|
|
}
|
|
}
|
|
|
|
void markmap_reusable_deinit(Markmap_reusable* map) { free(map->buffer); }
|
|
|
|
void mbuffer_clear(Mbuffer map, Usz height, Usz width) {
|
|
Usz cleared_size = height * width;
|
|
memset(map, 0, cleared_size);
|
|
}
|
|
|