diff options
author | Bad Diode <bd@badd10de.dev> | 2023-04-15 23:53:26 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2023-04-15 23:53:26 +0200 |
commit | 6c0e7e0f470ec5617f01d57cf23145d581764a5b (patch) | |
tree | ed7d18b3d044bf907e018094083196a2835520b3 | |
parent | 6c5d2b5a6e71645f2fb3b48c26ed5b061a061fee (diff) | |
download | gba-link-cable-tester-6c0e7e0f470ec5617f01d57cf23145d581764a5b.tar.gz gba-link-cable-tester-6c0e7e0f470ec5617f01d57cf23145d581764a5b.zip |
Remove unnecessary priority changes
-rw-r--r-- | src/main.c | 12 | ||||
-rw-r--r-- | src/renderer_m0.c | 7 |
2 files changed, 4 insertions, 15 deletions
@@ -133,17 +133,7 @@ int main(void) { | |||
133 | bios_vblank_wait(); | 133 | bios_vblank_wait(); |
134 | 134 | ||
135 | PROF(test_clear(), test_clear_cycles); | 135 | PROF(test_clear(), test_clear_cycles); |
136 | // PROF(test_lines(), test_lines_cycles); | 136 | PROF(test_lines(), test_lines_cycles); |
137 | |||
138 | // ANIMATION EXAMPLE | ||
139 | // draw_rect(0 + x, 0, 100 + x, 100, 2); | ||
140 | // x += inc; | ||
141 | // if (x >= 50) { | ||
142 | // inc = -1; | ||
143 | // } else if (x <= 0) { | ||
144 | // inc = 1; | ||
145 | // } | ||
146 | |||
147 | PROF(test_rect(), test_rect_cycles); | 137 | PROF(test_rect(), test_rect_cycles); |
148 | PROF(test_fill_rect(), test_fill_rect_cycles); | 138 | PROF(test_fill_rect(), test_fill_rect_cycles); |
149 | PROF(test_chr(), test_chr_cycles); | 139 | PROF(test_chr(), test_chr_cycles); |
diff --git a/src/renderer_m0.c b/src/renderer_m0.c index 1d28fb9..97899aa 100644 --- a/src/renderer_m0.c +++ b/src/renderer_m0.c | |||
@@ -146,6 +146,7 @@ draw_line(size_t x0, size_t y0, size_t x1, size_t y1, u8 clr) { | |||
146 | MAYBE_SWAP(y0, y1); | 146 | MAYBE_SWAP(y0, y1); |
147 | draw_vline(x0, y0, y1, clr); | 147 | draw_vline(x0, y0, y1, clr); |
148 | } else { | 148 | } else { |
149 | // ... | ||
149 | // // Diagonal line. | 150 | // // Diagonal line. |
150 | // int dx = x0 > x1 ? x0 - x1 : x1 - x0; | 151 | // int dx = x0 > x1 ? x0 - x1 : x1 - x0; |
151 | // int dy = y0 > y1 ? y0 - y1 : y1 - y0; | 152 | // int dy = y0 > y1 ? y0 - y1 : y1 - y0; |
@@ -445,18 +446,16 @@ draw_filled_rect(size_t x0, size_t y0, size_t x1, size_t y1, u8 clr) { | |||
445 | IWRAM_CODE | 446 | IWRAM_CODE |
446 | void | 447 | void |
447 | flip_buffer(void) { | 448 | flip_buffer(void) { |
449 | // NOTE: can this be branchless? Either way is probably unnecessary other | ||
450 | // than code clarity maybe?. | ||
448 | if (backbuf == BUF_0) { | 451 | if (backbuf == BUF_0) { |
449 | backbuf = BUF_1; | 452 | backbuf = BUF_1; |
450 | BG_H_SCROLL_0 = 0; | 453 | BG_H_SCROLL_0 = 0; |
451 | BG_H_SCROLL_1 = -240; | 454 | BG_H_SCROLL_1 = -240; |
452 | BG_CTRL(0) = BG_CHARBLOCK(CB_0) | BG_SCREENBLOCK(SB_0) | BG_PRIORITY(0) | BG_SIZE(1); | ||
453 | BG_CTRL(1) = BG_CHARBLOCK(CB_1) | BG_SCREENBLOCK(SB_1) | BG_PRIORITY(2) | BG_SIZE(1); | ||
454 | } else { | 455 | } else { |
455 | backbuf = BUF_0; | 456 | backbuf = BUF_0; |
456 | BG_H_SCROLL_0 = -240; | 457 | BG_H_SCROLL_0 = -240; |
457 | BG_H_SCROLL_1 = 0; | 458 | BG_H_SCROLL_1 = 0; |
458 | BG_CTRL(0) = BG_CHARBLOCK(CB_0) | BG_SCREENBLOCK(SB_0) | BG_PRIORITY(2) | BG_SIZE(1); | ||
459 | BG_CTRL(1) = BG_CHARBLOCK(CB_1) | BG_SCREENBLOCK(SB_1) | BG_PRIORITY(0) | BG_SIZE(1); | ||
460 | } | 459 | } |
461 | // TODO: Copying all tiles for now. Study if it's better to use dirty_tiles | 460 | // TODO: Copying all tiles for now. Study if it's better to use dirty_tiles |
462 | // or dirty_lines. | 461 | // or dirty_lines. |