comparison src/redisplay-x.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents e121b013d1f0
children acd284d43ca1
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
261 x_text_width (struct face_cachel *cachel, CONST Emchar *str, 261 x_text_width (struct face_cachel *cachel, CONST Emchar *str,
262 Charcount len) 262 Charcount len)
263 { 263 {
264 int width_so_far = 0; 264 int width_so_far = 0;
265 unsigned char *text_storage = (unsigned char *) alloca (2 * len); 265 unsigned char *text_storage = (unsigned char *) alloca (2 * len);
266 struct textual_run *runs = 266 struct textual_run *runs = alloca_array (struct textual_run, len);
267 (struct textual_run *) alloca (len * sizeof (struct textual_run));
268 int nruns; 267 int nruns;
269 int i; 268 int i;
270 269
271 nruns = separate_textual_runs (text_storage, runs, str, len); 270 nruns = separate_textual_runs (text_storage, runs, str, len);
272 271
347 x_output_display_block (struct window *w, struct display_line *dl, int block, 346 x_output_display_block (struct window *w, struct display_line *dl, int block,
348 int start, int end, int start_pixpos, int cursor_start, 347 int start, int end, int start_pixpos, int cursor_start,
349 int cursor_width, int cursor_height) 348 int cursor_width, int cursor_height)
350 { 349 {
351 struct frame *f = XFRAME (w->frame); 350 struct frame *f = XFRAME (w->frame);
352 emchar_dynarr *buf = Dynarr_new (Emchar); 351 Emchar_dynarr *buf = Dynarr_new (Emchar);
353 Lisp_Object window; 352 Lisp_Object window;
354 353
355 struct display_block *db = Dynarr_atp (dl->display_blocks, block); 354 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
356 rune_dynarr *rba = db->runes; 355 rune_dynarr *rba = db->runes;
357 struct rune *rb; 356 struct rune *rb;
776 Starting Y position of cursor is the top of the text line. 775 Starting Y position of cursor is the top of the text line.
777 The cursor is drawn sometimes whether or not CURSOR is set. ??? 776 The cursor is drawn sometimes whether or not CURSOR is set. ???
778 ****************************************************************************/ 777 ****************************************************************************/
779 void 778 void
780 x_output_string (struct window *w, struct display_line *dl, 779 x_output_string (struct window *w, struct display_line *dl,
781 emchar_dynarr *buf, int xpos, int xoffset, int clip_start, 780 Emchar_dynarr *buf, int xpos, int xoffset, int clip_start,
782 int width, face_index findex, int cursor, 781 int width, face_index findex, int cursor,
783 int cursor_start, int cursor_width, int cursor_height) 782 int cursor_start, int cursor_width, int cursor_height)
784 { 783 {
785 /* General variables */ 784 /* General variables */
786 struct frame *f = XFRAME (w->frame); 785 struct frame *f = XFRAME (w->frame);
802 /* Text-related variables */ 801 /* Text-related variables */
803 Lisp_Object bg_pmap; 802 Lisp_Object bg_pmap;
804 GC bgc, gc; 803 GC bgc, gc;
805 int height; 804 int height;
806 int len = Dynarr_length (buf); 805 int len = Dynarr_length (buf);
807 unsigned char *text_storage = alloca (2 * len); 806 unsigned char *text_storage = (unsigned char *) alloca (2 * len);
808 struct textual_run *runs = alloca (len * sizeof (struct textual_run)); 807 struct textual_run *runs = alloca_array (struct textual_run, len);
809 int nruns; 808 int nruns;
810 int i; 809 int i;
811 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex); 810 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
812 811
813 XSETDEVICE (device, d); 812 XSETDEVICE (device, d);
1705 DefaultColormapOfScreen (XtScreen ((Widget) FRAME_X_TEXT_WIDGET (f))); 1704 DefaultColormapOfScreen (XtScreen ((Widget) FRAME_X_TEXT_WIDGET (f)));
1706 1705
1707 XColor topc, botc; 1706 XColor topc, botc;
1708 int top_frobbed = 0, bottom_frobbed = 0; 1707 int top_frobbed = 0, bottom_frobbed = 0;
1709 1708
1710 /* If the top shadow is the same color as the background, try and 1709 /* If the top shadow is the same color as the background, try to
1711 adjust it. */ 1710 adjust it. */
1712 if (*top_shadow == background) 1711 if (*top_shadow == background)
1713 { 1712 {
1714 topc.pixel = background; 1713 topc.pixel = background;
1715 XQueryColor (dpy, cmap, &topc); 1714 XQueryColor (dpy, cmap, &topc);
1716 /* don't overflow/wrap! */ 1715 /* don't overflow/wrap! */
1717 topc.red = MINL (65535, topc.red * 1.2); 1716 topc.red = MINL (65535, (unsigned long) topc.red * 6 / 5);
1718 topc.green = MINL (65535, topc.green * 1.2); 1717 topc.green = MINL (65535, (unsigned long) topc.green * 6 / 5);
1719 topc.blue = MINL (65535, topc.blue * 1.2); 1718 topc.blue = MINL (65535, (unsigned long) topc.blue * 6 / 5);
1720 if (allocate_nearest_color (dpy, cmap, &topc)) 1719 if (allocate_nearest_color (dpy, cmap, &topc))
1721 { 1720 {
1722 *top_shadow = topc.pixel; 1721 *top_shadow = topc.pixel;
1723 top_frobbed = 1; 1722 top_frobbed = 1;
1724 } 1723 }
1725 } 1724 }
1726 1725
1727 /* If the bottom shadow is the same color as the background, try and 1726 /* If the bottom shadow is the same color as the background, try to
1728 adjust it. */ 1727 adjust it. */
1729 if (*bottom_shadow == background) 1728 if (*bottom_shadow == background)
1730 { 1729 {
1731 botc.pixel = background; 1730 botc.pixel = background;
1732 XQueryColor (dpy, cmap, &botc); 1731 XQueryColor (dpy, cmap, &botc);
1733 botc.red *= 0.6; 1732 botc.red = (unsigned short) ((unsigned long) botc.red * 3 / 5);
1734 botc.green *= 0.6; 1733 botc.green = (unsigned short) ((unsigned long) botc.green * 3 / 5);
1735 botc.blue *= 0.6; 1734 botc.blue = (unsigned short) ((unsigned long) botc.blue * 3 / 5);
1736 if (allocate_nearest_color (dpy, cmap, &botc)) 1735 if (allocate_nearest_color (dpy, cmap, &botc))
1737 { 1736 {
1738 *bottom_shadow = botc.pixel; 1737 *bottom_shadow = botc.pixel;
1739 bottom_frobbed = 1; 1738 bottom_frobbed = 1;
1740 } 1739 }