Commit e61124cd authored by YAMAMOTO Mitsuharu's avatar YAMAMOTO Mitsuharu
Browse files

Take account of periodic fringe bitmap's dependency on y-position in redrawing.

* dispextern.h (struct glyph_row): New member fringe_bitmap_periodic_p.

* dispnew.c (shift_glyph_matrix, scrolling_window): Mark scrolled row
for fringe update if it has periodic bitmap.
(row_equal_p): Also compare left_fringe_offset,	right_fringe_offset,
and fringe_bitmap_periodic_p.

* fringe.c (get_fringe_bitmap_data): New function.
(draw_fringe_bitmap_1, update_window_fringes): Use it.
(update_window_fringes): Record periodicity of fringe bitmap in glyph
row.  Mark glyph row for fringe update if periodicity changed.

* xdisp.c (try_window_reusing_current_matrix): Don't mark scrolled row
for fringe update unless it has periodic bitmap.
parent 964b0e76
2011-05-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* dispextern.h (struct glyph_row): New member fringe_bitmap_periodic_p.
* dispnew.c (shift_glyph_matrix, scrolling_window): Mark scrolled row
for fringe update if it has periodic bitmap.
(row_equal_p): Also compare left_fringe_offset, right_fringe_offset,
and fringe_bitmap_periodic_p.
* fringe.c (get_fringe_bitmap_data): New function.
(draw_fringe_bitmap_1, update_window_fringes): Use it.
(update_window_fringes): Record periodicity of fringe bitmap in glyph
row. Mark glyph row for fringe update if periodicity changed.
* xdisp.c (try_window_reusing_current_matrix): Don't mark scrolled row
for fringe update unless it has periodic bitmap.
2011-05-25 Kenichi Handa <handa@m17n.org> 2011-05-25 Kenichi Handa <handa@m17n.org>
   
