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);
}
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);
protected:
Display* dpy;
Geometry* geometry;
- PixelFormat pf;
XPixelBuffer* pb;
VNCServer* server;
Image* image;