[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 89c6e412dd: Fix searching the bitmap file path on Haiku
From: |
Po Lu |
Subject: |
master 89c6e412dd: Fix searching the bitmap file path on Haiku |
Date: |
Thu, 12 May 2022 03:43:26 -0400 (EDT) |
branch: master
commit 89c6e412dd6bcb3a8e5e90d9a52cf6f6fd233776
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix searching the bitmap file path on Haiku
* src/image.c (image_create_bitmap_from_file): [HAVE_HAIKU]:
Look for the bitmap inside `x-bitmap-file-path' as well.
---
src/image.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/image.c b/src/image.c
index 0c14173d83..dfa5327992 100644
--- a/src/image.c
+++ b/src/image.c
@@ -750,8 +750,28 @@ image_create_bitmap_from_file (struct frame *f,
Lisp_Object file)
int fd, width, height, rc, bytes_per_line, x, y;
char *contents, *data, *tmp;
void *bitmap;
+ Lisp_Object found;
- if (!STRINGP (image_find_image_fd (file, &fd)))
+ /* Look for an existing bitmap with the same name. */
+ for (id = 0; id < dpyinfo->bitmaps_last; ++id)
+ {
+ if (dpyinfo->bitmaps[id].refcount
+ && dpyinfo->bitmaps[id].file
+ && !strcmp (dpyinfo->bitmaps[id].file, SSDATA (file)))
+ {
+ ++dpyinfo->bitmaps[id].refcount;
+ return id + 1;
+ }
+ }
+
+ /* Search bitmap-file-path for the file, if appropriate. */
+ if (openp (Vx_bitmap_file_path, file, Qnil, &found,
+ make_fixnum (R_OK), false, false)
+ < 0)
+ return -1;
+
+ if (!STRINGP (image_find_image_fd (file, &fd))
+ && !STRINGP (image_find_image_fd (found, &fd)))
return -1;
contents = slurp_file (fd, &size);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 89c6e412dd: Fix searching the bitmap file path on Haiku,
Po Lu <=