* xdisp.c (get_next_display_element): Set correct it->face_id for * xdisp.c (get_next_display_element): Set correct it->face_id for
......
...@@ -786,6 +786,10 @@ struct glyph_row ...@@ -786,6 +786,10 @@ struct glyph_row
/* Vertical offset of the right fringe bitmap. */ /* Vertical offset of the right fringe bitmap. */
signed right_fringe_offset : FRINGE_HEIGHT_BITS; signed right_fringe_offset : FRINGE_HEIGHT_BITS;
/* 1 means that at least one of the left and right fringe bitmaps is
periodic and thus depends on the y-position of the row. */
unsigned fringe_bitmap_periodic_p : 1;
/* 1 means that we must draw the bitmaps of this row. */ /* 1 means that we must draw the bitmaps of this row. */
unsigned redraw_fringe_bitmaps_p : 1; unsigned redraw_fringe_bitmaps_p : 1;
......
...@@ -1012,6 +1012,8 @@ shift_glyph_matrix (w, matrix, start, end, dy) ...@@ -1012,6 +1012,8 @@ shift_glyph_matrix (w, matrix, start, end, dy)
row->visible_height -= min_y - row->y; row->visible_height -= min_y - row->y;
if (row->y + row->height > max_y) if (row->y + row->height > max_y)
row->visible_height -= row->y + row->height - max_y; row->visible_height -= row->y + row->height - max_y;
if (row->fringe_bitmap_periodic_p)
row->redraw_fringe_bitmaps_p = 1;
} }
} }
...@@ -1533,8 +1535,11 @@ row_equal_p (w, a, b, mouse_face_p) ...@@ -1533,8 +1535,11 @@ row_equal_p (w, a, b, mouse_face_p)
|| a->cursor_in_fringe_p != b->cursor_in_fringe_p || a->cursor_in_fringe_p != b->cursor_in_fringe_p
|| a->left_fringe_bitmap != b->left_fringe_bitmap || a->left_fringe_bitmap != b->left_fringe_bitmap
|| a->left_fringe_face_id != b->left_fringe_face_id || a->left_fringe_face_id != b->left_fringe_face_id
|| a->left_fringe_offset != b->left_fringe_offset
|| a->right_fringe_bitmap != b->right_fringe_bitmap || a->right_fringe_bitmap != b->right_fringe_bitmap
|| a->right_fringe_face_id != b->right_fringe_face_id || a->right_fringe_face_id != b->right_fringe_face_id
|| a->right_fringe_offset != b->right_fringe_offset
|| a->fringe_bitmap_periodic_p != b->fringe_bitmap_periodic_p
|| a->overlay_arrow_bitmap != b->overlay_arrow_bitmap || a->overlay_arrow_bitmap != b->overlay_arrow_bitmap
|| a->exact_window_width_line_p != b->exact_window_width_line_p || a->exact_window_width_line_p != b->exact_window_width_line_p
|| a->overlapped_p != b->overlapped_p || a->overlapped_p != b->overlapped_p
...@@ -5226,13 +5231,7 @@ scrolling_window (w, header_line_p) ...@@ -5226,13 +5231,7 @@ scrolling_window (w, header_line_p)
to = MATRIX_ROW (current_matrix, r->desired_vpos + j); to = MATRIX_ROW (current_matrix, r->desired_vpos + j);
from = MATRIX_ROW (desired_matrix, r->desired_vpos + j); from = MATRIX_ROW (desired_matrix, r->desired_vpos + j);
to_overlapped_p = to->overlapped_p; to_overlapped_p = to->overlapped_p;
if (!from->mode_line_p && !w->pseudo_window_p from->redraw_fringe_bitmaps_p = from->fringe_bitmap_periodic_p;
&& (to->left_fringe_bitmap != from->left_fringe_bitmap
|| to->right_fringe_bitmap != from->right_fringe_bitmap
|| to->left_fringe_face_id != from->left_fringe_face_id
|| to->right_fringe_face_id != from->right_fringe_face_id
|| to->overlay_arrow_bitmap != from->overlay_arrow_bitmap))
from->redraw_fringe_bitmaps_p = 1;
assign_row (to, from); assign_row (to, from);
to->enabled_p = 1, from->enabled_p = 0; to->enabled_p = 1, from->enabled_p = 0;
to->overlapped_p = to_overlapped_p; to->overlapped_p = to_overlapped_p;
......
...@@ -541,6 +541,20 @@ get_fringe_bitmap_name (bn) ...@@ -541,6 +541,20 @@ get_fringe_bitmap_name (bn)
return num; return num;
} }
/* Get fringe bitmap data for bitmap number BN. */
static struct fringe_bitmap *
get_fringe_bitmap_data (int bn)
{
struct fringe_bitmap *fb;
fb = fringe_bitmaps[bn];
if (fb == NULL)
fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS
? bn : UNDEF_FRINGE_BITMAP];
return fb;
}
/* Draw the bitmap WHICH in one of the left or right fringes of /* Draw the bitmap WHICH in one of the left or right fringes of
window W. ROW is the glyph row for which to display the bitmap; it window W. ROW is the glyph row for which to display the bitmap; it
...@@ -593,10 +607,7 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) ...@@ -593,10 +607,7 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
face_id = FRINGE_FACE_ID; face_id = FRINGE_FACE_ID;
} }
fb = fringe_bitmaps[which]; fb = get_fringe_bitmap_data (which);
if (fb == NULL)
fb = &standard_bitmaps[which < MAX_STANDARD_FRINGE_BITMAPS
? which : UNDEF_FRINGE_BITMAP];
period = fb->period; period = fb->period;
...@@ -1075,12 +1086,8 @@ update_window_fringes (w, keep_current_p) ...@@ -1075,12 +1086,8 @@ update_window_fringes (w, keep_current_p)
if (bn != NO_FRINGE_BITMAP) if (bn != NO_FRINGE_BITMAP)
{ {
struct fringe_bitmap *fb; struct fringe_bitmap *fb = get_fringe_bitmap_data (bn);
fb = fringe_bitmaps[bn];
if (fb == NULL)
fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS
? bn : UNDEF_FRINGE_BITMAP];
if (fb->align == ALIGN_BITMAP_TOP && fb->period == 0) if (fb->align == ALIGN_BITMAP_TOP && fb->period == 0)
{ {
struct glyph_row *row1; struct glyph_row *row1;
...@@ -1134,12 +1141,8 @@ update_window_fringes (w, keep_current_p) ...@@ -1134,12 +1141,8 @@ update_window_fringes (w, keep_current_p)
if (bn != NO_FRINGE_BITMAP) if (bn != NO_FRINGE_BITMAP)
{ {
struct fringe_bitmap *fb; struct fringe_bitmap *fb = get_fringe_bitmap_data (bn);
fb = fringe_bitmaps[bn];
if (fb == NULL)
fb = &standard_bitmaps[bn < MAX_STANDARD_FRINGE_BITMAPS
? bn : UNDEF_FRINGE_BITMAP];
if (fb->align == ALIGN_BITMAP_BOTTOM && fb->period == 0) if (fb->align == ALIGN_BITMAP_BOTTOM && fb->period == 0)
{ {
struct glyph_row *row1; struct glyph_row *row1;
...@@ -1175,6 +1178,7 @@ update_window_fringes (w, keep_current_p) ...@@ -1175,6 +1178,7 @@ update_window_fringes (w, keep_current_p)
int left, right; int left, right;
unsigned left_face_id, right_face_id; unsigned left_face_id, right_face_id;
int left_offset, right_offset; int left_offset, right_offset;
int periodic_p;
row = w->desired_matrix->rows + rn; row = w->desired_matrix->rows + rn;
cur = w->current_matrix->rows + rn; cur = w->current_matrix->rows + rn;
...@@ -1183,6 +1187,7 @@ update_window_fringes (w, keep_current_p) ...@@ -1183,6 +1187,7 @@ update_window_fringes (w, keep_current_p)
left_face_id = right_face_id = DEFAULT_FACE_ID; left_face_id = right_face_id = DEFAULT_FACE_ID;
left_offset = right_offset = 0; left_offset = right_offset = 0;
periodic_p = 0;
/* Decide which bitmap to draw in the left fringe. */ /* Decide which bitmap to draw in the left fringe. */
if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0) if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
...@@ -1270,6 +1275,9 @@ update_window_fringes (w, keep_current_p) ...@@ -1270,6 +1275,9 @@ update_window_fringes (w, keep_current_p)
else else
right = NO_FRINGE_BITMAP; right = NO_FRINGE_BITMAP;
periodic_p = (get_fringe_bitmap_data (left)->period != 0
|| get_fringe_bitmap_data (right)->period != 0);
if (row->y != cur->y if (row->y != cur->y
|| row->visible_height != cur->visible_height || row->visible_height != cur->visible_height
|| row->ends_at_zv_p != cur->ends_at_zv_p || row->ends_at_zv_p != cur->ends_at_zv_p
...@@ -1279,6 +1287,7 @@ update_window_fringes (w, keep_current_p) ...@@ -1279,6 +1287,7 @@ update_window_fringes (w, keep_current_p)
|| right_face_id != cur->right_fringe_face_id || right_face_id != cur->right_fringe_face_id
|| left_offset != cur->left_fringe_offset || left_offset != cur->left_fringe_offset
|| right_offset != cur->right_fringe_offset || right_offset != cur->right_fringe_offset
|| periodic_p != cur->fringe_bitmap_periodic_p
|| cur->redraw_fringe_bitmaps_p) || cur->redraw_fringe_bitmaps_p)
{ {
redraw_p = row->redraw_fringe_bitmaps_p = 1; redraw_p = row->redraw_fringe_bitmaps_p = 1;
...@@ -1291,6 +1300,7 @@ update_window_fringes (w, keep_current_p) ...@@ -1291,6 +1300,7 @@ update_window_fringes (w, keep_current_p)
cur->right_fringe_face_id = right_face_id; cur->right_fringe_face_id = right_face_id;
cur->left_fringe_offset = left_offset; cur->left_fringe_offset = left_offset;
cur->right_fringe_offset = right_offset; cur->right_fringe_offset = right_offset;
cur->fringe_bitmap_periodic_p = periodic_p;
} }
} }
...@@ -1309,6 +1319,7 @@ update_window_fringes (w, keep_current_p) ...@@ -1309,6 +1319,7 @@ update_window_fringes (w, keep_current_p)
row->right_fringe_face_id = right_face_id; row->right_fringe_face_id = right_face_id;
row->left_fringe_offset = left_offset; row->left_fringe_offset = left_offset;
row->right_fringe_offset = right_offset; row->right_fringe_offset = right_offset;
row->fringe_bitmap_periodic_p = periodic_p;
} }
return redraw_p && !keep_current_p; return redraw_p && !keep_current_p;
......
...@@ -14255,7 +14255,8 @@ try_window_reusing_current_matrix (w) ...@@ -14255,7 +14255,8 @@ try_window_reusing_current_matrix (w)
row->visible_height -= min_y - row->y; row->visible_height -= min_y - row->y;
if (row->y + row->height > max_y) if (row->y + row->height > max_y)
row->visible_height -= row->y + row->height - max_y; row->visible_height -= row->y + row->height - max_y;
row->redraw_fringe_bitmaps_p = 1; if (row->fringe_bitmap_periodic_p)
row->redraw_fringe_bitmaps_p = 1;
   
it.current_y += row->height; it.current_y += row->height;
   
...@@ -14417,7 +14418,8 @@ try_window_reusing_current_matrix (w) ...@@ -14417,7 +14418,8 @@ try_window_reusing_current_matrix (w)
row->visible_height -= min_y - row->y; row->visible_height -= min_y - row->y;
if (row->y + row->height > max_y) if (row->y + row->height > max_y)
row->visible_height -= row->y + row->height - max_y; row->visible_height -= row->y + row->height - max_y;
row->redraw_fringe_bitmaps_p = 1; if (row->fringe_bitmap_periodic_p)
row->redraw_fringe_bitmaps_p = 1;
} }
   
/* Scroll the current matrix. */ /* Scroll the current matrix. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment