From 1c867f117586262af955a4680f4c529212dccda1 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 23 Dec 2019 11:54:06 -0800 Subject: [PATCH] Touch up scissor box fix --- opengl/4ed_opengl_render.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/opengl/4ed_opengl_render.cpp b/opengl/4ed_opengl_render.cpp index d9d696c3..48f3ef6f 100644 --- a/opengl/4ed_opengl_render.cpp +++ b/opengl/4ed_opengl_render.cpp @@ -287,18 +287,13 @@ gl_render(Render_Target *t){ group = group->next){ Rect_i32 box = Ri32(group->clip_box); - Rect_i32 scissor_box = - { + Rect_i32 scissor_box = { box.x0, height - box.y1, box.x1 - box.x0, box.y1 - box.y0, }; - if (scissor_box.x1 < 0) - { - scissor_box.x1 = 0; - } - if (scissor_box.y1 < 0) - { - scissor_box.y1 = 0; - } + scissor_box.x0 = clamp_bot(0, scissor_box.x0); + scissor_box.y0 = clamp_bot(0, scissor_box.y0); + scissor_box.x1 = clamp_bot(0, scissor_box.x1); + scissor_box.y1 = clamp_bot(0, scissor_box.y1); glScissor(scissor_box.x0, scissor_box.y0, scissor_box.x1, scissor_box.y1); i32 vertex_count = group->vertex_list.vertex_count;