diff options
author | rodri <rgl@antares-labs.eu> | 2024-09-09 21:32:21 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-09-09 21:32:21 +0000 |
commit | 5cc40b1dea29dfc40831f69c3f1a8f72a47b5d18 (patch) | |
tree | eb2006b44047447014f38d3e79d89aa6e9d1df9c | |
parent | 216f83db15a2c6f28794e4be25165f5ac55270ef (diff) | |
download | libgraphics-5cc40b1dea29dfc40831f69c3f1a8f72a47b5d18.tar.gz libgraphics-5cc40b1dea29dfc40831f69c3f1a8f72a47b5d18.tar.bz2 libgraphics-5cc40b1dea29dfc40831f69c3f1a8f72a47b5d18.zip |
texture: clamp the coordinates instead of aborting when out of bounds.
-rw-r--r-- | texture.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -24,7 +24,8 @@ enum { static Point uv2tp(Point2 uv, Texture *t) { - assert(uv.x >= 0 && uv.x <= 1 && uv.y >= 0 && uv.y <= 1); + uv.x = fclamp(uv.x, 0, 1); + uv.y = fclamp(uv.y, 0, 1); return Pt(uv.x*Dx(t->image->r), (1 - uv.y)*Dy(t->image->r)); } |