diff options
Diffstat (limited to 'rtgrpblib_reset_raster.c')
-rw-r--r-- | rtgrpblib_reset_raster.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/rtgrpblib_reset_raster.c b/rtgrpblib_reset_raster.c new file mode 100644 index 0000000..2cfef42 --- /dev/null +++ b/rtgrpblib_reset_raster.c @@ -0,0 +1,29 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +int +rtgrpblib_reset_raster(RASTER *raster, size_t width, size_t height) +{ + if (!width || !height || width > raster->width * raster->height / height) { + errno = EINVAL; + return -1; + } + + raster->width = width; + raster->height = height; + memset(raster->cells, 0, width * height * sizeof(*raster->cells)); + return 0; +} + + +#else + +int +main(void) +{ + return 0; /* TODO add test */ +} + +#endif |