]> source.dussan.org Git - tigervnc.git/commitdiff
Reverted most of vfbScreenInfo to the original RealVNC implementation,
authorPeter Åstrand <astrand@cendio.se>
Wed, 23 Feb 2005 15:22:34 +0000 (15:22 +0000)
committerPeter Åstrand <astrand@cendio.se>
Wed, 23 Feb 2005 15:22:34 +0000 (15:22 +0000)
since miSetVisualTypesAndMasks breaks "xwd", for some reason.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@228 3789f03b-4d11-0410-bbf8-ca57d06f2519

xc/programs/Xserver/vnc/Xvnc/xvnc.cc

index 3ef17fd4473356cf6d516f894ba9cf101ddd5561..5688eaff8896622bf58a63ef9307de2bb7286972 100644 (file)
@@ -1068,54 +1068,25 @@ static Bool
 vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 {
     vfbScreenInfoPtr pvfb = &vfbScreens[index];
-    int dpix = 100, dpiy = 100;
+    int dpi = 100;
     int ret;
     char *pbits;
 
+    if (monitorResolution) dpi = monitorResolution;
+
     pvfb->paddedBytesWidth = PixmapBytePad(pvfb->width, pvfb->depth);
     pvfb->bitsPerPixel = vfbBitsPerPixel(pvfb->depth);
-    if (pvfb->bitsPerPixel >= 8 )
-       pvfb->paddedWidth = pvfb->paddedBytesWidth / (pvfb->bitsPerPixel / 8);
-    else
-       pvfb->paddedWidth = pvfb->paddedBytesWidth * 8;
+    pvfb->paddedWidth = pvfb->paddedBytesWidth * 8 / pvfb->bitsPerPixel;
     pbits = vfbAllocateFramebufferMemory(pvfb);
     if (!pbits) return FALSE;
+    vncFbptr[index] = pbits;
+
+    defaultColorVisualClass
+       = (pvfb->bitsPerPixel > 8) ? TrueColor : PseudoColor;
 
-    miSetPixmapDepths ();
-
-    switch (pvfb->depth) {
-    case 8:
-       miSetVisualTypesAndMasks (8,
-                                 ((1 << StaticGray) |
-                                  (1 << GrayScale) |
-                                  (1 << StaticColor) |
-                                  (1 << PseudoColor) |
-                                  (1 << TrueColor) |
-                                  (1 << DirectColor)),
-                                 8, PseudoColor, 0x07, 0x38, 0xc0);
-       break;
-    case 15:
-       miSetVisualTypesAndMasks (15,
-                                 ((1 << TrueColor) |
-                                  (1 << DirectColor)),
-                                 8, TrueColor, 0x7c00, 0x03e0, 0x001f);
-       break;
-    case 16:
-       miSetVisualTypesAndMasks (16,
-                                 ((1 << TrueColor) |
-                                  (1 << DirectColor)),
-                                 8, TrueColor, 0xf800, 0x07e0, 0x001f);
-       break;
-    case 24:
-       miSetVisualTypesAndMasks (24,
-                                 ((1 << TrueColor) |
-                                  (1 << DirectColor)),
-                                 8, TrueColor, 0xff0000, 0x00ff00, 0x0000ff);
-       break;
-    }
-       
     ret = fbScreenInit(pScreen, pbits, pvfb->width, pvfb->height,
-                      dpix, dpiy, pvfb->paddedWidth,pvfb->bitsPerPixel);
+                      dpi, dpi, pvfb->paddedWidth, pvfb->bitsPerPixel);
+  
 #ifdef RENDER
     if (ret && Render) 
        fbPictureInit (pScreen, 0, 0);
@@ -1136,14 +1107,44 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
 
     pScreen->SaveScreen = vfbSaveScreen;
     pScreen->StoreColors = vfbStoreColors;
-
-    miDCInitialize(pScreen, &vfbPointerCursorFuncs);
-
+    
+    miPointerInitialize(pScreen, &vfbPointerSpriteFuncs, &vfbPointerCursorFuncs,
+                       FALSE);
+    
     vfbWriteXWDFileHeader(pScreen);
 
     pScreen->blackPixel = pvfb->blackPixel;
     pScreen->whitePixel = pvfb->whitePixel;
 
+    if (!pvfb->pixelFormatDefined && pvfb->depth == 16) {
+       pvfb->pixelFormatDefined = TRUE;
+       pvfb->rgbNotBgr = TRUE;
+       pvfb->blueBits = pvfb->redBits = 5;
+       pvfb->greenBits = 6;
+    }
+    
+    if (pvfb->pixelFormatDefined) {
+       VisualPtr vis;
+       for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++)
+           ;
+       
+       if (pvfb->rgbNotBgr) {
+           vis->offsetBlue = 0;
+           vis->blueMask = (1 << pvfb->blueBits) - 1;
+           vis->offsetGreen = pvfb->blueBits;
+           vis->greenMask = ((1 << pvfb->greenBits) - 1) << vis->offsetGreen;
+           vis->offsetRed = vis->offsetGreen + pvfb->greenBits;
+           vis->redMask = ((1 << pvfb->redBits) - 1) << vis->offsetRed;
+       } else {
+           vis->offsetRed = 0;
+           vis->redMask = (1 << pvfb->redBits) - 1;
+           vis->offsetGreen = pvfb->redBits;
+           vis->greenMask = ((1 << pvfb->greenBits) - 1) << vis->offsetGreen;
+           vis->offsetBlue = vis->offsetGreen + pvfb->greenBits;
+           vis->blueMask = ((1 << pvfb->blueBits) - 1) << vis->offsetBlue;
+       }
+    }
+    
     ret = fbCreateDefColormap(pScreen);
 
     miSetZeroLineBias(pScreen, pvfb->lineBias);