changeset 60492:c17cdf5decaa

(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.
author Kim F. Storm <storm@cua.dk>
date Mon, 07 Mar 2005 21:51:50 +0000
parents 3e710de46e51
children f8557889a5f1 7ea3d7198adc
files src/xdisp.c
diffstat 1 files changed, 33 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Mon Mar 07 21:50:36 2005 +0000
+++ b/src/xdisp.c	Mon Mar 07 21:51:50 2005 +0000
@@ -781,6 +781,13 @@
 #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 @@
   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 @@
       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 @@
 		   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 @@
   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;