Speed up XEmacs on X
Michael Sperber <[email protected]> Mon, 22 Jun 2015 10:48:33 +0200
| Newsgroups | gmane.emacs.xemacs.patches |
|---|---|
| Message-ID | <[email protected]> |
--=-=-= Content-Type: text/plain ... at least for me. When I upgraded to Mac OS X Yosemite a few months ago, everything slowed to a crawl and XEmacs became basically unusable. I did some profiling, and XQueryColor showed up massively. This patch fixed it for me. 2015-06-22 Michael Sperber <[email protected]> * lwlib-colors.h: * lwlib-colors.c (xft_convert_color_1): Introduce, and make `xft_convert_color' use it. 2015-06-22 Michael Sperber <[email protected]> * redisplay-xlike-inc.c (XFT_FROB_LISP_COLOR): Use `xft_convert_color_1' instead of `xft_convert_color'. I'll push thism on Wednesday if nobody objects. -- Regards, Mike --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lwlib/lwlib-colors.c b/lwlib/lwlib-colors.c --- a/lwlib/lwlib-colors.c +++ b/lwlib/lwlib-colors.c @@ -329,6 +329,29 @@ #ifdef HAVE_XFT XftColor +xft_convert_color_1 (Display *dpy, Colormap cmap, Visual *visual, XColor *pcolor, int dim) +{ + XColor color = *pcolor; + XftColor result; + + if (dim) + { + color.red = MINL (65535, color.red * 1.5); + color.green = MINL (65535, color.green * 1.5); + color.blue = MINL (65535, color.blue * 1.5); + x_allocate_nearest_color (dpy, cmap, visual, &color); + } + + result.pixel = color.pixel; + result.color.red = color.red; + result.color.green = color.green; + result.color.blue = color.blue; + result.color.alpha = 0xffff; + + return result; +} + +XftColor xft_convert_color (Display *dpy, Colormap cmap, Visual *visual, int c, int dim) { static XColor color; /* #### why is this static ?? */ @@ -337,22 +360,10 @@ color.pixel = c; XQueryColor(dpy, cmap, &color); - if (dim) - { - color.red = MINL (65535, color.red * 1.5); - color.green = MINL (65535, color.green * 1.5); - color.blue = MINL (65535, color.blue * 1.5); - x_allocate_nearest_color (dpy, cmap, visual, &color); - } + return xft_convert_color_1 (dpy, cmap, visual, &color, dim); +} - result.pixel = color.pixel; - result.color.red = color.red; - result.color.green = color.green; - result.color.blue = color.blue; - result.color.alpha = 0xffff; - - return result; -} + #endif /* HAVE_XFT */ diff --git a/lwlib/lwlib-colors.h b/lwlib/lwlib-colors.h --- a/lwlib/lwlib-colors.h +++ b/lwlib/lwlib-colors.h @@ -52,6 +52,8 @@ XftColor xft_convert_color (Display *dpy, Colormap cmap, Visual *visual, int c, int dim); +XftColor xft_convert_color_1 (Display *dpy, Colormap cmap, Visual *visual, + XColor *pcolor, int dim); #endif /* HAVE_XFT */ #endif /* INCLUDED_lwlib_colors_h_ */ diff --git a/src/redisplay-xlike-inc.c b/src/redisplay-xlike-inc.c --- a/src/redisplay-xlike-inc.c +++ b/src/redisplay-xlike-inc.c @@ -1033,8 +1033,8 @@ color. See ca. line 759 this file. #### Maybe xft_convert_color should take an XColor, not a pixel. */ #define XFT_FROB_LISP_COLOR(color, dim) \ - xft_convert_color (dpy, cmap, visual, \ - XCOLOR_INSTANCE_X_COLOR (color).pixel, (dim)) + xft_convert_color_1 (dpy, cmap, visual, \ + &(XCOLOR_INSTANCE_X_COLOR (color)), (dim)) #endif /* USE_XFT */ if (width < 0) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ XEmacs-Patches mailing list [email protected] http://lists.xemacs.org/mailman/listinfo/xemacs-patches --=-=-=--