From 26df743c3cfdf7b4dbf164399df28fba4d469a40 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 24 Apr 2024 16:33:33 +0800 Subject: [PATCH] Disable unsuitable XPM color selection mechanism on Android * src/image.c (xpm_load_image) [HAVE_ANDROID]: Always select XPM_COLOR_KEY_C. (cherry picked from commit 3776539152711ca364d94f0d4f8166d6f67eb413) --- src/image.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/image.c b/src/image.c index 74249b8d465..ab61e49f695 100644 --- a/src/image.c +++ b/src/image.c @@ -6237,6 +6237,8 @@ xpm_load_image (struct frame *f, expect (','); XSETFRAME (frame, f); + +#ifndef HAVE_ANDROID if (!NILP (Fxw_display_color_p (frame))) best_key = XPM_COLOR_KEY_C; else if (!NILP (Fx_display_grayscale_p (frame))) @@ -6244,6 +6246,14 @@ xpm_load_image (struct frame *f, ? XPM_COLOR_KEY_G : XPM_COLOR_KEY_G4); else best_key = XPM_COLOR_KEY_M; +#else /* HAVE_ANDROID */ + /* The color-loading loop has not been taught to progressively settle + for less optimal color keys if no colors are defined for best_key, + and since libXpm is not available on Android, there is no better + option than delegating the task of mapping whatever color values + are provided to B/W or grayscale to the display driver. */ + best_key = XPM_COLOR_KEY_C; +#endif /* !HAVE_ANDROID */ color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL); if (chars_per_pixel == 1) -- 2.39.5