Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

faster drawTile, remove repeat clipping checks #1801

Merged
merged 1 commit into from
Jan 9, 2022
Merged
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
11 changes: 10 additions & 1 deletion src/core/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ static void setPixel(tic_core* core, s32 x, s32 y, u8 color)
tic_api_poke4((tic_mem*)core, y * TIC80_WIDTH + x, color);
}

static void setPixelFast(tic_core* core, s32 x, s32 y, u8 color)
{
const tic_vram* vram = &core->memory.ram.vram;

// does not do any CLIP checking, the caller needs to do that first

tic_api_poke4((tic_mem*)core, y * TIC80_WIDTH + x, color);
}

static u8 getPixel(tic_core* core, s32 x, s32 y)
{
return tic_api_peek4((tic_mem*)core, y * TIC80_WIDTH + x);
Expand Down Expand Up @@ -129,7 +138,7 @@ static void drawRectBorder(tic_core* core, s32 x, s32 y, s32 width, s32 height,
for(s32 px=sx; px < ex; px++, xx++) \
{ \
u8 color = mapping[tic_tilesheet_gettilepix(tile, (X), (Y))];\
if(color != TRANSPARENT_COLOR) setPixel(core, xx, y, color); \
if(color != TRANSPARENT_COLOR) setPixelFast(core, xx, y, color); \
} \
} \
} while(0)
Expand Down