Mercurial > hg > xemacs-beta
comparison src/glyphs.c @ 5178:97eb4942aec8
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Mon, 29 Mar 2010 21:28:13 -0500 |
parents | 8b2f75cecb89 1fae11d56ad2 |
children | 71ee43b8a74d |
comparison
equal
deleted
inserted
replaced
5177:b785049378e3 | 5178:97eb4942aec8 |
---|---|
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois | 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois |
3 Copyright (C) 1995 Tinker Systems | 3 Copyright (C) 1995 Tinker Systems |
4 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2004, 2005 Ben Wing | 4 Copyright (C) 1995, 1996, 2000, 2001, 2002, 2004, 2005 Ben Wing |
5 Copyright (C) 1995 Sun Microsystems | 5 Copyright (C) 1995 Sun Microsystems |
6 Copyright (C) 1998, 1999, 2000 Andy Piper | 6 Copyright (C) 1998, 1999, 2000 Andy Piper |
7 Copyright (C) 2007 Didier Verna | 7 Copyright (C) 2007, 2010 Didier Verna |
8 | 8 |
9 This file is part of XEmacs. | 9 This file is part of XEmacs. |
10 | 10 |
11 XEmacs is free software; you can redistribute it and/or modify it | 11 XEmacs is free software; you can redistribute it and/or modify it |
12 under the terms of the GNU General Public License as published by the | 12 under the terms of the GNU General Public License as published by the |
990 int escapeflag) | 990 int escapeflag) |
991 { | 991 { |
992 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (obj); | 992 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (obj); |
993 | 993 |
994 if (print_readably) | 994 if (print_readably) |
995 printing_unreadable_lcrecord (obj, 0); | 995 printing_unreadable_lisp_object (obj, 0); |
996 write_fmt_string_lisp (printcharfun, "#<image-instance (%s) ", 1, | 996 write_fmt_string_lisp (printcharfun, "#<image-instance (%s) ", 1, |
997 Fimage_instance_type (obj)); | 997 Fimage_instance_type (obj)); |
998 if (!NILP (ii->name)) | 998 if (!NILP (ii->name)) |
999 write_fmt_string_lisp (printcharfun, "%S ", 1, ii->name); | 999 write_fmt_string_lisp (printcharfun, "%S ", 1, ii->name); |
1000 write_fmt_string_lisp (printcharfun, "on %s ", 1, ii->domain); | 1000 write_fmt_string_lisp (printcharfun, "on %s ", 1, ii->domain); |
1106 ABORT (); | 1106 ABORT (); |
1107 } | 1107 } |
1108 | 1108 |
1109 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), print_image_instance, | 1109 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), print_image_instance, |
1110 (ii, printcharfun, escapeflag)); | 1110 (ii, printcharfun, escapeflag)); |
1111 write_fmt_string (printcharfun, " 0x%x>", ii->header.uid); | 1111 write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj)); |
1112 } | 1112 } |
1113 | 1113 |
1114 static void | 1114 static void |
1115 finalize_image_instance (void *header, int for_disksave) | 1115 finalize_image_instance (Lisp_Object obj) |
1116 { | 1116 { |
1117 Lisp_Image_Instance *i = (Lisp_Image_Instance *) header; | 1117 Lisp_Image_Instance *i = XIMAGE_INSTANCE (obj); |
1118 | 1118 |
1119 /* objects like this exist at dump time, so don't bomb out. */ | 1119 /* objects like this exist at dump time, so don't bomb out. */ |
1120 if (IMAGE_INSTANCE_TYPE (i) == IMAGE_NOTHING | 1120 if (IMAGE_INSTANCE_TYPE (i) == IMAGE_NOTHING |
1121 || | 1121 || |
1122 NILP (IMAGE_INSTANCE_DEVICE (i))) | 1122 NILP (IMAGE_INSTANCE_DEVICE (i))) |
1123 return; | 1123 return; |
1124 if (for_disksave) finalose (i); | |
1125 | 1124 |
1126 /* We can't use the domain here, because it might have | 1125 /* We can't use the domain here, because it might have |
1127 disappeared. */ | 1126 disappeared. */ |
1128 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (i)), | 1127 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (i)), |
1129 finalize_image_instance, (i)); | 1128 finalize_image_instance, (i)); |
1312 (XDEVICE (image_instance_device (obj)), | 1311 (XDEVICE (image_instance_device (obj)), |
1313 image_instance_hash, (i, depth), | 1312 image_instance_hash, (i, depth), |
1314 0)); | 1313 0)); |
1315 } | 1314 } |
1316 | 1315 |
1317 DEFINE_LRECORD_IMPLEMENTATION ("image-instance", image_instance, | 1316 DEFINE_NODUMP_LISP_OBJECT ("image-instance", image_instance, |
1318 0, /*dumpable-flag*/ | 1317 mark_image_instance, print_image_instance, |
1319 mark_image_instance, print_image_instance, | 1318 finalize_image_instance, image_instance_equal, |
1320 finalize_image_instance, image_instance_equal, | 1319 image_instance_hash, |
1321 image_instance_hash, | 1320 image_instance_description, |
1322 image_instance_description, | 1321 Lisp_Image_Instance); |
1323 Lisp_Image_Instance); | |
1324 | 1322 |
1325 static Lisp_Object | 1323 static Lisp_Object |
1326 allocate_image_instance (Lisp_Object governing_domain, Lisp_Object parent, | 1324 allocate_image_instance (Lisp_Object governing_domain, Lisp_Object parent, |
1327 Lisp_Object instantiator) | 1325 Lisp_Object instantiator) |
1328 { | 1326 { |
1329 Lisp_Image_Instance *lp = | 1327 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (image_instance); |
1330 ALLOC_LCRECORD_TYPE (Lisp_Image_Instance, &lrecord_image_instance); | 1328 Lisp_Image_Instance *lp = XIMAGE_INSTANCE (obj); |
1331 Lisp_Object val; | |
1332 | 1329 |
1333 /* It's not possible to simply keep a record of the domain in which | 1330 /* It's not possible to simply keep a record of the domain in which |
1334 the instance was instantiated. This is because caching may mean | 1331 the instance was instantiated. This is because caching may mean |
1335 that the domain becomes invalid but the instance remains | 1332 that the domain becomes invalid but the instance remains |
1336 valid. However, the only truly relevant domain is the domain in | 1333 valid. However, the only truly relevant domain is the domain in |
1349 lp->parent = parent; | 1346 lp->parent = parent; |
1350 lp->instantiator = instantiator; | 1347 lp->instantiator = instantiator; |
1351 /* So that layouts get done. */ | 1348 /* So that layouts get done. */ |
1352 lp->layout_changed = 1; | 1349 lp->layout_changed = 1; |
1353 | 1350 |
1354 val = wrap_image_instance (lp); | |
1355 MARK_GLYPHS_CHANGED; | 1351 MARK_GLYPHS_CHANGED; |
1356 | 1352 |
1357 return val; | 1353 return obj; |
1358 } | 1354 } |
1359 | 1355 |
1360 static enum image_instance_type | 1356 static enum image_instance_type |
1361 decode_image_instance_type (Lisp_Object type, Error_Behavior errb) | 1357 decode_image_instance_type (Lisp_Object type, Error_Behavior errb) |
1362 { | 1358 { |
1992 | 1988 |
1993 /* #### There should be a copy_image_instance(), which calls a | 1989 /* #### There should be a copy_image_instance(), which calls a |
1994 device-specific method to copy the window-system subobject. */ | 1990 device-specific method to copy the window-system subobject. */ |
1995 new_ = allocate_image_instance (XIMAGE_INSTANCE_DOMAIN (image_instance), | 1991 new_ = allocate_image_instance (XIMAGE_INSTANCE_DOMAIN (image_instance), |
1996 Qnil, Qnil); | 1992 Qnil, Qnil); |
1997 COPY_LCRECORD (XIMAGE_INSTANCE (new_), XIMAGE_INSTANCE (image_instance)); | 1993 copy_lisp_object (new_, image_instance); |
1998 /* note that if this method returns non-zero, this method MUST | 1994 /* note that if this method returns non-zero, this method MUST |
1999 copy any window-system resources, so that when one image instance is | 1995 copy any window-system resources, so that when one image instance is |
2000 freed, the other one is not hosed. */ | 1996 freed, the other one is not hosed. */ |
2001 if (!DEVMETH (XDEVICE (device), colorize_image_instance, (new_, foreground, | 1997 if (!DEVMETH (XDEVICE (device), colorize_image_instance, (new_, foreground, |
2002 background))) | 1998 background))) |
2519 | 2515 |
2520 /************************************************************************/ | 2516 /************************************************************************/ |
2521 /* pixmap file functions */ | 2517 /* pixmap file functions */ |
2522 /************************************************************************/ | 2518 /************************************************************************/ |
2523 | 2519 |
2524 /* If INSTANTIATOR refers to inline data, return Qt. | 2520 /* - If INSTANTIATOR refers to inline data, or there is no file keyword, we |
2525 If INSTANTIATOR refers to data in a file, return the full filename | 2521 have nothing to do, so return Qt. |
2526 if it exists, Qnil if there's no console method for locating the file, or | 2522 - If INSTANTIATOR refers to data in a file, return the full filename |
2527 (filename) if there was an error locating the file. | 2523 if it exists; otherwise, return '(filename), meaning "file not found". |
2524 - If there is no locate_pixmap_file method for this console, return Qnil. | |
2528 | 2525 |
2529 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the | 2526 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the |
2530 keywords used to look up the file and inline data, | 2527 keywords used to look up the file and inline data, |
2531 respectively, in the instantiator. Normally these would | 2528 respectively, in the instantiator. These would be Q_file and Q_data, |
2532 be Q_file and Q_data, but might be different for mask data. */ | 2529 Q_mask_file or Q_mask_data. */ |
2533 | 2530 |
2534 Lisp_Object | 2531 Lisp_Object |
2535 potential_pixmap_file_instantiator (Lisp_Object instantiator, | 2532 potential_pixmap_file_instantiator (Lisp_Object instantiator, |
2536 Lisp_Object file_keyword, | 2533 Lisp_Object file_keyword, |
2537 Lisp_Object data_keyword, | 2534 Lisp_Object data_keyword, |
2734 } | 2731 } |
2735 | 2732 |
2736 return Qnil; /* not reached */ | 2733 return Qnil; /* not reached */ |
2737 } | 2734 } |
2738 | 2735 |
2736 /* This function attempts to find implicit mask files by appending "Mask" or | |
2737 "msk" to the original bitmap file name. This is more or less standard: a | |
2738 number of bitmaps in /usr/include/X11/bitmaps use it. */ | |
2739 Lisp_Object | 2739 Lisp_Object |
2740 xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file, | 2740 xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file, |
2741 Lisp_Object mask_file, Lisp_Object console_type) | 2741 Lisp_Object mask_file, Lisp_Object console_type) |
2742 { | 2742 { |
2743 /* This is unclean but it's fairly standard -- a number of the | 2743 /* Let's try to find an implicit mask file if we have neither an explicit |
2744 bitmaps in /usr/include/X11/bitmaps use it -- so we support | 2744 mask file name, nor inline mask data. Note that no errors are reported in |
2745 it. */ | 2745 case of failure because the mask file we're looking for might not |
2746 if (EQ (mask_file, Qt) | 2746 exist. */ |
2747 /* don't override explicitly specified mask data. */ | 2747 if (EQ (mask_file, Qt) && NILP (assq_no_quit (Q_mask_data, alist))) |
2748 && NILP (assq_no_quit (Q_mask_data, alist)) | 2748 { |
2749 && !EQ (file, Qt)) | 2749 assert (!EQ (file, Qt) && !EQ (file, Qnil)); |
2750 { | |
2751 mask_file = MAYBE_LISP_CONTYPE_METH | 2750 mask_file = MAYBE_LISP_CONTYPE_METH |
2752 (decode_console_type(console_type, ERROR_ME), | 2751 (decode_console_type(console_type, ERROR_ME), |
2753 locate_pixmap_file, (concat2 (file, build_ascstring ("Mask")))); | 2752 locate_pixmap_file, (concat2 (file, build_ascstring ("Mask")))); |
2754 if (NILP (mask_file)) | 2753 if (NILP (mask_file)) |
2755 mask_file = MAYBE_LISP_CONTYPE_METH | 2754 mask_file = MAYBE_LISP_CONTYPE_METH |
2756 (decode_console_type(console_type, ERROR_ME), | 2755 (decode_console_type(console_type, ERROR_ME), |
2757 locate_pixmap_file, (concat2 (file, build_ascstring ("msk")))); | 2756 locate_pixmap_file, (concat2 (file, build_ascstring ("msk")))); |
2758 } | 2757 } |
2759 | 2758 |
2759 /* We got a mask file, either explicitely or from the search above. */ | |
2760 if (!NILP (mask_file)) | 2760 if (!NILP (mask_file)) |
2761 { | 2761 { |
2762 Lisp_Object mask_data = | 2762 Lisp_Object mask_data; |
2763 bitmap_to_lisp_data (mask_file, 0, 0, 0); | 2763 |
2764 assert (!EQ (mask_file, Qt)); | |
2765 | |
2766 mask_data = bitmap_to_lisp_data (mask_file, 0, 0, 0); | |
2764 alist = remassq_no_quit (Q_mask_file, alist); | 2767 alist = remassq_no_quit (Q_mask_file, alist); |
2765 /* there can't be a :mask-data at this point. */ | 2768 /* there can't be a :mask-data at this point. */ |
2766 alist = Fcons (Fcons (Q_mask_file, mask_file), | 2769 alist = Fcons (Fcons (Q_mask_file, mask_file), |
2767 Fcons (Fcons (Q_mask_data, mask_data), alist)); | 2770 Fcons (Fcons (Q_mask_data, mask_data), alist)); |
2768 } | 2771 } |
2774 | 2777 |
2775 static Lisp_Object | 2778 static Lisp_Object |
2776 xbm_normalize (Lisp_Object inst, Lisp_Object console_type, | 2779 xbm_normalize (Lisp_Object inst, Lisp_Object console_type, |
2777 Lisp_Object UNUSED (dest_mask)) | 2780 Lisp_Object UNUSED (dest_mask)) |
2778 { | 2781 { |
2779 Lisp_Object file = Qnil, mask_file = Qnil; | 2782 Lisp_Object file = Qnil, mask_file = Qnil, alist = Qnil; |
2780 struct gcpro gcpro1, gcpro2, gcpro3; | 2783 struct gcpro gcpro1, gcpro2, gcpro3; |
2781 Lisp_Object alist = Qnil; | |
2782 | 2784 |
2783 GCPRO3 (file, mask_file, alist); | 2785 GCPRO3 (file, mask_file, alist); |
2784 | 2786 |
2785 /* Now, convert any file data into inline data for both the regular | 2787 /* Now, convert any file data into inline data for both the regular |
2786 data and the mask data. At the end of this, `data' will contain | 2788 data and the mask data. At the end of this, `data' will contain |
2794 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2796 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2795 console_type); | 2797 console_type); |
2796 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 2798 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
2797 Q_mask_data, console_type); | 2799 Q_mask_data, console_type); |
2798 | 2800 |
2799 if (NILP (file)) /* normalization impossible for the console type */ | 2801 /* No locate_pixmap_file method for this console type, so we can't get a |
2802 file (neither a mask file BTW). */ | |
2803 if (NILP (file)) | |
2800 RETURN_UNGCPRO (Qnil); | 2804 RETURN_UNGCPRO (Qnil); |
2801 | 2805 |
2802 if (CONSP (file)) /* failure locating filename */ | 2806 if (CONSP (file)) /* failure locating filename */ |
2803 signal_double_image_error ("Opening bitmap file", | 2807 signal_double_image_error ("Opening bitmap file", |
2804 "no such file or directory", | 2808 "no such file or directory", |
2805 Fcar (file)); | 2809 Fcar (file)); |
2810 | |
2811 if (CONSP (mask_file)) /* failure locating filename */ | |
2812 signal_double_image_error ("Opening bitmap mask file", | |
2813 "no such file or directory", | |
2814 Fcar (mask_file)); | |
2806 | 2815 |
2807 if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */ | 2816 if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */ |
2808 RETURN_UNGCPRO (inst); | 2817 RETURN_UNGCPRO (inst); |
2809 | 2818 |
2810 alist = tagged_vector_to_alist (inst); | 2819 alist = tagged_vector_to_alist (inst); |
2861 | 2870 |
2862 static Lisp_Object | 2871 static Lisp_Object |
2863 xface_normalize (Lisp_Object inst, Lisp_Object console_type, | 2872 xface_normalize (Lisp_Object inst, Lisp_Object console_type, |
2864 Lisp_Object UNUSED (dest_mask)) | 2873 Lisp_Object UNUSED (dest_mask)) |
2865 { | 2874 { |
2866 /* This function can call lisp */ | 2875 Lisp_Object file = Qnil, mask_file = Qnil, alist = Qnil; |
2867 Lisp_Object file = Qnil, mask_file = Qnil; | |
2868 struct gcpro gcpro1, gcpro2, gcpro3; | 2876 struct gcpro gcpro1, gcpro2, gcpro3; |
2869 Lisp_Object alist = Qnil; | |
2870 | 2877 |
2871 GCPRO3 (file, mask_file, alist); | 2878 GCPRO3 (file, mask_file, alist); |
2872 | 2879 |
2873 /* Now, convert any file data into inline data for both the regular | 2880 /* Now, convert any file data into inline data for both the regular |
2874 data and the mask data. At the end of this, `data' will contain | 2881 data and the mask data. At the end of this, `data' will contain |
2882 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 2889 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
2883 console_type); | 2890 console_type); |
2884 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, | 2891 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file, |
2885 Q_mask_data, console_type); | 2892 Q_mask_data, console_type); |
2886 | 2893 |
2887 if (NILP (file)) /* normalization impossible for the console type */ | 2894 /* No locate_pixmap_file method for this console type, so we can't get a |
2895 file (neither a mask file BTW). */ | |
2896 if (NILP (file)) | |
2888 RETURN_UNGCPRO (Qnil); | 2897 RETURN_UNGCPRO (Qnil); |
2889 | 2898 |
2890 if (CONSP (file)) /* failure locating filename */ | 2899 if (CONSP (file)) /* failure locating filename */ |
2891 signal_double_image_error ("Opening bitmap file", | 2900 signal_double_image_error ("Opening face file", |
2892 "no such file or directory", | 2901 "no such file or directory", |
2893 Fcar (file)); | 2902 Fcar (file)); |
2894 | 2903 |
2904 if (CONSP (mask_file)) /* failure locating filename */ | |
2905 signal_double_image_error ("Opening face mask file", | |
2906 "no such file or directory", | |
2907 Fcar (mask_file)); | |
2908 | |
2895 if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */ | 2909 if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */ |
2896 RETURN_UNGCPRO (inst); | 2910 RETURN_UNGCPRO (inst); |
2897 | 2911 |
2898 alist = tagged_vector_to_alist (inst); | 2912 alist = tagged_vector_to_alist (inst); |
2899 | 2913 |
2900 { | 2914 if (!EQ (file, Qt)) |
2901 /* #### FIXME: what if EQ (file, Qt) && !EQ (mask, Qt) ? Is that possible? | 2915 { |
2902 If so, we have a problem... -- dvl */ | 2916 Lisp_Object data = make_string_from_file (file); |
2903 Lisp_Object data = make_string_from_file (file); | 2917 alist = remassq_no_quit (Q_file, alist); |
2904 alist = remassq_no_quit (Q_file, alist); | 2918 /* there can't be a :data at this point. */ |
2905 /* there can't be a :data at this point. */ | 2919 alist = Fcons (Fcons (Q_file, file), |
2906 alist = Fcons (Fcons (Q_file, file), | 2920 Fcons (Fcons (Q_data, data), alist)); |
2907 Fcons (Fcons (Q_data, data), alist)); | 2921 } |
2908 } | |
2909 | 2922 |
2910 alist = xbm_mask_file_munging (alist, file, mask_file, console_type); | 2923 alist = xbm_mask_file_munging (alist, file, mask_file, console_type); |
2911 | 2924 |
2912 { | 2925 { |
2913 Lisp_Object result = alist_to_tagged_vector (Qxface, alist); | 2926 Lisp_Object result = alist_to_tagged_vector (Qxface, alist); |
3692 int UNUSED (escapeflag)) | 3705 int UNUSED (escapeflag)) |
3693 { | 3706 { |
3694 Lisp_Glyph *glyph = XGLYPH (obj); | 3707 Lisp_Glyph *glyph = XGLYPH (obj); |
3695 | 3708 |
3696 if (print_readably) | 3709 if (print_readably) |
3697 printing_unreadable_lcrecord (obj, 0); | 3710 printing_unreadable_lisp_object (obj, 0); |
3698 | 3711 |
3699 write_fmt_string_lisp (printcharfun, "#<glyph (%s", 1, Fglyph_type (obj)); | 3712 write_fmt_string_lisp (printcharfun, "#<glyph (%s", 1, Fglyph_type (obj)); |
3700 write_fmt_string_lisp (printcharfun, ") %S", 1, glyph->image); | 3713 write_fmt_string_lisp (printcharfun, ") %S", 1, glyph->image); |
3701 write_fmt_string (printcharfun, "0x%x>", glyph->header.uid); | 3714 write_fmt_string (printcharfun, "0x%x>", LISP_OBJECT_UID (obj)); |
3702 } | 3715 } |
3703 | 3716 |
3704 /* Glyphs are equal if all of their display attributes are equal. We | 3717 /* Glyphs are equal if all of their display attributes are equal. We |
3705 don't compare names or doc-strings, because that would make equal | 3718 don't compare names or doc-strings, because that would make equal |
3706 be eq. | 3719 be eq. |
3803 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, face) }, | 3816 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, face) }, |
3804 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, plist) }, | 3817 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, plist) }, |
3805 { XD_END } | 3818 { XD_END } |
3806 }; | 3819 }; |
3807 | 3820 |
3808 DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("glyph", glyph, | 3821 DEFINE_DUMPABLE_LISP_OBJECT ("glyph", glyph, |
3809 1, /*dumpable-flag*/ | 3822 mark_glyph, print_glyph, 0, |
3810 mark_glyph, print_glyph, 0, | 3823 glyph_equal, glyph_hash, |
3811 glyph_equal, glyph_hash, | 3824 glyph_description, |
3812 glyph_description, | 3825 Lisp_Glyph); |
3813 glyph_getprop, glyph_putprop, | |
3814 glyph_remprop, glyph_plist, | |
3815 Lisp_Glyph); | |
3816 | 3826 |
3817 Lisp_Object | 3827 Lisp_Object |
3818 allocate_glyph (enum glyph_type type, | 3828 allocate_glyph (enum glyph_type type, |
3819 void (*after_change) (Lisp_Object glyph, Lisp_Object property, | 3829 void (*after_change) (Lisp_Object glyph, Lisp_Object property, |
3820 Lisp_Object locale)) | 3830 Lisp_Object locale)) |
3821 { | 3831 { |
3822 /* This function can GC */ | 3832 /* This function can GC */ |
3823 Lisp_Object obj = Qnil; | 3833 Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (glyph); |
3824 Lisp_Glyph *g = ALLOC_LCRECORD_TYPE (Lisp_Glyph, &lrecord_glyph); | 3834 Lisp_Glyph *g = XGLYPH (obj); |
3825 | 3835 |
3826 g->type = type; | 3836 g->type = type; |
3827 g->image = Fmake_specifier (Qimage); /* This function can GC */ | 3837 g->image = Fmake_specifier (Qimage); /* This function can GC */ |
3828 g->dirty = 0; | 3838 g->dirty = 0; |
3829 switch (g->type) | 3839 switch (g->type) |
3865 g->baseline = Fmake_specifier (Qgeneric); | 3875 g->baseline = Fmake_specifier (Qgeneric); |
3866 set_specifier_fallback (g->baseline, tem3); | 3876 set_specifier_fallback (g->baseline, tem3); |
3867 g->face = Qnil; | 3877 g->face = Qnil; |
3868 g->plist = Qnil; | 3878 g->plist = Qnil; |
3869 g->after_change = after_change; | 3879 g->after_change = after_change; |
3870 obj = wrap_glyph (g); | |
3871 | 3880 |
3872 set_image_attached_to (g->image, obj, Qimage); | 3881 set_image_attached_to (g->image, obj, Qimage); |
3873 UNGCPRO; | 3882 UNGCPRO; |
3874 } | 3883 } |
3875 | 3884 |
4463 | 4472 |
4464 #ifdef MEMORY_USAGE_STATS | 4473 #ifdef MEMORY_USAGE_STATS |
4465 | 4474 |
4466 int | 4475 int |
4467 compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels, | 4476 compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels, |
4468 struct overhead_stats *ovstats) | 4477 struct usage_stats *ustats) |
4469 { | 4478 { |
4470 int total = 0; | 4479 int total = 0; |
4471 | 4480 |
4472 if (glyph_cachels) | 4481 if (glyph_cachels) |
4473 total += Dynarr_memory_usage (glyph_cachels, ovstats); | 4482 total += Dynarr_memory_usage (glyph_cachels, ustats); |
4474 | 4483 |
4475 return total; | 4484 return total; |
4476 } | 4485 } |
4477 | 4486 |
4478 #endif /* MEMORY_USAGE_STATS */ | 4487 #endif /* MEMORY_USAGE_STATS */ |
4535 cache also. Otherwise code that checks the sanity of the instance | 4544 cache also. Otherwise code that checks the sanity of the instance |
4536 will fail. */ | 4545 will fail. */ |
4537 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)) | 4546 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)) |
4538 = delq_no_quit (value, | 4547 = delq_no_quit (value, |
4539 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))); | 4548 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))); |
4540 finalize_image_instance (XIMAGE_INSTANCE (value), 0); | 4549 finalize_image_instance (value); |
4541 } | 4550 } |
4542 } | 4551 } |
4543 return 0; | 4552 return 0; |
4544 } | 4553 } |
4545 | 4554 |
4638 if (!hold_ignored_expose_registration) | 4647 if (!hold_ignored_expose_registration) |
4639 { | 4648 { |
4640 struct expose_ignore *ei; | 4649 struct expose_ignore *ei; |
4641 | 4650 |
4642 #ifdef NEW_GC | 4651 #ifdef NEW_GC |
4643 ei = alloc_lrecord_type (struct expose_ignore, &lrecord_expose_ignore); | 4652 ei = XEXPOSE_IGNORE (ALLOC_NORMAL_LISP_OBJECT (expose_ignore)); |
4644 #else /* not NEW_GC */ | 4653 #else /* not NEW_GC */ |
4645 ei = Blocktype_alloc (the_expose_ignore_blocktype); | 4654 ei = Blocktype_alloc (the_expose_ignore_blocktype); |
4646 #endif /* not NEW_GC */ | 4655 #endif /* not NEW_GC */ |
4647 | 4656 |
4648 ei->next = NULL; | 4657 ei->next = NULL; |
5173 /***************************************************************************** | 5182 /***************************************************************************** |
5174 * initialization * | 5183 * initialization * |
5175 *****************************************************************************/ | 5184 *****************************************************************************/ |
5176 | 5185 |
5177 void | 5186 void |
5187 glyph_objects_create (void) | |
5188 { | |
5189 OBJECT_HAS_METHOD (glyph, getprop); | |
5190 OBJECT_HAS_METHOD (glyph, putprop); | |
5191 OBJECT_HAS_METHOD (glyph, remprop); | |
5192 OBJECT_HAS_METHOD (glyph, plist); | |
5193 } | |
5194 | |
5195 void | |
5178 syms_of_glyphs (void) | 5196 syms_of_glyphs (void) |
5179 { | 5197 { |
5180 INIT_LRECORD_IMPLEMENTATION (glyph); | 5198 INIT_LISP_OBJECT (glyph); |
5181 INIT_LRECORD_IMPLEMENTATION (image_instance); | 5199 INIT_LISP_OBJECT (image_instance); |
5182 | 5200 |
5183 /* image instantiators */ | 5201 /* image instantiators */ |
5184 | 5202 |
5185 DEFSUBR (Fimage_instantiator_format_list); | 5203 DEFSUBR (Fimage_instantiator_format_list); |
5186 DEFSUBR (Fvalid_image_instantiator_format_p); | 5204 DEFSUBR (Fvalid_image_instantiator_format_p); |