aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-06-04 13:38:46 +0200
committerBad Diode <bd@badd10de.dev>2021-06-04 13:38:46 +0200
commitf3f221524e6be30217838661b4750820a7bebecf (patch)
tree51f3dcd5d02d45abbd5ace92fe910d2241d3e4e8 /src/main.c
parentaedaa7ade0ed623d09b18a34023f2e02201e67e6 (diff)
downloadstepper-f3f221524e6be30217838661b4750820a7bebecf.tar.gz
stepper-f3f221524e6be30217838661b4750820a7bebecf.zip
Add initial performance optimization for rect draw
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 10 insertions, 4 deletions
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.
50#define PROF_INIT() 50#define PROF_INIT()
51#endif 51#endif
52 52
53void
54test_rects() {
55 for (size_t i = 0; i < 100; i++) {
56 draw_rect(30, 30, 45, 45, 1);
57 draw_rect(35, 35, 60, 40, 2);
58 draw_rect(1, 1, 6, 6, 3);
59 }
60}
61
53int main(void) { 62int main(void) {
54 // Adjust system wait times. 63 // Adjust system wait times.
55 SYSTEM_WAIT = SYSTEM_WAIT_CARTRIDGE; 64 SYSTEM_WAIT = SYSTEM_WAIT_CARTRIDGE;
@@ -64,14 +73,11 @@ int main(void) {
64 irq_init(); 73 irq_init();
65 irs_set(IRQ_VBLANK, irs_stub); 74 irs_set(IRQ_VBLANK, irs_stub);
66 75
67
68 // Main loop. 76 // Main loop.
69 PROF_INIT(); 77 PROF_INIT();
70 while (true) { 78 while (true) {
71 bios_vblank_wait(); 79 bios_vblank_wait();
72 txt_drawf("Hello world: %d", 4, 4, 6, 10); 80 PROF(test_rects(), eval_cycles);
73 draw_rect(30, 30, 45, 45, 1);
74 draw_rect(35, 35, 60, 40, 2);
75 PROF_SHOW(); 81 PROF_SHOW();
76 PROF(flip_buffer(), flip_cycles); 82 PROF(flip_buffer(), flip_cycles);
77 } 83 }