summaryrefslogtreecommitdiffstats
path: root/unix/x0vncserver/XPixelBuffer.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-02-12 13:12:31 +0100
committerPierre Ossman <ossman@cendio.se>2014-07-07 13:27:09 +0200
commit4d0bc6e7cac91fedb70c278a6dc36c75a1344a0e (patch)
treed2e2e68f65f9968095818678c9929fa2ac940bc0 /unix/x0vncserver/XPixelBuffer.cxx
parentb266561b0c6e97fe0669fb25719503aa608237ce (diff)
downloadtigervnc-4d0bc6e7cac91fedb70c278a6dc36c75a1344a0e.tar.gz
tigervnc-4d0bc6e7cac91fedb70c278a6dc36c75a1344a0e.zip
Fix some offenders that poke around in the PixelFormat internals
Diffstat (limited to 'unix/x0vncserver/XPixelBuffer.cxx')
-rw-r--r--unix/x0vncserver/XPixelBuffer.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/unix/x0vncserver/XPixelBuffer.cxx b/unix/x0vncserver/XPixelBuffer.cxx
index f691c576..aa52620a 100644
--- a/unix/x0vncserver/XPixelBuffer.cxx
+++ b/unix/x0vncserver/XPixelBuffer.cxx
@@ -1,4 +1,5 @@
/* Copyright (C) 2007-2008 Constantin Kaplinsky. All Rights Reserved.
+ * Copyright 2014 Pierre Ossman for Cendio AB
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -38,16 +39,16 @@ XPixelBuffer::XPixelBuffer(Display *dpy, ImageFactory &factory,
m_stride(0)
{
// Fill in the PixelFormat structure of the parent class.
- format.bpp = m_image->xim->bits_per_pixel;
- format.depth = m_image->xim->depth;
- format.bigEndian = (m_image->xim->byte_order == MSBFirst);
- format.trueColour = m_image->isTrueColor();
- format.redShift = ffs(m_image->xim->red_mask) - 1;
- format.greenShift = ffs(m_image->xim->green_mask) - 1;
- format.blueShift = ffs(m_image->xim->blue_mask) - 1;
- format.redMax = m_image->xim->red_mask >> format.redShift;
- format.greenMax = m_image->xim->green_mask >> format.greenShift;
- format.blueMax = m_image->xim->blue_mask >> format.blueShift;
+ format = PixelFormat(m_image->xim->bits_per_pixel,
+ m_image->xim->depth,
+ (m_image->xim->byte_order == MSBFirst),
+ m_image->isTrueColor(),
+ m_image->xim->red_mask >> (ffs(m_image->xim->red_mask) - 1),
+ m_image->xim->green_mask >> (ffs(m_image->xim->green_mask) - 1),
+ m_image->xim->blue_mask >> (ffs(m_image->xim->blue_mask) - 1),
+ ffs(m_image->xim->red_mask) - 1,
+ ffs(m_image->xim->green_mask) - 1,
+ ffs(m_image->xim->blue_mask) - 1);
// Set up the remaining data of the parent class.
width_ = rect.width();