summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaesup Kwak <veshboo@gmail.com>2017-11-24 11:33:32 +0200
committerEli Zaretskii <eliz@gnu.org>2017-11-24 11:33:32 +0200
commite5dbeb77f4da2fe8b13e13bfe8d5ce4565b83f56 (patch)
tree337441c7bce8c77fad23fdbca986521a0c80e010
parented36c71a1e36b919c57cd9f1ab73210e64810fcb (diff)
downloademacs-e5dbeb77f4da2fe8b13e13bfe8d5ce4565b83f56.tar.gz
Avoid unnecessary xwidget_view creations
* src/xwidget.c (x_draw_xwidget_glyph_string): Don't create new xwidget view if we have a usable one already. Copyright-paperwork-exempt: yes
-rw-r--r--src/xwidget.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index a0c9e034775..a67dc0ecf4d 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -585,22 +585,20 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
xwidget on screen. Moving and clipping is done here. Also view
initialization. */
struct xwidget *xww = s->xwidget;
- struct xwidget_view *xv;
+ struct xwidget_view *xv = xwidget_view_lookup (xww, s->w);
int clip_right;
int clip_bottom;
int clip_top;
int clip_left;
- /* FIXME: The result of this call is discarded.
- What if the lookup fails? */
- xwidget_view_lookup (xww, s->w);
-
int x = s->x;
int y = s->y + (s->height / 2) - (xww->height / 2);
/* Do initialization here in the display loop because there is no
- other time to know things like window placement etc. */
- xv = xwidget_init_view (xww, s, x, y);
+ other time to know things like window placement etc. Do not
+ create a new view if we have found one that is usable. */
+ if (!xv)
+ xv = xwidget_init_view (xww, s, x, y);
int text_area_x, text_area_y, text_area_width, text_area_height;