aboutsummaryrefslogtreecommitdiffstats
path: root/src/dispnew.c
diff options
context:
space:
mode:
authorGerd Moellmann <[email protected]>2000-12-23 17:22:45 +0000
committerGerd Moellmann <[email protected]>2000-12-23 17:22:45 +0000
commit31798cfeb56f322b0f3b08221a0bbb4379cb9ccf (patch)
tree47bc68f3e6dab31898d6aa5894633fdc2dc5632b /src/dispnew.c
parentf81561561a2fb4e8278463479464cf7c5e95bc6d (diff)
(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.
Diffstat (limited to 'src/dispnew.c')
-rw-r--r--src/dispnew.c63
1 files changed, 21 insertions, 42 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 9c96da4b80..36ccd0d7bf 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -120,8 +120,7 @@ struct dim
/* Function prototypes. */
-static struct glyph_matrix *save_frame_matrix P_ ((struct glyph_matrix *));
-static void restore_frame_matrix P_ ((struct glyph_matrix *, struct glyph_matrix *));
+static void save_or_restore_current_matrix P_ ((struct frame *, int));
static void fake_current_matrices P_ ((Lisp_Object));
static void redraw_overlapping_rows P_ ((struct window *, int));
static void redraw_overlapped_rows P_ ((struct window *, int));
@@ -2056,55 +2055,35 @@ fake_current_matrices (window)
}
-/* Return a glyph matrix that holds of copy of the glyph contents
- of frame matrix M. */
+/* Save or restore the contents of frame F's current frame matrix.
+ SAVE_P non-zero means save it. */
-static struct glyph_matrix *
-save_frame_matrix (m)
- struct glyph_matrix *m;
+static void
+save_or_restore_current_matrix (f, save_p)
+ struct frame *f;
+ int save_p;
{
- struct glyph_matrix *copy;
- int i;
+ struct glyph_row *from, *to, *end;
- copy = (struct glyph_matrix *) xmalloc (sizeof *copy);
- *copy = *m;
- copy->rows = (struct glyph_row *) xmalloc (m->nrows * sizeof (*copy->rows));
-
- for (i = 0; i < copy->nrows; ++i)
+ if (save_p)
{
- struct glyph_row *from = m->rows + i;
- struct glyph_row *to = copy->rows + i;
- size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
- to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
- bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
- to->used[TEXT_AREA] = from->used[TEXT_AREA];
+ from = f->current_matrix->rows;
+ end = from + f->current_matrix->nrows;
+ to = f->desired_matrix->rows;
+ }
+ else
+ {
+ from = f->desired_matrix->rows;
+ end = from + f->desired_matrix->nrows;
+ to = f->current_matrix->rows;
}
- return copy;
-}
-
-
-/* Restore the glyph contents of frame matrix M from the copy COPY,
- made by save_frame_matrix. Free memory allocated for COPY. */
-
-static void
-restore_frame_matrix (m, copy)
- struct glyph_matrix *m, *copy;
-{
- int i;
-
- for (i = 0; i < copy->nrows; ++i)
+ for (; from < end; ++from, ++to)
{
- struct glyph_row *from = copy->rows + i;
- struct glyph_row *to = m->rows + i;
size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes);
to->used[TEXT_AREA] = from->used[TEXT_AREA];
- xfree (from->glyphs[TEXT_AREA]);
}
-
- xfree (copy->rows);
- xfree (copy);
}
@@ -2196,9 +2175,9 @@ adjust_frame_glyphs_for_frame_redisplay (f)
&& matrix_dim.width == f->current_matrix->matrix_w
&& matrix_dim.height == f->current_matrix->matrix_h)
{
- struct glyph_matrix *saved = save_frame_matrix (f->current_matrix);
+ save_or_restore_current_matrix (f, 1);
adjust_glyph_matrix (NULL, f->current_matrix, 0, 0, matrix_dim);
- restore_frame_matrix (f->current_matrix, saved);
+ save_or_restore_current_matrix (f, 0);
fake_current_matrices (FRAME_ROOT_WINDOW (f));
}
else