* [Qemu-devel] BGR vs RGB, a patch with a more simple approach
@ 2006-05-18 5:33 Henrik Carlqvist
0 siblings, 0 replies; only message in thread
From: Henrik Carlqvist @ 2006-05-18 5:33 UTC (permalink / raw)
To: qemu-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-05-18 5:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-18 5:33 [Qemu-devel] BGR vs RGB, a patch with a more simple approach Henrik Carlqvist
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).