Parcourir la source

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.
vurtun il y a 9 ans
Parent
commit
e7307ae2fd
1 fichiers modifiés avec 2 ajouts et 4 suppressions
  1. 2 4
      nuklear.h

+ 2 - 4
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;