From ebff493cc890a1f4fa283801f7f792f7c6160d74 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sun, 21 Feb 1999 23:49:04 +0000 Subject: [PATCH] Slight optimisation of do_text so we don't do anything if the entire string's invisible. [originally from svn r59] --- macterm.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/macterm.c b/macterm.c index 255cbcb8..d88c0aad 100644 --- a/macterm.c +++ b/macterm.c @@ -161,8 +161,30 @@ void do_text(struct mac_session *s, int x, int y, char *text, int len, int style = 0; int bgcolour, fgcolour; RGBColor rgbfore, rgbback; + RgnHandle textregion, intersection; + Rect textrect; SetPort(s->window); +#if 0 + /* First check this text is relevant */ + textregion = NewRgn(); + SetRectRgn(textregion, x * font_width, (x + len) * font_width, + y * font_height, (y + 1) * font_height); + SectRgn(textregion, s->window->visRgn, textregion); + if (EmptyRgn(textregion)) { + DisposeRgn(textregion); + return; + } +#else + /* alternatively */ + textrect.top = y * font_height; + textrect.bottom = (y + 1) * font_height; + textrect.left = x * font_width; + textrect.right = (x + len) * font_width; + if (!RectInRgn(&textrect, s->window->visRgn)) + return; +#endif + TextFont(s->fontnum); if (cfg.fontisbold || (attr & ATTR_BOLD) && !cfg.bold_colour) style |= bold;