aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-12-21 15:39:27 +0000
committerGerd Moellmann2000-12-21 15:39:27 +0000
commite797dea65e95544c680a6dd99a0ead7b5989e476 (patch)
tree8cbcb87f5509432ef390672a43ad9c491cb7b00d /src
parentfa4b4cfd927cee35ff481c5db54544348db6aba6 (diff)
downloademacs-e797dea65e95544c680a6dd99a0ead7b5989e476.tar.gz
emacs-e797dea65e95544c680a6dd99a0ead7b5989e476.zip
(ensure_frame_matrix): Removed.
(save_frame_matrix, restore_frame_matrix): New functions. (adjust_frame_glyphs_for_frame_redisplay): Use them.
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c86
1 files changed, 72 insertions, 14 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index d4f67ff704c..9c96da4b804 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -120,6 +120,8 @@ struct dim
120 120
121/* Function prototypes. */ 121/* Function prototypes. */
122 122
123static struct glyph_matrix *save_frame_matrix P_ ((struct glyph_matrix *));
124static void restore_frame_matrix P_ ((struct glyph_matrix *, struct glyph_matrix *));
123static void fake_current_matrices P_ ((Lisp_Object)); 125static void fake_current_matrices P_ ((Lisp_Object));
124static void redraw_overlapping_rows P_ ((struct window *, int)); 126static void redraw_overlapping_rows P_ ((struct window *, int));
125static void redraw_overlapped_rows P_ ((struct window *, int)); 127static void redraw_overlapped_rows P_ ((struct window *, int));
@@ -2054,15 +2056,55 @@ fake_current_matrices (window)
2054} 2056}
2055 2057
2056 2058
2057/* Make sure the current frame matrix of frame F has been built. 2059/* Return a glyph matrix that holds of copy of the glyph contents
2058 This is a no-op if F doesn't use frame-based redisplay. */ 2060 of frame matrix M. */
2059 2061
2060void 2062static struct glyph_matrix *
2061ensure_frame_matrix (f) 2063save_frame_matrix (m)
2062 struct frame *f; 2064 struct glyph_matrix *m;
2063{ 2065{
2064 if (f->current_pool && display_completed) 2066 struct glyph_matrix *copy;
2065 build_frame_matrix (f); 2067 int i;
2068
2069 copy = (struct glyph_matrix *) xmalloc (sizeof *copy);
2070 *copy = *m;
2071 copy->rows = (struct glyph_row *) xmalloc (m->nrows * sizeof (*copy->rows));
2072
2073 for (i = 0; i < copy->nrows; ++i)
2074 {
2075 struct glyph_row *from = m->rows + i;
2076 struct glyph_row *to = copy->rows + i;
2077 size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
2078 to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
2079 bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
2080 to->used[TEXT_AREA] = from->used[TEXT_AREA];
2081 }
2082
2083 return copy;
2084}
2085
2086
2087/* Restore the glyph contents of frame matrix M from the copy COPY,
2088 made by save_frame_matrix. Free memory allocated for COPY. */
2089
2090static void
2091restore_frame_matrix (m, copy)
2092 struct glyph_matrix *m, *copy;
2093{
2094 int i;
2095
2096 for (i = 0; i < copy->nrows; ++i)
2097 {
2098 struct glyph_row *from = copy->rows + i;
2099 struct glyph_row *to = m->rows + i;
2100 size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
2101 bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
2102 to->used[TEXT_AREA] = from->used[TEXT_AREA];
2103 xfree (from->glyphs[TEXT_AREA]);
2104 }
2105
2106 xfree (copy->rows);
2107 xfree (copy);
2066} 2108}
2067 2109
2068 2110
@@ -2139,15 +2181,31 @@ adjust_frame_glyphs_for_frame_redisplay (f)
2139 2181
2140 /* Resize frame matrices. */ 2182 /* Resize frame matrices. */
2141 adjust_glyph_matrix (NULL, f->desired_matrix, 0, 0, matrix_dim); 2183 adjust_glyph_matrix (NULL, f->desired_matrix, 0, 0, matrix_dim);
2142 adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim);
2143 2184
2144 /* If the display hasn't been interrupted, set up windows' 2185 /* Pointers to glyph memory in glyph rows are exchanged during
2145 current matrices so that they describe what's on the 2186 the update phase of redisplay, which means in general that a
2146 screen. */ 2187 frame's current matrix consists of pointers into both the
2147 if (display_completed) 2188 desired and current glyph pool of the frame. Adjusting a
2148 fake_current_matrices (FRAME_ROOT_WINDOW (f)); 2189 matrix sets the frame matrix up so that pointers are all into
2190 the same pool. If we want to preserve glyph contents of the
2191 current matrix over a call to adjust_glyph_matrix, we must
2192 make a copy of the current glyphs, and restore the current
2193 matrix' contents from that copy. */
2194 if (display_completed
2195 && !FRAME_GARBAGED_P (f)
2196 && matrix_dim.width == f->current_matrix->matrix_w
2197 && matrix_dim.height == f->current_matrix->matrix_h)
2198 {
2199 struct glyph_matrix *saved = save_frame_matrix (f->current_matrix);
2200 adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim);
2201 restore_frame_matrix (f->current_matrix, saved);
2202 fake_current_matrices (FRAME_ROOT_WINDOW (f));
2203 }
2149 else 2204 else
2150 SET_FRAME_GARBAGED (f); 2205 {
2206 adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim);
2207 SET_FRAME_GARBAGED (f);
2208 }
2151 } 2209 }
2152} 2210}
2153 2211