aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 3d1fa926096..9a445b26820 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5131,14 +5131,17 @@ If omitted or nil, that stands for the selected frame's display.
5131{ 5131{
5132 struct x_display_info *dpyinfo = check_x_display_info (terminal); 5132 struct x_display_info *dpyinfo = check_x_display_info (terminal);
5133 5133
5134 int nr_planes = DisplayPlanes (dpyinfo->display, 5134 if (dpyinfo->visual_info.class != TrueColor
5135 XScreenNumberOfScreen (dpyinfo->screen)); 5135 && dpyinfo->visual_info.class != DirectColor)
5136 return make_fixnum (dpyinfo->visual_info.colormap_size);
5136 5137
5137 /* Truncate nr_planes to 24 to avoid integer overflow. 5138 int nr_planes = dpyinfo->n_planes;
5138 Some displays says 32, but only 24 bits are actually significant. 5139
5140 /* Truncate nr_planes to 24 to avoid integer overflow. Some
5141 displays says 32, but only 24 bits are actually significant.
5139 There are only very few and rare video cards that have more than 5142 There are only very few and rare video cards that have more than
5140 24 significant bits. Also 24 bits is more than 16 million colors, 5143 24 significant bits. Also 24 bits is more than 16 million
5141 it "should be enough for everyone". */ 5144 colors, it "should be enough for everyone". */
5142 if (nr_planes > 24) nr_planes = 24; 5145 if (nr_planes > 24) nr_planes = 24;
5143 5146
5144 return make_fixnum (1 << nr_planes); 5147 return make_fixnum (1 << nr_planes);