Explorar o código

ImFont: fixed minor bug with CPU-side vertical clipping of text.

ocornut %!s(int64=10) %!d(string=hai) anos
pai
achega
6c3ab6fc9b
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      imgui.cpp

+ 5 - 1
imgui.cpp

@@ -10795,7 +10795,6 @@ void ImFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_re
                 if (!word_wrap_enabled && y + line_height < clip_rect.y)
                     while (s < text_end && *s != '\n')  // Fast-forward to next line
                         s++;
-
                 continue;
             }
             if (c == '\r')
@@ -10847,6 +10846,11 @@ void ImFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_re
                             v2 = v1 + ((clip_rect.w - y1) / (y2 - y1)) * (v2 - v1);
                             y2 = clip_rect.w;
                         }
+                        if (y1 >= y2)
+                        {
+                            x += char_width;
+                            continue;
+                        }
                     }
 
                     // NB: we are not calling PrimRectUV() here because non-inlined causes too much overhead in a debug build.