aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2006-02-20 11:16:28 +0000
committerKenichi Handa2006-02-20 11:16:28 +0000
commit1dc6c31bccef935143f550c5fcded912d2495608 (patch)
treeec128355f4ea20160c3700098c6e39519bace7a5 /src
parent178669286b9d1ace54157e20223a691c6f39097f (diff)
downloademacs-1dc6c31bccef935143f550c5fcded912d2495608.tar.gz
emacs-1dc6c31bccef935143f550c5fcded912d2495608.zip
(x_draw_glyph_string): Fix previous change for the case of overhang
strinding over multiple glyphs.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c77
1 files changed, 49 insertions, 28 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 9dfd5a56241..a7f739f7ca9 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2625,15 +2625,22 @@ x_draw_glyph_string (s)
2625{ 2625{
2626 int relief_drawn_p = 0; 2626 int relief_drawn_p = 0;
2627 2627
2628 /* If S draws into the background of its successor, draw the 2628 /* If S draws into the background of its successors, draw the
2629 background of the successor first so that S can draw into it. 2629 background of the successors first so that S can draw into it.
2630 This makes S->next use XDrawString instead of XDrawImageString. */ 2630 This makes S->next use XDrawString instead of XDrawImageString. */
2631 if (s->next && s->right_overhang && !s->for_overlaps) 2631 if (s->next && s->right_overhang && !s->for_overlaps)
2632 { 2632 {
2633 xassert (s->next->img == NULL); 2633 int width;
2634 x_set_glyph_string_gc (s->next); 2634 struct glyph_string *next;
2635 x_set_glyph_string_clipping (s->next); 2635
2636 x_draw_glyph_string_background (s->next, 1); 2636 for (width = 0, next = s->next; next;
2637 width += next->width, next = next->next)
2638 if (next->first_glyph->type != IMAGE_GLYPH)
2639 {
2640 x_set_glyph_string_gc (next);
2641 x_set_glyph_string_clipping (next);
2642 x_draw_glyph_string_background (next, 1);
2643 }
2637 } 2644 }
2638 2645
2639 /* Set up S->gc, set clipping and draw S. */ 2646 /* Set up S->gc, set clipping and draw S. */
@@ -2777,32 +2784,46 @@ x_draw_glyph_string (s)
2777 if (!relief_drawn_p && s->face->box != FACE_NO_BOX) 2784 if (!relief_drawn_p && s->face->box != FACE_NO_BOX)
2778 x_draw_glyph_string_box (s); 2785 x_draw_glyph_string_box (s);
2779 2786
2780 if (s->prev && s->prev->right_overhang && s->prev->hl != s->hl) 2787 if (s->prev)
2781 { 2788 {
2782 /* As s->prev was drawn while clipped to its own area, we 2789 struct glyph_string *prev;
2783 must draw the right_overhang part using to s->hl now. */ 2790
2784 enum draw_glyphs_face save = s->prev->hl; 2791 for (prev = s->prev; prev; prev = prev->prev)
2785 2792 if (prev->hl != s->hl
2786 s->prev->hl = s->hl; 2793 && prev->x + prev->width + prev->right_overhang > s->x)
2787 x_set_glyph_string_gc (s->prev); 2794 {
2788 x_set_glyph_string_clipping_exactly (s, s->prev); 2795 /* As prev was drawn while clipped to its own area, we
2789 x_draw_glyph_string_foreground (s->prev); 2796 must draw the right_overhang part using s->hl now. */
2790 XSetClipMask (s->prev->display, s->prev->gc, None); 2797 enum draw_glyphs_face save = prev->hl;
2791 s->prev->hl = save; 2798
2799 prev->hl = s->hl;
2800 x_set_glyph_string_gc (prev);
2801 x_set_glyph_string_clipping_exactly (s, prev);
2802 x_draw_glyph_string_foreground (prev);
2803 XSetClipMask (prev->display, prev->gc, None);
2804 prev->hl = save;
2805 }
2792 } 2806 }
2793 2807
2794 if (s->next && s->next->left_overhang && s->next->hl != s->hl) 2808 if (s->next)
2795 { 2809 {
2796 /* As s->next will be drawn while clipped to its own area, 2810 struct glyph_string *next;
2797 we must draw the left_overhang part using s->hl now. */ 2811
2798 enum draw_glyphs_face save = s->next->hl; 2812 for (next = s->next; next; next = next->next)
2799 2813 if (next->hl != s->hl
2800 s->next->hl = s->hl; 2814 && next->x - next->left_overhang && s->next->hl != s->hl)
2801 x_set_glyph_string_gc (s->next); 2815 {
2802 x_set_glyph_string_clipping_exactly (s, s->next); 2816 /* As next will be drawn while clipped to its own area,
2803 x_draw_glyph_string_foreground (s->next); 2817 we must draw the left_overhang part using s->hl now. */
2804 XSetClipMask (s->next->display, s->next->gc, None); 2818 enum draw_glyphs_face save = next->hl;
2805 s->next->hl = save; 2819
2820 next->hl = s->hl;
2821 x_set_glyph_string_gc (next);
2822 x_set_glyph_string_clipping_exactly (s, next);
2823 x_draw_glyph_string_foreground (next);
2824 XSetClipMask (next->display, next->gc, None);
2825 next->hl = save;
2826 }
2806 } 2827 }
2807 } 2828 }
2808 2829