From f3f221524e6be30217838661b4750820a7bebecf Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Fri, 4 Jun 2021 13:38:46 +0200 Subject: Add initial performance optimization for rect draw --- src/main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index ab41915..8df466f 100644 --- a/src/main.c +++ b/src/main.c @@ -50,6 +50,15 @@ WITH REGARD TO THIS SOFTWARE. #define PROF_INIT() #endif +void +test_rects() { + for (size_t i = 0; i < 100; i++) { + draw_rect(30, 30, 45, 45, 1); + draw_rect(35, 35, 60, 40, 2); + draw_rect(1, 1, 6, 6, 3); + } +} + int main(void) { // Adjust system wait times. SYSTEM_WAIT = SYSTEM_WAIT_CARTRIDGE; @@ -64,14 +73,11 @@ int main(void) { irq_init(); irs_set(IRQ_VBLANK, irs_stub); - // Main loop. PROF_INIT(); while (true) { bios_vblank_wait(); - txt_drawf("Hello world: %d", 4, 4, 6, 10); - draw_rect(30, 30, 45, 45, 1); - draw_rect(35, 35, 60, 40, 2); + PROF(test_rects(), eval_cycles); PROF_SHOW(); PROF(flip_buffer(), flip_cycles); } -- cgit v1.2.1