Allocate and return a new canvas of the specified size. */
| 91 | |
| 92 | /* Allocate and return a new canvas of the specified size. */ |
| 93 | lwCanvas *lwCreateCanvas(int width, int height, int bgcolor) { |
| 94 | lwCanvas *canvas = zmalloc(sizeof(*canvas)); |
| 95 | canvas->width = width; |
| 96 | canvas->height = height; |
| 97 | canvas->pixels = zmalloc((size_t)width*height); |
| 98 | memset(canvas->pixels,bgcolor,(size_t)width*height); |
| 99 | return canvas; |
| 100 | } |
| 101 | |
| 102 | /* Free the canvas created by lwCreateCanvas(). */ |
| 103 | void lwFreeCanvas(lwCanvas *canvas) { |
no test coverage detected