summaryrefslogtreecommitdiff
path: root/gl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl.c')
-rw-r--r--gl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gl.c b/gl.c
index 9a35a1f..a30eb59 100644
--- a/gl.c
+++ b/gl.c
@@ -212,6 +212,10 @@ static void gl_geometry_rect(Rect r, u32 color_rgba) {
static void gl_geometry_rect_border(Rect r, float border_thickness, u32 color) {
float border_radius = border_thickness * 0.5f;
float x1 = r.pos.x, y1 = r.pos.y, x2 = x1 + r.size.x, y2 = y1 + r.size.y;
+
+ // make sure rectangle isn't too small
+ x2 = maxf(x2, x1 + 2 * border_radius);
+ y2 = maxf(y2, y1 + 2 * border_radius);
gl_geometry_rect(rect4(x1+border_radius, y1-border_radius, x2+border_radius, y1+border_radius), color);
gl_geometry_rect(rect4(x1-border_radius, y2-border_radius, x2-border_radius, y2+border_radius), color);