diff options
| author | Gerd Moellmann | 2000-12-23 17:22:45 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-12-23 17:22:45 +0000 |
| commit | 31798cfeb56f322b0f3b08221a0bbb4379cb9ccf (patch) | |
| tree | 47bc68f3e6dab31898d6aa5894633fdc2dc5632b | |
| parent | f81561561a2fb4e8278463479464cf7c5e95bc6d (diff) | |
| download | emacs-31798cfeb56f322b0f3b08221a0bbb4379cb9ccf.tar.gz emacs-31798cfeb56f322b0f3b08221a0bbb4379cb9ccf.zip | |
(save_frame_matrix, restore_frame_matrix): Removed.
(save_or_restore_current_matrix): New function for the same
purpose, but more efficient.
(adjust_frame_glyphs_for_frame_redisplay): Use it.
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/dispnew.c | 63 |
2 files changed, 28 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c25d648fcad..655b1312d65 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2000-12-23 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * dispnew.c (save_frame_matrix, restore_frame_matrix): Removed. | ||
| 4 | (save_or_restore_current_matrix): New function for the same | ||
| 5 | purpose, but more efficient. | ||
| 6 | (adjust_frame_glyphs_for_frame_redisplay): Use it. | ||
| 7 | |||
| 1 | 2000-12-23 Eli Zaretskii <eliz@is.elta.co.il> | 8 | 2000-12-23 Eli Zaretskii <eliz@is.elta.co.il> |
| 2 | 9 | ||
| 3 | * xdisp.c (syms_of_xdisp): Fix last change. | 10 | * xdisp.c (syms_of_xdisp): Fix last change. |
diff --git a/src/dispnew.c b/src/dispnew.c index 9c96da4b804..36ccd0d7bf6 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -120,8 +120,7 @@ struct dim | |||
| 120 | 120 | ||
| 121 | /* Function prototypes. */ | 121 | /* Function prototypes. */ |
| 122 | 122 | ||
| 123 | static struct glyph_matrix *save_frame_matrix P_ ((struct glyph_matrix *)); | 123 | static void save_or_restore_current_matrix P_ ((struct frame *, int)); |
| 124 | static void restore_frame_matrix P_ ((struct glyph_matrix *, struct glyph_matrix *)); | ||
| 125 | static void fake_current_matrices P_ ((Lisp_Object)); | 124 | static void fake_current_matrices P_ ((Lisp_Object)); |
| 126 | static void redraw_overlapping_rows P_ ((struct window *, int)); | 125 | static void redraw_overlapping_rows P_ ((struct window *, int)); |
| 127 | static void redraw_overlapped_rows P_ ((struct window *, int)); | 126 | static void redraw_overlapped_rows P_ ((struct window *, int)); |
| @@ -2056,55 +2055,35 @@ fake_current_matrices (window) | |||
| 2056 | } | 2055 | } |
| 2057 | 2056 | ||
| 2058 | 2057 | ||
| 2059 | /* Return a glyph matrix that holds of copy of the glyph contents | 2058 | /* Save or restore the contents of frame F's current frame matrix. |
| 2060 | of frame matrix M. */ | 2059 | SAVE_P non-zero means save it. */ |
| 2061 | 2060 | ||
| 2062 | static struct glyph_matrix * | 2061 | static void |
| 2063 | save_frame_matrix (m) | 2062 | save_or_restore_current_matrix (f, save_p) |
| 2064 | struct glyph_matrix *m; | 2063 | struct frame *f; |
| 2064 | int save_p; | ||
| 2065 | { | 2065 | { |
| 2066 | struct glyph_matrix *copy; | 2066 | struct glyph_row *from, *to, *end; |
| 2067 | int i; | ||
| 2068 | 2067 | ||
| 2069 | copy = (struct glyph_matrix *) xmalloc (sizeof *copy); | 2068 | if (save_p) |
| 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 | { | 2069 | { |
| 2075 | struct glyph_row *from = m->rows + i; | 2070 | from = f->current_matrix->rows; |
| 2076 | struct glyph_row *to = copy->rows + i; | 2071 | end = from + f->current_matrix->nrows; |
| 2077 | size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); | 2072 | to = f->desired_matrix->rows; |
| 2078 | to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes); | 2073 | } |
| 2079 | bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); | 2074 | else |
| 2080 | to->used[TEXT_AREA] = from->used[TEXT_AREA]; | 2075 | { |
| 2076 | from = f->desired_matrix->rows; | ||
| 2077 | end = from + f->desired_matrix->nrows; | ||
| 2078 | to = f->current_matrix->rows; | ||
| 2081 | } | 2079 | } |
| 2082 | 2080 | ||
| 2083 | return copy; | 2081 | for (; from < end; ++from, ++to) |
| 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 | |||
| 2090 | static void | ||
| 2091 | restore_frame_matrix (m, copy) | ||
| 2092 | struct glyph_matrix *m, *copy; | ||
| 2093 | { | ||
| 2094 | int i; | ||
| 2095 | |||
| 2096 | for (i = 0; i < copy->nrows; ++i) | ||
| 2097 | { | 2082 | { |
| 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); | 2083 | size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); |
| 2101 | bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); | 2084 | bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); |
| 2102 | to->used[TEXT_AREA] = from->used[TEXT_AREA]; | 2085 | to->used[TEXT_AREA] = from->used[TEXT_AREA]; |
| 2103 | xfree (from->glyphs[TEXT_AREA]); | ||
| 2104 | } | 2086 | } |
| 2105 | |||
| 2106 | xfree (copy->rows); | ||
| 2107 | xfree (copy); | ||
| 2108 | } | 2087 | } |
| 2109 | 2088 | ||
| 2110 | 2089 | ||
| @@ -2196,9 +2175,9 @@ adjust_frame_glyphs_for_frame_redisplay (f) | |||
| 2196 | && matrix_dim.width == f->current_matrix->matrix_w | 2175 | && matrix_dim.width == f->current_matrix->matrix_w |
| 2197 | && matrix_dim.height == f->current_matrix->matrix_h) | 2176 | && matrix_dim.height == f->current_matrix->matrix_h) |
| 2198 | { | 2177 | { |
| 2199 | struct glyph_matrix *saved = save_frame_matrix (f->current_matrix); | 2178 | save_or_restore_current_matrix (f, 1); |
| 2200 | adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim); | 2179 | adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim); |
| 2201 | restore_frame_matrix (f->current_matrix, saved); | 2180 | save_or_restore_current_matrix (f, 0); |
| 2202 | fake_current_matrices (FRAME_ROOT_WINDOW (f)); | 2181 | fake_current_matrices (FRAME_ROOT_WINDOW (f)); |
| 2203 | } | 2182 | } |
| 2204 | else | 2183 | else |