Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fgb92-0006m4-Mp for qemu-devel@nongnu.org; Thu, 18 May 2006 01:33:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fgb91-0006lj-Vy for qemu-devel@nongnu.org; Thu, 18 May 2006 01:33:56 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fgb91-0006lg-Ly for qemu-devel@nongnu.org; Thu, 18 May 2006 01:33:55 -0400 Received: from [82.183.137.225] (helo=1-1-5-8a.ehn.lk.bostream.se) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FgbC2-00082m-Ng for qemu-devel@nongnu.org; Thu, 18 May 2006 01:37:03 -0400 Received: from draken.lkp.se (henca@localhost [127.0.0.1]) by 1-1-5-8a.ehn.lk.bostream.se (8.11.4/8.11.4) with SMTP id k4I5Xr610890 for ; Thu, 18 May 2006 07:33:53 +0200 Date: Thu, 18 May 2006 07:33:53 +0200 From: Henrik Carlqvist Message-Id: <20060518073353.4bc13b20.hc8@uthyres.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] BGR vs RGB, a patch with a more simple approach Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hello again list! A few months ago I posted a patch to fix weird colors on the Hummingberd eXceed X server. My patch never got into CVS and now it seems as others have the same problem with Solaris. The approach in my patch is very simple: let SDL take care of the bit shifting. The patch is published at http://qemu.dad-answers.com/viewtopic.php?t=376 and to make this message complete I also paste it in here: -8<------------------------------------------------- --- sdl.c.org 2005-12-28 23:09:32.000000000 +0100 +++ sdl.c 2005-12-28 23:16:06.000000000 +0100 @@ -49,6 +49,8 @@ static void sdl_resize(DisplayState *ds, int w, int h) { int flags; + int i=0; + int a[4]={0,32,16,0}; // printf("resizing to %d %d\n", w, h); @@ -57,11 +59,16 @@ flags |= SDL_FULLSCREEN; again: - screen = SDL_SetVideoMode(w, h, 0, flags); - if (!screen) { - fprintf(stderr, "Could not open SDL display\n"); - exit(1); - } + do + { + screen = SDL_SetVideoMode(w, h, a[i], flags); + if (!screen) { + fprintf(stderr, "Could not open SDL display\n"); + exit(1); + } + }while ((screen->format->Rmask < screen->format->Bmask)&&(++i<4)); + /* Trying to find a screen which won't produce wrong colors */ + if (!screen->pixels && (flags & SDL_HWSURFACE) && (flags & SDL_FULLSCREEN)) { flags &= ~SDL_HWSURFACE; goto again; -8<------------------------------------------------- The patch works by checking that the mask for red is less than the mask for blue. If that is not the case it tries to select a non native color bit depth. It has turned out that when SDL has to shuffle the color bytes it chooses to place them in the right order. At least this patch has worked for me, I suppose that it will also solve the problem on Solaris. regards Henrik -- NOTE: Dear Outlook users: Please remove me from your address books. Read this article and you know why: http://newsforge.com/article.pl?sid=03/08/21/143258