From e7307ae2fd67f92542d44f573775da25347d7140 Mon Sep 17 00:00:00 2001 From: vurtun Date: Wed, 15 Jun 2016 14:10:32 +0200 Subject: [PATCH] Fixed text clipping bug inside draw list Text was previously wrongfully software clipped if text was only partially visible. The wrong behavior is now fixed and text should be clipped only if the text is completely outside the clipping rect. --- nuklear.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nuklear.h b/nuklear.h index ba22f42..8cde808 100644 --- a/nuklear.h +++ b/nuklear.h @@ -6402,10 +6402,8 @@ nk_draw_list_add_text(struct nk_draw_list *list, const struct nk_user_font *font NK_ASSERT(list); if (!list || !len || !text) return; - if (rect.x > (list->clip_rect.x + list->clip_rect.w) || - rect.y > (list->clip_rect.y + list->clip_rect.h) || - rect.x < list->clip_rect.x || rect.y < list->clip_rect.y) - return; + if (!NK_INTERSECT(rect.x, rect.y, rect.w, rect.h, + list->clip_rect.x, list->clip_rect.y, list->clip_rect.w, list->clip_rect.h)) return; nk_draw_list_push_image(list, font->texture); x = rect.x;