Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static bool draw_background_scanline(int nlayer, int line)
scan = GetFramebufferLine(line);

if (scan == engine->linebuffer)
memset(scan, 0, engine->framebuffer.pitch);
memset(scan, 0, engine->framebuffer.width * sizeof(*scan));

/* regular region */
if (scan != NULL)
Expand All @@ -91,7 +91,7 @@ static bool draw_background_scanline(int nlayer, int line)
/* build mosaic to linebuffer */
if (build_mosaic)
{
memset(mosaic, 0, engine->framebuffer.pitch);
memset(mosaic, 0, engine->framebuffer.width * sizeof(*mosaic));
BlitMosaic(engine->linebuffer, mosaic, framewidth, layer->mosaic.w, NULL);
}

Expand Down Expand Up @@ -170,7 +170,7 @@ bool DrawScanline(void)
if (engine->numlayers > 0)
{
background_priority = false;
memset(engine->priority, 0, engine->framebuffer.pitch);
memset(engine->priority, 0, engine->framebuffer.width * sizeof(*engine->priority));
for (c = engine->numlayers - 1; c >= 0; c--)
{
Layer* layer = &engine->layers[c];
Expand Down
2 changes: 1 addition & 1 deletion src/Tilengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static TLN_Engine create_context(int hres, int vres, int numlayers, int numsprit

/* buffer for intermediate scanline output */
context->linebuffer = (uint32_t*)calloc(hres, sizeof(uint32_t));
context->priority = (uint32_t*)malloc(context->framebuffer.pitch);
context->priority = (uint32_t*)calloc(hres, sizeof(uint32_t));
}

/* create static sprites */
Expand Down