comparison src/xdisp.c @ 59718:d4cb255b034d

* dispextern.h (struct glyph_string): New members clip_head and clip_tail. * xdisp.c (get_glyph_string_clip_rect): Restrict horizontal clip region to the area between clip_head and clip_tail. (draw_glyphs): Record the area that need to be actually redrawn to the new variables clip_head and clip_tail when there are overhangs. Set values of these variables to the corresponding members in struct glyph_string. Refine x coordinates for * macgui.h (STORE_XCHARSETSTRUCT): New macro. * macterm.c (mac_compute_glyph_string_overhangs): Implement with QDTextBounds. (x_draw_glyph_string): Don't fill the background of the successor of a glyph with a right overhang if the successor will draw a cursor. (XLoadQueryFont): Obtain font metrics using QDTextBounds. (x_redisplay_interface): Add entry for compute_glyph_string_overhangs.
author Steven Tamm <steventamm@mac.com>
date Mon, 24 Jan 2005 17:59:36 +0000
parents 67ba31b1d2cc
children 4712d3f43248
comparison
equal deleted inserted replaced
59717:351ffb20ab9f 59718:d4cb255b034d
1784 r.x = window_box_left (s->w, s->area); 1784 r.x = window_box_left (s->w, s->area);
1785 r.width = window_box_width (s->w, s->area); 1785 r.width = window_box_width (s->w, s->area);
1786 r.height = s->row->visible_height; 1786 r.height = s->row->visible_height;
1787 } 1787 }
1788 1788
1789 if (s->clip_head)
1790 if (r.x < s->clip_head->x)
1791 {
1792 if (r.width >= s->clip_head->x - r.x)
1793 r.width -= s->clip_head->x - r.x;
1794 else
1795 r.width = 0;
1796 r.x = s->clip_head->x;
1797 }
1798 if (s->clip_tail)
1799 if (r.x + r.width > s->clip_tail->x + s->clip_tail->background_width)
1800 {
1801 if (s->clip_tail->x + s->clip_tail->background_width >= r.x)
1802 r.width = s->clip_tail->x + s->clip_tail->background_width - r.x;
1803 else
1804 r.width = 0;
1805 }
1806
1789 /* If S draws overlapping rows, it's sufficient to use the top and 1807 /* If S draws overlapping rows, it's sufficient to use the top and
1790 bottom of the window for clipping because this glyph string 1808 bottom of the window for clipping because this glyph string
1791 intentionally draws over other lines. */ 1809 intentionally draws over other lines. */
1792 if (s->for_overlaps_p) 1810 if (s->for_overlaps_p)
1793 { 1811 {
18231 enum draw_glyphs_face hl; 18249 enum draw_glyphs_face hl;
18232 int overlaps_p; 18250 int overlaps_p;
18233 { 18251 {
18234 struct glyph_string *head, *tail; 18252 struct glyph_string *head, *tail;
18235 struct glyph_string *s; 18253 struct glyph_string *s;
18254 struct glyph_string *clip_head = NULL, *clip_tail = NULL;
18236 int last_x, area_width; 18255 int last_x, area_width;
18237 int x_reached; 18256 int x_reached;
18238 int i, j; 18257 int i, j;
18239 struct frame *f = XFRAME (WINDOW_FRAME (w)); 18258 struct frame *f = XFRAME (WINDOW_FRAME (w));
18240 DECLARE_HDC (hdc); 18259 DECLARE_HDC (hdc);
18299 BUILD_GLYPH_STRINGS (j, start, h, t, 18318 BUILD_GLYPH_STRINGS (j, start, h, t,
18300 DRAW_NORMAL_TEXT, dummy_x, last_x); 18319 DRAW_NORMAL_TEXT, dummy_x, last_x);
18301 start = i; 18320 start = i;
18302 compute_overhangs_and_x (t, head->x, 1); 18321 compute_overhangs_and_x (t, head->x, 1);
18303 prepend_glyph_string_lists (&head, &tail, h, t); 18322 prepend_glyph_string_lists (&head, &tail, h, t);
18323 clip_head = head;
18304 } 18324 }
18305 18325
18306 /* Prepend glyph strings for glyphs in front of the first glyph 18326 /* Prepend glyph strings for glyphs in front of the first glyph
18307 string that overwrite that glyph string because of their 18327 string that overwrite that glyph string because of their
18308 right overhang. For these strings, only the foreground must 18328 right overhang. For these strings, only the foreground must
18311 right overhangs of preceding glyphs for which no glyph 18331 right overhangs of preceding glyphs for which no glyph
18312 strings exist. */ 18332 strings exist. */
18313 i = left_overwriting (head); 18333 i = left_overwriting (head);
18314 if (i >= 0) 18334 if (i >= 0)
18315 { 18335 {
18336 clip_head = head;
18316 BUILD_GLYPH_STRINGS (i, start, h, t, 18337 BUILD_GLYPH_STRINGS (i, start, h, t,
18317 DRAW_NORMAL_TEXT, dummy_x, last_x); 18338 DRAW_NORMAL_TEXT, dummy_x, last_x);
18318 for (s = h; s; s = s->next) 18339 for (s = h; s; s = s->next)
18319 s->background_filled_p = 1; 18340 s->background_filled_p = 1;
18320 compute_overhangs_and_x (t, head->x, 1); 18341 compute_overhangs_and_x (t, head->x, 1);
18330 { 18351 {
18331 BUILD_GLYPH_STRINGS (end, i, h, t, 18352 BUILD_GLYPH_STRINGS (end, i, h, t,
18332 DRAW_NORMAL_TEXT, x, last_x); 18353 DRAW_NORMAL_TEXT, x, last_x);
18333 compute_overhangs_and_x (h, tail->x + tail->width, 0); 18354 compute_overhangs_and_x (h, tail->x + tail->width, 0);
18334 append_glyph_string_lists (&head, &tail, h, t); 18355 append_glyph_string_lists (&head, &tail, h, t);
18356 clip_tail = tail;
18335 } 18357 }
18336 18358
18337 /* Append glyph strings for glyphs following the last glyph 18359 /* Append glyph strings for glyphs following the last glyph
18338 string tail that overwrite tail. The foreground of such 18360 string tail that overwrite tail. The foreground of such
18339 glyphs has to be drawn because it writes into the background 18361 glyphs has to be drawn because it writes into the background
18340 of tail. The background must not be drawn because it could 18362 of tail. The background must not be drawn because it could
18341 paint over the foreground of following glyphs. */ 18363 paint over the foreground of following glyphs. */
18342 i = right_overwriting (tail); 18364 i = right_overwriting (tail);
18343 if (i >= 0) 18365 if (i >= 0)
18344 { 18366 {
18367 clip_tail = tail;
18345 BUILD_GLYPH_STRINGS (end, i, h, t, 18368 BUILD_GLYPH_STRINGS (end, i, h, t,
18346 DRAW_NORMAL_TEXT, x, last_x); 18369 DRAW_NORMAL_TEXT, x, last_x);
18347 for (s = h; s; s = s->next) 18370 for (s = h; s; s = s->next)
18348 s->background_filled_p = 1; 18371 s->background_filled_p = 1;
18349 compute_overhangs_and_x (h, tail->x + tail->width, 0); 18372 compute_overhangs_and_x (h, tail->x + tail->width, 0);
18350 append_glyph_string_lists (&head, &tail, h, t); 18373 append_glyph_string_lists (&head, &tail, h, t);
18351 } 18374 }
18375 if (clip_head || clip_tail)
18376 for (s = head; s; s = s->next)
18377 {
18378 s->clip_head = clip_head;
18379 s->clip_tail = clip_tail;
18380 }
18352 } 18381 }
18353 18382
18354 /* Draw all strings. */ 18383 /* Draw all strings. */
18355 for (s = head; s; s = s->next) 18384 for (s = head; s; s = s->next)
18356 rif->draw_glyph_string (s); 18385 rif->draw_glyph_string (s);
18360 /* When drawing overlapping rows, only the glyph strings' 18389 /* When drawing overlapping rows, only the glyph strings'
18361 foreground is drawn, which doesn't erase a cursor 18390 foreground is drawn, which doesn't erase a cursor
18362 completely. */ 18391 completely. */
18363 && !overlaps_p) 18392 && !overlaps_p)
18364 { 18393 {
18365 int x0 = head ? head->x : x; 18394 int x0 = clip_head ? clip_head->x : (head ? head->x : x);
18366 int x1 = tail ? tail->x + tail->background_width : x; 18395 int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width
18396 : (tail ? tail->x + tail->background_width : x));
18367 18397
18368 int text_left = window_box_left (w, TEXT_AREA); 18398 int text_left = window_box_left (w, TEXT_AREA);
18369 x0 -= text_left; 18399 x0 -= text_left;
18370 x1 -= text_left; 18400 x1 -= text_left;
18371 18401