properly request a video mode with an alpha channel
authorAndreas Oberritter <obi@opendreambox.org>
Thu, 2 Oct 2008 14:02:41 +0000 (14:02 +0000)
committerAndreas Oberritter <obi@opendreambox.org>
Thu, 2 Oct 2008 14:02:41 +0000 (14:02 +0000)
lib/gdi/fb.cpp

index 8e8221c395e28b5dfe020dc0aedff7cd8c6a9602..bb6041e0f76094710cb85642176a428daffa72f0 100644 (file)
@@ -102,7 +102,32 @@ int fbClass::SetMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp)
        screeninfo.width=0;
        screeninfo.xoffset=screeninfo.yoffset=0;
        screeninfo.bits_per_pixel=nbpp;
        screeninfo.width=0;
        screeninfo.xoffset=screeninfo.yoffset=0;
        screeninfo.bits_per_pixel=nbpp;
-       
+
+       switch (nbpp) {
+       case 16:
+               // ARGB 1555
+               screeninfo.transp.offset = 15;
+               screeninfo.transp.length = 1;
+               screeninfo.red.offset = 10;
+               screeninfo.red.length = 5;
+               screeninfo.green.offset = 5;
+               screeninfo.green.length = 5;
+               screeninfo.blue.offset = 0;
+               screeninfo.blue.length = 5;
+               break;
+       case 32:
+               // ARGB 8888
+               screeninfo.transp.offset = 24;
+               screeninfo.transp.length = 8;
+               screeninfo.red.offset = 16;
+               screeninfo.red.length = 8;
+               screeninfo.green.offset = 8;
+               screeninfo.green.length = 8;
+               screeninfo.blue.offset = 0;
+               screeninfo.blue.length = 8;
+               break;
+       }
+
        if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0)
        {
                // try single buffering
        if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0)
        {
                // try single buffering