]> source.dussan.org Git - tigervnc.git/commitdiff
Code refactoring: setting pixel format in XPixelBuffer instead of XDesktop.
authorConstantin Kaplinsky <const@tightvnc.com>
Tue, 3 Jun 2008 11:21:42 +0000 (11:21 +0000)
committerConstantin Kaplinsky <const@tightvnc.com>
Tue, 3 Jun 2008 11:21:42 +0000 (11:21 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2571 3789f03b-4d11-0410-bbf8-ca57d06f2519

unix/x0vncserver/XPixelBuffer.cxx
unix/x0vncserver/XPixelBuffer.h
unix/x0vncserver/x0vncserver.cxx

index 2692c18a71a38aab2bc877a0ed2ad503f01d0d39..164c70421f7c09488df72404c8f051519bdc3401 100644 (file)
@@ -29,16 +29,33 @@ using namespace rfb;
 
 XPixelBuffer::XPixelBuffer(Display *dpy, Image* image,
                            int offsetLeft, int offsetTop,
-                           const PixelFormat& pf, ColourMap* cm)
-  : FullFramePixelBuffer(pf, image->xim->width, image->xim->height,
-                         (rdr::U8 *)image->xim->data, cm),
+                           ColourMap* cm)
+  : FullFramePixelBuffer(),
     m_dpy(dpy),
     m_image(image),
     m_offsetLeft(offsetLeft),
     m_offsetTop(offsetTop),
     m_stride(image->xim->bytes_per_line * 8 / image->xim->bits_per_pixel)
 {
-  // Get initial screen image.
+  // Fill in the PixelFormat structure of the parent class.
+  format.bpp        = image->xim->bits_per_pixel;
+  format.depth      = image->xim->depth;
+  format.bigEndian  = (image->xim->byte_order == MSBFirst);
+  format.trueColour = image->isTrueColor();
+  format.redShift   = ffs(image->xim->red_mask) - 1;
+  format.greenShift = ffs(image->xim->green_mask) - 1;
+  format.blueShift  = ffs(image->xim->blue_mask) - 1;
+  format.redMax     = image->xim->red_mask   >> format.redShift;
+  format.greenMax   = image->xim->green_mask >> format.greenShift;
+  format.blueMax    = image->xim->blue_mask  >> format.blueShift;
+
+  // Set up the remaining data of the parent class.
+  width_ = image->xim->width;
+  height_ = image->xim->height;
+  data = (rdr::U8 *)image->xim->data;
+  colourmap = cm;
+
+  // Get initial screen image from the X display.
   m_image->get(DefaultRootWindow(m_dpy), m_offsetLeft, m_offsetTop);
 }
 
index b909bb8aeb2e47bb0010ed8fffbcd39ef886dccd..75cd552dc8a5c8740ecfac65f1e5d45835a3416d 100644 (file)
@@ -37,7 +37,7 @@ class XPixelBuffer : public FullFramePixelBuffer
 public:
   XPixelBuffer(Display *dpy, Image* image,
                int offsetLeft, int offsetTop,
-               const PixelFormat& pf, ColourMap* cm);
+               ColourMap* cm);
   virtual ~XPixelBuffer();
 
   // We allow public access to the underlying Image object.
index edaf1a8cf3a0050f603515f85ffcd7df6c71c1b0..9331cf5664c795fa2c189e4a96d821735c89eb91 100644 (file)
@@ -180,21 +180,10 @@ public:
     image = factory.newImage(dpy, geometry->width(), geometry->height());
     vlog.info("Allocated %s", image->classDesc());
 
-    pf.bpp = image->xim->bits_per_pixel;
-    pf.depth = image->xim->depth;
-    pf.bigEndian = (image->xim->byte_order == MSBFirst);
-    pf.trueColour = image->isTrueColor();
-    pf.redShift   = ffs(image->xim->red_mask) - 1;
-    pf.greenShift = ffs(image->xim->green_mask) - 1;
-    pf.blueShift  = ffs(image->xim->blue_mask) - 1;
-    pf.redMax     = image->xim->red_mask   >> pf.redShift;
-    pf.greenMax   = image->xim->green_mask >> pf.greenShift;
-    pf.blueMax    = image->xim->blue_mask  >> pf.blueShift;
-
     // Provide pixel buffer to the server object.
     pb = new XPixelBuffer(dpy, image,
                           geometry->offsetLeft(), geometry->offsetTop(),
-                          pf, this);
+                          this);
     server = vs;
     server->setPixelBuffer(pb);
 
@@ -282,7 +271,6 @@ public:
 protected:
   Display* dpy;
   Geometry* geometry;
-  PixelFormat pf;
   XPixelBuffer* pb;
   VNCServer* server;
   Image* image;