MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lwCreateCanvas

Function lwCreateCanvas

app/redis-6.2.6/src/lolwut.c:93–100  ·  view source on GitHub ↗

Allocate and return a new canvas of the specified size. */

Source from the content-addressed store, hash-verified

91
92/* Allocate and return a new canvas of the specified size. */
93lwCanvas *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(). */
103void lwFreeCanvas(lwCanvas *canvas) {

Callers 2

lwDrawSchotterFunction · 0.85
lolwut6CommandFunction · 0.85

Calls 2

zmallocFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected