aboutsummaryrefslogtreecommitdiff
path: root/teensy/renderer.c
diff options
context:
space:
mode:
Diffstat (limited to 'teensy/renderer.c')
-rw-r--r--teensy/renderer.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/teensy/renderer.c b/teensy/renderer.c
index 234cd01..29dc871 100644
--- a/teensy/renderer.c
+++ b/teensy/renderer.c
@@ -113,17 +113,15 @@ void ty_draw_image(struct ty_image img, struct ty_vec2i pos)
{
int x1 = fmin(fmax(floor(pos.x), 0), r.screen.width);
int y1 = fmin(fmax(floor(pos.y), 0), r.screen.height);
-
int x2 = fmin(fmax(floor(pos.x + img.width), 0), r.screen.width);
int y2 = fmin(fmax(floor(pos.y + img.height), 0), r.screen.height);
- for (int dx = x1; dx < x2; dx++) {
- for (int dy = y1; dy < y2; dy++) {
- struct ty_vec2i img_coord = ty_vec2i(dx - x1, dy - y1);
+ for (int dy = y1; dy < y2; dy++) {
+ for (int dx = x1; dx < x2; dx++) {
ty_img_set_pixel(
r.screen,
ty_vec2i(dx, dy),
- ty_img_get_pixel(img, img_coord)
+ ty_img_get_pixel(img, ty_vec2i(dx - x1, dy - y1))
);
}
}