Qt 4.8
Public Functions | List of all members
QVNCDirtyMapOptimized< T > Class Template Reference

#include <qscreenvnc_p.h>

Inheritance diagram for QVNCDirtyMapOptimized< T >:
QVNCDirtyMap QVNCDirtyMap

Public Functions

 QVNCDirtyMapOptimized (QScreen *screen)
 
 QVNCDirtyMapOptimized (QVNCScreen *screen)
 
void setDirty (int x, int y, bool force=false)
 
void setDirty (int x, int y, bool force=false)
 
 ~QVNCDirtyMapOptimized ()
 
 ~QVNCDirtyMapOptimized ()
 
- Public Functions inherited from QVNCDirtyMap
bool dirty (int x, int y) const
 
bool dirty (int x, int y) const
 
 QVNCDirtyMap (QScreen *screen)
 
 QVNCDirtyMap (QVNCScreen *screen)
 
void reset ()
 
void reset ()
 
void setClean (int x, int y)
 
void setClean (int x, int y)
 
virtual ~QVNCDirtyMap ()
 
virtual ~QVNCDirtyMap ()
 

Additional Inherited Members

- Public Variables inherited from QVNCDirtyMap
int bytesPerPixel
 
int mapHeight
 
int mapWidth
 
int numDirty
 
- Protected Variables inherited from QVNCDirtyMap
ucharbuffer
 
int bufferHeight
 
int bufferStride
 
int bufferWidth
 
ucharmap
 
int numTiles
 
QScreenscreen
 
QVNCScreenscreen
 

Detailed Description

template<class T>
class QVNCDirtyMapOptimized< T >

Definition at line 132 of file qscreenvnc_p.h.

Constructors and Destructors

◆ QVNCDirtyMapOptimized() [1/2]

template<class T >
QVNCDirtyMapOptimized< T >::QVNCDirtyMapOptimized ( QScreen screen)
inline

Definition at line 135 of file qscreenvnc_p.h.

135 : QVNCDirtyMap(screen) {}
QVNCDirtyMap(QScreen *screen)

◆ ~QVNCDirtyMapOptimized() [1/2]

template<class T >
QVNCDirtyMapOptimized< T >::~QVNCDirtyMapOptimized ( )
inline

Definition at line 136 of file qscreenvnc_p.h.

136 {}

◆ QVNCDirtyMapOptimized() [2/2]

template<class T >
QVNCDirtyMapOptimized< T >::QVNCDirtyMapOptimized ( QVNCScreen screen)
inline

Definition at line 137 of file qvncserver.h.

137 : QVNCDirtyMap(screen) {}
QVNCDirtyMap(QScreen *screen)

◆ ~QVNCDirtyMapOptimized() [2/2]

template<class T >
QVNCDirtyMapOptimized< T >::~QVNCDirtyMapOptimized ( )
inline

Definition at line 138 of file qvncserver.h.

138 {}

Functions

◆ setDirty() [1/2]

template<class T >
void QVNCDirtyMapOptimized< T >::setDirty ( int  x,
int  y,
bool  force = false 
)
virtual

Implements QVNCDirtyMap.

Definition at line 1704 of file qscreenvnc_qws.cpp.

Referenced by QVNCDirtyMap::QVNCDirtyMap().

1705 {
1706  static bool alwaysForce = qgetenv("QT_VNC_NO_COMPAREBUFFER").toInt();
1707  if (alwaysForce)
1708  force = true;
1709 
1710  bool changed = false;
1711 
1712  if (!force) {
1713  const int lstep = screen->linestep();
1714  const int startX = tileX * MAP_TILE_SIZE;
1715  const int startY = tileY * MAP_TILE_SIZE;
1716  const uchar *scrn = screen->base()
1717  + startY * lstep + startX * bytesPerPixel;
1718  uchar *old = buffer + startY * bufferStride + startX * sizeof(T);
1719 
1720  const int tileHeight = (startY + MAP_TILE_SIZE > bufferHeight ?
1721  bufferHeight - startY : MAP_TILE_SIZE);
1722  const int tileWidth = (startX + MAP_TILE_SIZE > bufferWidth ?
1723  bufferWidth - startX : MAP_TILE_SIZE);
1724  const bool doInlines = (tileWidth == MAP_TILE_SIZE);
1725 
1726  int y = tileHeight;
1727 
1728  if (doInlines) { // hw: memcmp/memcpy is inlined when using constants
1729  while (y) {
1730  if (memcmp(old, scrn, sizeof(T) * MAP_TILE_SIZE)) {
1731  changed = true;
1732  break;
1733  }
1734  scrn += lstep;
1735  old += bufferStride;
1736  --y;
1737  }
1738 
1739  while (y) {
1740  memcpy(old, scrn, sizeof(T) * MAP_TILE_SIZE);
1741  scrn += lstep;
1742  old += bufferStride;
1743  --y;
1744  }
1745  } else {
1746  while (y) {
1747  if (memcmp(old, scrn, sizeof(T) * tileWidth)) {
1748  changed = true;
1749  break;
1750  }
1751  scrn += lstep;
1752  old += bufferStride;
1753  --y;
1754  }
1755 
1756  while (y) {
1757  memcpy(old, scrn, sizeof(T) * tileWidth);
1758  scrn += lstep;
1759  old += bufferStride;
1760  --y;
1761  }
1762  }
1763  }
1764 
1765  const int mapIndex = tileY * mapWidth + tileX;
1766  if ((force || changed) && !map[mapIndex]) {
1767  map[mapIndex] = 1;
1768  ++numDirty;
1769  }
1770 }
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
uchar * buffer
Definition: qscreenvnc_p.h:124
#define MAP_TILE_SIZE
Definition: qscreenvnc_p.h:100
unsigned char uchar
Definition: qglobal.h:994
int linestep() const
Returns the length of each scanline of the framebuffer in bytes.
Definition: qscreen_qws.h:232
QScreen * screen
Definition: qscreenvnc_p.h:123
uchar * base() const
Returns a pointer to the beginning of the framebuffer.
Definition: qscreen_qws.h:235
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...

◆ setDirty() [2/2]

template<class T >
void QVNCDirtyMapOptimized< T >::setDirty ( int  x,
int  y,
bool  force = false 
)
virtual

Implements QVNCDirtyMap.


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