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
window W. ROW is the glyph row for which to display the bitmap; it
face_id = FRINGE_FACE_ID;
}
- fb = fringe_bitmaps[which];
- if (fb == NULL)
- fb = &standard_bitmaps[which < MAX_STANDARD_FRINGE_BITMAPS
- ? which : UNDEF_FRINGE_BITMAP];
+ fb = get_fringe_bitmap_data (which);
period = fb->period;
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)
{
struct glyph_row *row1;
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)
{
struct glyph_row *row1;
int left, right;
unsigned left_face_id, right_face_id;
int left_offset, right_offset;
+ int periodic_p;
row = w->desired_matrix->rows + rn;
cur = w->current_matrix->rows + rn;
left_face_id = right_face_id = DEFAULT_FACE_ID;
left_offset = right_offset = 0;
+ periodic_p = 0;
/* Decide which bitmap to draw in the left fringe. */
if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
else
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
|| row->visible_height != cur->visible_height
|| row->ends_at_zv_p != cur->ends_at_zv_p
|| right_face_id != cur->right_fringe_face_id
|| left_offset != cur->left_fringe_offset
|| right_offset != cur->right_fringe_offset
+ || periodic_p != cur->fringe_bitmap_periodic_p
|| cur->redraw_fringe_bitmaps_p)
{
redraw_p = row->redraw_fringe_bitmaps_p = 1;
cur->right_fringe_face_id = right_face_id;
cur->left_fringe_offset = left_offset;
cur->right_fringe_offset = right_offset;
+ cur->fringe_bitmap_periodic_p = periodic_p;
}
}
if (row->overlay_arrow_bitmap != cur->overlay_arrow_bitmap)
{
- redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1;
- cur->overlay_arrow_bitmap = row->overlay_arrow_bitmap;
+ redraw_p = row->redraw_fringe_bitmaps_p = 1;
+ if (!keep_current_p)
+ {
+ cur->redraw_fringe_bitmaps_p = 1;
+ cur->overlay_arrow_bitmap = row->overlay_arrow_bitmap;
+ }
}
row->left_fringe_bitmap = left;
row->right_fringe_face_id = right_face_id;
row->left_fringe_offset = left_offset;
row->right_fringe_offset = right_offset;
+ row->fringe_bitmap_periodic_p = periodic_p;
}
return redraw_p && !keep_current_p;
if (STRINGP (bits))
h = SCHARS (bits);
else if (VECTORP (bits))
- h = XVECTOR (bits)->size;
+ h = ASIZE (bits);
else
wrong_type_argument (Qsequencep, bits);
if (n == max_fringe_bitmaps)
{
- if ((max_fringe_bitmaps + 20) > MAX_FRINGE_BITMAPS)
+ int bitmaps = max_fringe_bitmaps + 20;
+ if (MAX_FRINGE_BITMAPS < bitmaps)
error ("No free fringe bitmap slots");
i = max_fringe_bitmaps;
- max_fringe_bitmaps += 20;
fringe_bitmaps
= ((struct fringe_bitmap **)
- xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *)));
+ xrealloc (fringe_bitmaps, bitmaps * sizeof *fringe_bitmaps));
fringe_faces
- = (Lisp_Object *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (Lisp_Object));
+ = (Lisp_Object *) xrealloc (fringe_faces,
+ bitmaps * sizeof *fringe_faces);
- for (; i < max_fringe_bitmaps; i++)
+ for (i = max_fringe_bitmaps; i < bitmaps; i++)
{
fringe_bitmaps[i] = NULL;
fringe_faces[i] = Qnil;
}
+
+ max_fringe_bitmaps = bitmaps;
}
}
void
syms_of_fringe (void)
{
- Qtruncation = intern_c_string ("truncation");
- staticpro (&Qtruncation);
- Qcontinuation = intern_c_string ("continuation");
- staticpro (&Qcontinuation);
- Qoverlay_arrow = intern_c_string ("overlay-arrow");
- staticpro (&Qoverlay_arrow);
- Qempty_line = intern_c_string ("empty-line");
- staticpro (&Qempty_line);
- Qtop_bottom = intern_c_string ("top-bottom");
- staticpro (&Qtop_bottom);
- Qhollow_small = intern_c_string ("hollow-small");
- staticpro (&Qhollow_small);
+ DEFSYM (Qtruncation, "truncation");
+ DEFSYM (Qcontinuation, "continuation");
+ DEFSYM (Qoverlay_arrow, "overlay-arrow");
+ DEFSYM (Qempty_line, "empty-line");
+ DEFSYM (Qtop_bottom, "top-bottom");
+ DEFSYM (Qhollow_small, "hollow-small");
defsubr (&Sdestroy_fringe_bitmap);
defsubr (&Sdefine_fringe_bitmap);