diff options
| author | Basil L. Contovounesios | 2026-01-15 20:24:29 +0100 |
|---|---|---|
| committer | Eli Zaretskii | 2026-01-16 14:03:45 +0200 |
| commit | 6287637ccd9f66a219844231380ab9873d049c6e (patch) | |
| tree | 48af13b8d63daa5747f0c07d4a87ea7593b9051b /src | |
| parent | 8b2780225696ae42f4b9eeb1ac8151291f53ba5c (diff) | |
| download | emacs-6287637ccd9f66a219844231380ab9873d049c6e.tar.gz emacs-6287637ccd9f66a219844231380ab9873d049c6e.zip | |
Various housekeeping in image.c
* doc/lispref/display.texi (Customizing Bitmaps): Fix grammar.
(XBM Images): Fix reference to incorrect number of properties.
(Multi-Frame Images, Other Image Types): Mention multi-frame WebP
support.
* src/image.c: Don't include pdumper.h; it hasn't been needed since
commit of 2019-05-17 "Clean up and simplify image-type setup". Fix
some commentary.
(image_pix_container_create_from_bitmap_data): Remove no longer used
frame parameter (bug#80191); this continues from commit of
2022-11-25 "Remove unused parameter from
image_create_pix_container". All callers updated.
(x_create_xrender_picture, initialize_image_type): Simplify.
(xbm_image_p): Remove redundant conditional branch. Update
commentary.
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/src/image.c b/src/image.c index 3dad672515c..ac6e76f10a7 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -51,7 +51,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 51 | #include "coding.h" | 51 | #include "coding.h" |
| 52 | #include "termhooks.h" | 52 | #include "termhooks.h" |
| 53 | #include "font.h" | 53 | #include "font.h" |
| 54 | #include "pdumper.h" | ||
| 55 | 54 | ||
| 56 | #ifdef HAVE_SYS_STAT_H | 55 | #ifdef HAVE_SYS_STAT_H |
| 57 | #include <sys/stat.h> | 56 | #include <sys/stat.h> |
| @@ -270,8 +269,7 @@ image_pix_context_get_pixel (Emacs_Pix_Context image, int x, int y) | |||
| 270 | } | 269 | } |
| 271 | 270 | ||
| 272 | static Emacs_Pix_Container | 271 | static Emacs_Pix_Container |
| 273 | image_pix_container_create_from_bitmap_data (struct frame *f, | 272 | image_pix_container_create_from_bitmap_data (char *data, unsigned int width, |
| 274 | char *data, unsigned int width, | ||
| 275 | unsigned int height, | 273 | unsigned int height, |
| 276 | unsigned long fg, | 274 | unsigned long fg, |
| 277 | unsigned long bg) | 275 | unsigned long bg) |
| @@ -1471,7 +1469,8 @@ struct image_keyword | |||
| 1471 | /* True means key must be present. */ | 1469 | /* True means key must be present. */ |
| 1472 | bool mandatory_p; | 1470 | bool mandatory_p; |
| 1473 | 1471 | ||
| 1474 | /* Used to recognize duplicate keywords in a property list. */ | 1472 | /* True means key is present. |
| 1473 | Also used to recognize duplicate keywords in a property list. */ | ||
| 1475 | bool count; | 1474 | bool count; |
| 1476 | 1475 | ||
| 1477 | /* The value that was found. */ | 1476 | /* The value that was found. */ |
| @@ -3931,7 +3930,7 @@ x_destroy_x_image (XImage *ximg) | |||
| 3931 | static Picture | 3930 | static Picture |
| 3932 | x_create_xrender_picture (struct frame *f, Emacs_Pixmap pixmap, int depth) | 3931 | x_create_xrender_picture (struct frame *f, Emacs_Pixmap pixmap, int depth) |
| 3933 | { | 3932 | { |
| 3934 | Picture p; | 3933 | Picture p = None; |
| 3935 | Display *display = FRAME_X_DISPLAY (f); | 3934 | Display *display = FRAME_X_DISPLAY (f); |
| 3936 | 3935 | ||
| 3937 | if (FRAME_DISPLAY_INFO (f)->xrender_supported_p) | 3936 | if (FRAME_DISPLAY_INFO (f)->xrender_supported_p) |
| @@ -3966,15 +3965,7 @@ x_create_xrender_picture (struct frame *f, Emacs_Pixmap pixmap, int depth) | |||
| 3966 | p = XRenderCreatePicture (display, pixmap, format, attr_mask, &attr); | 3965 | p = XRenderCreatePicture (display, pixmap, format, attr_mask, &attr); |
| 3967 | } | 3966 | } |
| 3968 | else | 3967 | else |
| 3969 | { | 3968 | image_error ("Specified image bit depth is not supported by XRender"); |
| 3970 | image_error ("Specified image bit depth is not supported by XRender"); | ||
| 3971 | return 0; | ||
| 3972 | } | ||
| 3973 | } | ||
| 3974 | else | ||
| 3975 | { | ||
| 3976 | /* XRender not supported on this display. */ | ||
| 3977 | return 0; | ||
| 3978 | } | 3969 | } |
| 3979 | 3970 | ||
| 3980 | return p; | 3971 | return p; |
| @@ -4607,7 +4598,7 @@ enum xbm_token | |||
| 4607 | 4598 | ||
| 4608 | 4599 | ||
| 4609 | /* Return true if OBJECT is a valid XBM-type image specification. | 4600 | /* Return true if OBJECT is a valid XBM-type image specification. |
| 4610 | A valid specification is a list starting with the symbol `image' | 4601 | A valid specification is a list starting with the symbol `image'. |
| 4611 | The rest of the list is a property list which must contain an | 4602 | The rest of the list is a property list which must contain an |
| 4612 | entry `:type xbm'. | 4603 | entry `:type xbm'. |
| 4613 | 4604 | ||
| @@ -4630,8 +4621,8 @@ enum xbm_token | |||
| 4630 | 4621 | ||
| 4631 | Both the file and data forms may contain the additional entries | 4622 | Both the file and data forms may contain the additional entries |
| 4632 | `:background COLOR' and `:foreground COLOR'. If not present, | 4623 | `:background COLOR' and `:foreground COLOR'. If not present, |
| 4633 | foreground and background of the frame on which the image is | 4624 | the foreground and background of the frame on which the image is |
| 4634 | displayed is used. */ | 4625 | displayed are used. */ |
| 4635 | 4626 | ||
| 4636 | static bool | 4627 | static bool |
| 4637 | xbm_image_p (Lisp_Object object) | 4628 | xbm_image_p (Lisp_Object object) |
| @@ -4649,18 +4640,14 @@ xbm_image_p (Lisp_Object object) | |||
| 4649 | if (kw[XBM_DATA].count) | 4640 | if (kw[XBM_DATA].count) |
| 4650 | return 0; | 4641 | return 0; |
| 4651 | } | 4642 | } |
| 4652 | else if (kw[XBM_DATA].count && xbm_file_p (kw[XBM_DATA].value)) | 4643 | else if (! (kw[XBM_DATA].count && xbm_file_p (kw[XBM_DATA].value))) |
| 4653 | { | 4644 | /* Not an in-memory XBM file. */ |
| 4654 | /* In-memory XBM file. */ | ||
| 4655 | if (kw[XBM_FILE].count) | ||
| 4656 | return 0; | ||
| 4657 | } | ||
| 4658 | else | ||
| 4659 | { | 4645 | { |
| 4660 | Lisp_Object data; | 4646 | Lisp_Object data; |
| 4661 | int width, height, stride; | 4647 | int width, height, stride; |
| 4662 | 4648 | ||
| 4663 | /* Entries for `:width', `:height' and `:data' must be present. */ | 4649 | /* Entries for `:data-width', `:data-height', and `:data' must be |
| 4650 | present. */ | ||
| 4664 | if (!kw[XBM_DATA_WIDTH].count | 4651 | if (!kw[XBM_DATA_WIDTH].count |
| 4665 | || !kw[XBM_DATA_HEIGHT].count | 4652 | || !kw[XBM_DATA_HEIGHT].count |
| 4666 | || !kw[XBM_DATA].count) | 4653 | || !kw[XBM_DATA].count) |
| @@ -4944,7 +4931,7 @@ Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data, | |||
| 4944 | fg = lookup_rgb_color (f, fgbg[0].red, fgbg[0].green, fgbg[0].blue); | 4931 | fg = lookup_rgb_color (f, fgbg[0].red, fgbg[0].green, fgbg[0].blue); |
| 4945 | bg = lookup_rgb_color (f, fgbg[1].red, fgbg[1].green, fgbg[1].blue); | 4932 | bg = lookup_rgb_color (f, fgbg[1].red, fgbg[1].green, fgbg[1].blue); |
| 4946 | img->pixmap | 4933 | img->pixmap |
| 4947 | = image_pix_container_create_from_bitmap_data (f, data, img->width, | 4934 | = image_pix_container_create_from_bitmap_data (data, img->width, |
| 4948 | img->height, fg, bg); | 4935 | img->height, fg, bg); |
| 4949 | #elif defined HAVE_X_WINDOWS | 4936 | #elif defined HAVE_X_WINDOWS |
| 4950 | img->pixmap | 4937 | img->pixmap |
| @@ -7447,7 +7434,7 @@ image_build_heuristic_mask (struct frame *f, struct image *img, | |||
| 7447 | PBM (mono, gray, color) | 7434 | PBM (mono, gray, color) |
| 7448 | ***********************************************************************/ | 7435 | ***********************************************************************/ |
| 7449 | 7436 | ||
| 7450 | /* Indices of image specification fields in gs_format, below. */ | 7437 | /* Indices of image specification fields in pbm_format, below. */ |
| 7451 | 7438 | ||
| 7452 | enum pbm_keyword_index | 7439 | enum pbm_keyword_index |
| 7453 | { | 7440 | { |
| @@ -8592,7 +8579,7 @@ png_load (struct frame *f, struct image *img) | |||
| 8592 | 8579 | ||
| 8593 | #if defined (HAVE_JPEG) | 8580 | #if defined (HAVE_JPEG) |
| 8594 | 8581 | ||
| 8595 | /* Indices of image specification fields in gs_format, below. */ | 8582 | /* Indices of image specification fields in jpeg_format, below. */ |
| 8596 | 8583 | ||
| 8597 | enum jpeg_keyword_index | 8584 | enum jpeg_keyword_index |
| 8598 | { | 8585 | { |
| @@ -12827,7 +12814,7 @@ initialize_image_type (struct image_type const *type) | |||
| 12827 | Lisp_Object tested = Fassq (typesym, Vlibrary_cache); | 12814 | Lisp_Object tested = Fassq (typesym, Vlibrary_cache); |
| 12828 | /* If we failed to load the library before, don't try again. */ | 12815 | /* If we failed to load the library before, don't try again. */ |
| 12829 | if (CONSP (tested)) | 12816 | if (CONSP (tested)) |
| 12830 | return !NILP (XCDR (tested)) ? true : false; | 12817 | return !NILP (XCDR (tested)); |
| 12831 | 12818 | ||
| 12832 | bool (*init) (void) = type->init; | 12819 | bool (*init) (void) = type->init; |
| 12833 | if (init) | 12820 | if (init) |
| @@ -12891,8 +12878,8 @@ static struct image_type native_image_type = | |||
| 12891 | image_clear_image }; | 12878 | image_clear_image }; |
| 12892 | #endif | 12879 | #endif |
| 12893 | 12880 | ||
| 12894 | /* Look up image type TYPE, and return a pointer to its image_type | 12881 | /* Look up image TYPE, and return a pointer to its image_type structure. |
| 12895 | structure. Return 0 if TYPE is not a known image type. */ | 12882 | Return a null pointer if TYPE is not a known image type. */ |
| 12896 | 12883 | ||
| 12897 | static struct image_type const * | 12884 | static struct image_type const * |
| 12898 | lookup_image_type (Lisp_Object type) | 12885 | lookup_image_type (Lisp_Object type) |