From d1338a94805cc774fe0a5d00c2225a3ee9673a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Winfried=20Gr=C3=BCnewald?= Date: Fri, 6 Mar 2009 12:59:35 -0500 Subject: [PATCH] [hw/xfree86] Fix StaticGray cmap. Fix this bug report: ,----< from http://bugzilla.freedesktop.org/show_bug.cgi?id=20504 > | Using the Visual StaticGray (8 bit depth) is missing one gray level. | The gray level of index zero and index one are the same and all | other levels are shifted by one. The max level (255) cannot be used. `---- Signed-off-by: James Cloos --- hw/xfree86/common/xf86cmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c index be50a5c6a..316470df4 100644 --- a/hw/xfree86/common/xf86cmap.c +++ b/hw/xfree86/common/xf86cmap.c @@ -562,8 +562,8 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int* indices) switch(pVisual->class) { case StaticGray: - for(i = 0; i <= numColors - 1; i++) { - index = i * maxValue / numColors; + for(i = 0; i < numColors; i++) { + index = (i+1) * maxValue / numColors; colors[i].red = gamma[index].red; colors[i].green = gamma[index].green; colors[i].blue = gamma[index].blue;