summaryrefslogtreecommitdiff
path: root/src/dispnew.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2013-10-14 16:19:21 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2013-10-14 16:19:21 +0400
commit77e3b1b7095b3376dbddd22cbca4827b797767c0 (patch)
tree1e5cbc68a42c7e1b08acf36d94bc4b158d6117a0 /src/dispnew.c
parente558436b778c0199caaff0ce40b9a279bacf640e (diff)
* termhooks.h (FRAME_MUST_WRITE_SPACES, FRAME_LINE_INS_DEL_OK)
(FRAME_CHAR_INS_DEL_OK, FRAME_SCROLL_REGION_OK) (FRAME_SCROLL_REGION_COST, FRAME_MEMORY_BELOW_FRAME): Adjust to match the change described below. (struct terminal): Move must_write_spaces, line_ins_del_ok, char_ins_del_ok, scroll_region_ok, scroll_region_cost and memory_below_frame members to... * termchar.h (struct tty_display_info): ...here because they're relevant only on TTYs. Prefer unsigned bitfield where appropriate. * term.c (init_tty): * nsterm.m (ns_create_terminal): * w32term.c (w32_create_terminal): * xterm.c (x_create_terminal): Adjust users. * dispnew.c (line_hash_code, line_draw_cost): Pass frame arg to filter out non-TTY frames. Adjust comment. (scrolling): Adjust user. Prefer eassert for debugging check.
Diffstat (limited to 'src/dispnew.c')
-rw-r--r--src/dispnew.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 3c0fda0b74..25acdd725d 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1070,10 +1070,11 @@ prepare_desired_row (struct glyph_row *row)
}
-/* Return a hash code for glyph row ROW. */
+/* Return a hash code for glyph row ROW, which may
+ be from current or desired matrix of frame F. */
static int
-line_hash_code (struct glyph_row *row)
+line_hash_code (struct frame *f, struct glyph_row *row)
{
int hash = 0;
@@ -1086,7 +1087,7 @@ line_hash_code (struct glyph_row *row)
{
int c = glyph->u.ch;
int face_id = glyph->face_id;
- if (FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is SELECTED_FRAME OK here? */
+ if (FRAME_MUST_WRITE_SPACES (f))
c -= SPACEGLYPH;
hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c;
hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + face_id;
@@ -1101,12 +1102,13 @@ line_hash_code (struct glyph_row *row)
}
-/* Return the cost of drawing line VPOS in MATRIX. The cost equals
- the number of characters in the line. If must_write_spaces is
- zero, leading and trailing spaces are ignored. */
+/* Return the cost of drawing line VPOS in MATRIX, which may
+ be current or desired matrix of frame F. The cost equals
+ the number of characters in the line. If must_write_spaces
+ is zero, leading and trailing spaces are ignored. */
static int
-line_draw_cost (struct glyph_matrix *matrix, int vpos)
+line_draw_cost (struct frame *f, struct glyph_matrix *matrix, int vpos)
{
struct glyph_row *row = matrix->rows + vpos;
struct glyph *beg = row->glyphs[TEXT_AREA];
@@ -1116,7 +1118,7 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos)
ptrdiff_t glyph_table_len = GLYPH_TABLE_LENGTH;
/* Ignore trailing and leading spaces if we can. */
- if (!FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is SELECTED_FRAME OK here? */
+ if (!FRAME_MUST_WRITE_SPACES (f))
{
/* Skip from the end over trailing spaces. */
while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1)))
@@ -4595,8 +4597,7 @@ scrolling (struct frame *frame)
struct glyph_matrix *current_matrix = frame->current_matrix;
struct glyph_matrix *desired_matrix = frame->desired_matrix;
- if (!current_matrix)
- emacs_abort ();
+ eassert (current_matrix);
/* Compute hash codes of all the lines. Also calculate number of
changed lines, number of unchanged lines at the beginning, and
@@ -4609,7 +4610,7 @@ scrolling (struct frame *frame)
/* Give up on this scrolling if some old lines are not enabled. */
if (!MATRIX_ROW_ENABLED_P (current_matrix, i))
return 0;
- old_hash[i] = line_hash_code (MATRIX_ROW (current_matrix, i));
+ old_hash[i] = line_hash_code (frame, MATRIX_ROW (current_matrix, i));
if (! MATRIX_ROW_ENABLED_P (desired_matrix, i))
{
/* This line cannot be redrawn, so don't let scrolling mess it. */
@@ -4619,8 +4620,8 @@ scrolling (struct frame *frame)
}
else
{
- new_hash[i] = line_hash_code (MATRIX_ROW (desired_matrix, i));
- draw_cost[i] = line_draw_cost (desired_matrix, i);
+ new_hash[i] = line_hash_code (frame, MATRIX_ROW (desired_matrix, i));
+ draw_cost[i] = line_draw_cost (frame, desired_matrix, i);
}
if (old_hash[i] != new_hash[i])
@@ -4630,7 +4631,7 @@ scrolling (struct frame *frame)
}
else if (i == unchanged_at_top)
unchanged_at_top++;
- old_draw_cost[i] = line_draw_cost (current_matrix, i);
+ old_draw_cost[i] = line_draw_cost (frame, current_matrix, i);
}
/* If changed lines are few, don't allow preemption, don't scroll. */