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


_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to