From 3eb80a2777b8eb04d2cb067641fa66238fbae204 Mon Sep 17 00:00:00 2001 From: iamcheeseman Date: Fri, 8 May 2026 23:20:03 -0400 Subject: update loop order for cache coherency --- teensy/renderer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'teensy') 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}, -- cgit v1.3-2-g0d8e