aboutsummaryrefslogtreecommitdiff
path: root/teensy
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-05-08 23:20:03 -0400
committeriamcheeseman <[email protected]>2026-05-08 23:20:03 -0400
commit3eb80a2777b8eb04d2cb067641fa66238fbae204 (patch)
treefb47b58fe6af6ba2fb56a51fee627683b1e6ffda /teensy
parent3bc9ea9e89e714752ca11227c6665adeac4a18d6 (diff)
update loop order for cache coherency
Diffstat (limited to 'teensy')
-rw-r--r--teensy/renderer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/teensy/renderer.c b/teensy/renderer.c
index c507dcd..8cbba84 100644
--- a/teensy/renderer.c
+++ b/teensy/renderer.c
@@ -137,8 +137,8 @@ void ty_draw_image_ex(
int x2 = fmin(fmax(floor(dst.x + dst.w), 0), r.screen.width);
int y2 = fmin(fmax(floor(dst.y + dst.h), 0), r.screen.height);
- for (int dx = x1; dx < x2; dx++) {
- for (int dy = y1; dy < y2; dy++) {
+ for (int dy = y1; dy < y2; dy++) {
+ for (int dx = x1; dx < x2; dx++) {
int tex_x = ((dx - x1) * src.w) / dst.w + src.x;
int tex_y = ((dy - y1) * src.h) / dst.h + src.y;
@@ -159,8 +159,8 @@ void ty_draw_rect(struct ty_recti rect, struct ty_color color)
int x2 = fmin(fmax(floor(rect.x + rect.w), 0), r.screen.width);
int y2 = fmin(fmax(floor(rect.y + rect.h), 0), r.screen.height);
- for (int dx = x1; dx < x2; dx++) {
- for (int dy = y1; dy < y2; dy++) {
+ for (int dy = y1; dy < y2; dy++) {
+ for (int dx = x1; dx < x2; dx++) {
ty_img_set_pixel(
r.screen,
(struct ty_vec2i){dx, dy},