Commit 418b5052 authored by Kim F. Storm's avatar Kim F. Storm
Browse files

(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.
parent 3fb26a86
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment