Qt 4.8
Public Functions | Properties | List of all members
QRfbSingleColorHextile< SRC > Class Template Reference

#include <qscreenvnc_p.h>

Public Functions

 QRfbSingleColorHextile (QRfbHextileEncoder< SRC > *e)
 
 QRfbSingleColorHextile (QRfbHextileEncoder< SRC > *e)
 
bool read (const uchar *data, int width, int height, int stride)
 
bool read (const uchar *data, int width, int height, int stride)
 
void write (QTcpSocket *socket) const
 
void write (QTcpSocket *socket) const
 

Properties

QRfbHextileEncoder< SRC > * encoder
 

Detailed Description

template<class SRC>
class QRfbSingleColorHextile< SRC >

Definition at line 292 of file qscreenvnc_p.h.

Constructors and Destructors

◆ QRfbSingleColorHextile() [1/2]

template<class SRC>
QRfbSingleColorHextile< SRC >::QRfbSingleColorHextile ( QRfbHextileEncoder< SRC > *  e)
inline

Definition at line 295 of file qscreenvnc_p.h.

295 : encoder(e) {}
QRfbHextileEncoder< SRC > * encoder
Definition: qscreenvnc_p.h:300

◆ QRfbSingleColorHextile() [2/2]

template<class SRC>
QRfbSingleColorHextile< SRC >::QRfbSingleColorHextile ( QRfbHextileEncoder< SRC > *  e)
inline

Definition at line 301 of file qvncserver.h.

301 : encoder(e) {}
QRfbHextileEncoder< SRC > * encoder
Definition: qscreenvnc_p.h:300

Functions

◆ read() [1/2]

template<class SRC >
bool QRfbSingleColorHextile< SRC >::read ( const uchar data,
int  width,
int  height,
int  stride 
)

Definition at line 1073 of file qscreenvnc_qws.cpp.

Referenced by buttonChange().

1075 {
1076  const int depth = encoder->server->screen()->depth();
1077  if (width % (depth / 8)) // hw: should rather fallback to simple loop
1078  return false;
1079 
1080  static int alwaysFalse = qgetenv("QT_VNC_NOCHECKFILL").toInt();
1081  if (alwaysFalse)
1082  return false;
1083 
1084  switch (depth) {
1085  case 4: {
1086  const quint8 *data8 = reinterpret_cast<const quint8*>(data);
1087  if ((data8[0] & 0xf) != (data8[0] >> 4))
1088  return false;
1089  width /= 2;
1090  } // fallthrough
1091  case 8: {
1092  const quint8 *data8 = reinterpret_cast<const quint8*>(data);
1093  if (data8[0] != data8[1])
1094  return false;
1095  width /= 2;
1096  } // fallthrough
1097  case 12:
1098  case 15:
1099  case 16: {
1100  const quint16 *data16 = reinterpret_cast<const quint16*>(data);
1101  if (data16[0] != data16[1])
1102  return false;
1103  width /= 2;
1104  } // fallthrough
1105  case 18:
1106  case 24:
1107  case 32: {
1108  const quint32 *data32 = reinterpret_cast<const quint32*>(data);
1109  const quint32 first = data32[0];
1110  const int linestep = (stride / sizeof(quint32)) - width;
1111  for (int y = 0; y < height; ++y) {
1112  for (int x = 0; x < width; ++x) {
1113  if (*(data32++) != first)
1114  return false;
1115  }
1116  data32 += linestep;
1117  }
1118  break;
1119  }
1120  default:
1121  return false;
1122  }
1123 
1124  SRC color = reinterpret_cast<const SRC*>(data)[0];
1125  encoder->newBg |= (color != encoder->bg);
1126  encoder->bg = color;
1127  return true;
1128 }
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QRfbHextileEncoder< SRC > * encoder
Definition: qscreenvnc_p.h:300
unsigned char quint8
Definition: qglobal.h:934
unsigned short quint16
Definition: qglobal.h:936
static const char * data(const QByteArray &arr)
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
unsigned int quint32
Definition: qglobal.h:938

◆ read() [2/2]

template<class SRC>
bool QRfbSingleColorHextile< SRC >::read ( const uchar data,
int  width,
int  height,
int  stride 
)

◆ write() [1/2]

template<class SRC >
void QRfbSingleColorHextile< SRC >::write ( QTcpSocket socket) const

Definition at line 1131 of file qscreenvnc_qws.cpp.

Referenced by buttonChange().

1132 {
1133  if (true || encoder->newBg) {
1134  const int bpp = encoder->server->clientBytesPerPixel();
1135  const int padding = 3;
1136  QVarLengthArray<char> buffer(padding + 1 + bpp);
1137  buffer[padding] = 2; // BackgroundSpecified
1138  encoder->server->convertPixels(buffer.data() + padding + 1,
1139  reinterpret_cast<char*>(&encoder->bg),
1140  1);
1141  socket->write(buffer.data() + padding, bpp + 1);
1142 // encoder->newBg = false;
1143  } else {
1144  char subenc = 0;
1145  socket->write(&subenc, 1);
1146  }
1147 }
QRfbHextileEncoder< SRC > * encoder
Definition: qscreenvnc_p.h:300
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
Definition: qiodevice.cpp:1342

◆ write() [2/2]

template<class SRC>
void QRfbSingleColorHextile< SRC >::write ( QTcpSocket socket) const

Properties

◆ encoder

template<class SRC>
QRfbHextileEncoder< SRC > * QRfbSingleColorHextile< SRC >::encoder
private

Definition at line 300 of file qscreenvnc_p.h.


The documentation for this class was generated from the following files: