From: Kim F. Storm Date: Mon, 7 Mar 2005 21:51:50 +0000 (+0000) Subject: (CLEAR_IMAGE_CACHE_COUNT): New const. X-Git-Tag: ttn-vms-21-2-B4~1900 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=418b505281d03c422860a5116c328c91455724d2;p=emacs.git (CLEAR_IMAGE_CACHE_COUNT): New const. (clear_image_cache_count): New var. (redisplay_internal): Don't clear face and image caches in the middle of redisplay; do it afterwards. --- diff --git a/src/xdisp.c b/src/xdisp.c index 284cad0dad2..9c2d3c2554d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -781,6 +781,13 @@ enum move_it_result #define CLEAR_FACE_CACHE_COUNT 500 static int clear_face_cache_count; +/* Similarly for the image cache. */ + +#ifdef HAVE_WINDOW_SYSTEM +#define CLEAR_IMAGE_CACHE_COUNT 101 +static int clear_image_cache_count; +#endif + /* Record the previous terminal frame we displayed. */ static struct frame *previous_terminal_frame; @@ -10365,7 +10372,9 @@ redisplay_internal (preserve_echo_area) CHARPOS (this_line_start_pos) = 0; consider_all_windows_p |= buffer_shared > 1; ++clear_face_cache_count; - +#ifdef HAVE_WINDOW_SYSTEM + ++clear_image_cache_count; +#endif /* Build desired matrices, and update the display. If consider_all_windows_p is non-zero, do it for all windows on all @@ -10378,13 +10387,6 @@ redisplay_internal (preserve_echo_area) struct frame **updated = (struct frame **) alloca (size * sizeof *updated); - /* Clear the face cache eventually. */ - if (clear_face_cache_count > CLEAR_FACE_CACHE_COUNT) - { - clear_face_cache (0); - clear_face_cache_count = 0; - } - /* Recompute # windows showing selected buffer. This will be incremented each time such a window is displayed. */ buffer_shared = 0; @@ -10400,12 +10402,6 @@ redisplay_internal (preserve_echo_area) variables. */ select_frame_for_redisplay (frame); -#ifdef HAVE_WINDOW_SYSTEM - if (clear_face_cache_count % 50 == 0 - && FRAME_WINDOW_P (f)) - clear_image_cache (f, 0); -#endif /* HAVE_WINDOW_SYSTEM */ - /* Mark all the scroll bars to be removed; we'll redeem the ones we want when we redisplay their windows. */ if (condemn_scroll_bars_hook) @@ -10609,6 +10605,29 @@ redisplay_internal (preserve_echo_area) if (windows_or_buffers_changed && !pause) goto retry; + /* Clear the face cache eventually. */ + if (consider_all_windows_p) + { + if (clear_face_cache_count > CLEAR_FACE_CACHE_COUNT) + { + clear_face_cache (0); + clear_face_cache_count = 0; + } +#ifdef HAVE_WINDOW_SYSTEM + if (clear_image_cache_count > CLEAR_IMAGE_CACHE_COUNT) + { + Lisp_Object tail, frame; + FOR_EACH_FRAME (tail, frame) + { + struct frame *f = XFRAME (frame); + if (FRAME_WINDOW_P (f)) + clear_image_cache (f, 0); + } + clear_image_cache_count = 0; + } +#endif /* HAVE_WINDOW_SYSTEM */ + } + end_of_redisplay: unbind_to (count, Qnil); RESUME_POLLING;