From 2858679cc4ef80c6c0bf679aa02e6e9326043488 Mon Sep 17 00:00:00 2001 From: Nishi Date: Mon, 21 Sep 2026 11:57:37 +0900 Subject: [PATCH] optimize --- src/widget/document.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/widget/document.c b/src/widget/document.c index d6aec38..f71e1bc 100644 --- a/src/widget/document.c +++ b/src/widget/document.c @@ -59,6 +59,17 @@ static void draw(MwWidget handle) { MwFLFont font = NULL; MwPoint u_p, s_p, c_p; int u = 0, s = 0, c = 0; + int s_y = 0; + int s_h = MwGetInteger(handle, MwNheight); + MwWidget p = handle->parent; + + s_y = MwGetInteger(handle, MwNy); + while(p != NULL && p->widget_class != MwWindowClass) { + s_y += MwGetInteger(p, MwNy); + + p = p->parent; + } + s_y *= -1; u_p.x = s_p.x = c_p.x = 0; u_p.y = s_p.y = c_p.y = 0; @@ -80,6 +91,8 @@ static void draw(MwWidget handle) { p.x = l->x; p.y = l->y + MwTextHeight(handle, font, l->text) / 2; + if(p.y <= s_y || p.y >= s_y + s_h) break; + if(u || s || c) { MwPoint line[2]; int j;