Qt 4.8
Public Functions | Properties | Friends | List of all members
QWSDirectPainterSurface Class Reference

#include <qwindowsurface_qws_p.h>

Inheritance diagram for QWSDirectPainterSurface:
QWSWindowSurface QWindowSurface

Public Functions

void beginPaint (const QRegion &)
 This function is called before painting onto the surface begins, with the region in which the painting will occur. More...
 
void flush (QWidget *, const QRegion &, const QPoint &)
 Flushes the given region from the specified widget onto the screen. More...
 
bool hasPendingRegionEvents () const
 
QImage image () const
 Implement this function to return an image of the top-level window. More...
 
bool isValid () const
 Implement this function to return true if the surface is a valid surface for the given top-level window; otherwise return false. More...
 
QString key () const
 Implement this function to return a string that uniquely identifies the class of this surface. More...
 
bool lock (int timeout=-1)
 
QPaintDevicepaintDevice ()
 Implement this function to return the appropriate paint device. More...
 
QByteArray permanentState () const
 Implement this function to return the data required for creating a server-side representation of the surface. More...
 
 QWSDirectPainterSurface (bool isClient=false, QDirectPainter::SurfaceFlag flags=QDirectPainter::NonReserved)
 
QRegion region () const
 
QScreenscreen () const
 
void setGeometry (const QRect &rect)
 Sets the currently allocated area to be the given rect. More...
 
void setLocking (bool b)
 
void setPermanentState (const QByteArray &)
 Implement this function to attach a server-side surface instance to the corresponding client side instance using the given data. More...
 
void setRegion (const QRegion &region)
 
void setReserved ()
 
void unlock ()
 
WId windowId () const
 
 ~QWSDirectPainterSurface ()
 
- Public Functions inherited from QWSWindowSurface
const QRegion clipRegion () const
 Returns the region currently visible on the screen. More...
 
virtual void endPaint (const QRegion &)
 This function is called after painting onto the surface has ended, with the region in which the painting was performed. More...
 
bool isBuffered () const
 Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false. More...
 
bool isOpaque () const
 Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false. More...
 
bool isRegionReserved () const
 Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false. More...
 
virtual bool move (const QPoint &offset)
 Move the surface with the given offset. More...
 
virtual QRegion move (const QPoint &offset, const QRegion &newClip)
 Move the surface with the given offset. More...
 
virtual QPoint painterOffset () const
 Returns the offset to be used when painting. More...
 
 QWSWindowSurface ()
 Constructs an empty surface. More...
 
 QWSWindowSurface (QWidget *widget)
 Constructs an empty surface for the given top-level widget. More...
 
virtual void releaseSurface ()
 
void setClipRegion (const QRegion &)
 Sets the region currently visible on the screen to be the given clip region. More...
 
virtual void setGeometry (const QRect &rect, const QRegion &mask)
 
virtual void setTransientState (const QByteArray &state)
 
SurfaceFlags surfaceFlags () const
 Returns the surface flags describing the contents of this surface. More...
 
virtual QByteArray transientState () const
 
int winId () const
 
 ~QWSWindowSurface ()
 
- Public Functions inherited from QWindowSurface
virtual QImagebuffer (const QWidget *widget)
 Returns a QImage pointer which represents the actual buffer the widget is drawn into or 0 if this is unavailable. More...
 
virtual WindowSurfaceFeatures features () const
 
QRect geometry () const
 Returns the currently allocated area on the screen. More...
 
virtual QPixmap grabWidget (const QWidget *widget, const QRect &rectangle=QRect()) const
 Returns a QPixmap generated from the part of the backing store corresponding to widget. More...
 
bool hasFeature (WindowSurfaceFeature feature) const
 
virtual QPoint offset (const QWidget *widget) const
 Returns the offset of widget in the coordinates of this window surface. More...
 
 QWindowSurface (QWidget *window, bool setDefaultSurface=true)
 Constructs an empty surface for the given top-level window. More...
 
QRect rect (const QWidget *widget) const
 Returns the rectangle for widget in the coordinates of this window surface. More...
 
virtual bool scroll (const QRegion &area, int dx, int dy)
 Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative. More...
 
void setStaticContents (const QRegion &region)
 
QRegion staticContents () const
 
QWidgetwindow () const
 Returns a pointer to the top-level window associated with this surface. More...
 
virtual ~QWindowSurface ()
 Destroys this surface. More...
 

Properties

QScreen_screen
 
bool doLocking
 
bool flushingRegionEvents
 
bool synchronous
 
QMutex threadLock
 

Friends

void qt_directpainter_region (QDirectPainter *, const QRegion &, int)
 

Additional Inherited Members

- Public Types inherited from QWSWindowSurface
enum  SurfaceFlag { RegionReserved = 0x1, Buffered = 0x2, Opaque = 0x4 }
 This enum is used to describe the window surface's contents. More...
 
- Public Types inherited from QWindowSurface
enum  WindowSurfaceFeature { PartialUpdates = 0x00000001, PreservedContents = 0x00000002, StaticContents = 0x00000004, AllFeatures = 0xffffffff }
 
- Protected Functions inherited from QWSWindowSurface
void setSurfaceFlags (SurfaceFlags type)
 Sets the surface flags describing the contents of this surface, to be the given flags. More...
 
void setWinId (int id)
 
- Protected Functions inherited from QWindowSurface
bool hasStaticContents () const
 

Detailed Description

Definition at line 300 of file qwindowsurface_qws_p.h.

Constructors and Destructors

◆ QWSDirectPainterSurface()

QWSDirectPainterSurface::QWSDirectPainterSurface ( bool  isClient = false,
QDirectPainter::SurfaceFlag  flags = QDirectPainter::NonReserved 
)

Definition at line 1368 of file qwindowsurface_qws.cpp.

1370  : QWSWindowSurface(), flushingRegionEvents(false), doLocking(false)
1371 {
1374 
1375  if (isClient) {
1376  setWinId(QWidget::qwsDisplay()->takeId());
1378  QLatin1String("QDirectPainter reserved space"),
1379  QLatin1String("reserved"));
1380  } else {
1381  setWinId(0);
1382  }
1384  if (!_screen->base()) {
1385  QList<QScreen*> subScreens = _screen->subScreens();
1386  if (subScreens.size() < 1)
1387  _screen = 0;
1388  else
1389  _screen = subScreens.at(0);
1390  }
1391 }
void nameRegion(int winId, const QString &n, const QString &c)
static QWSDisplay * qwsDisplay()
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setSurfaceFlags(SurfaceFlags type)
Sets the surface flags describing the contents of this surface, to be the given flags.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static QScreen * instance()
Returns a pointer to the application&#39;s QScreen instance.
Definition: qscreen_qws.h:201
uchar * base() const
Returns a pointer to the beginning of the framebuffer.
Definition: qscreen_qws.h:235
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QWSWindowSurface()
Constructs an empty surface.
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ ~QWSDirectPainterSurface()

QWSDirectPainterSurface::~QWSDirectPainterSurface ( )

Definition at line 1393 of file qwindowsurface_qws.cpp.

1394 {
1395  if (winId() && QWSDisplay::instance()) // make sure not in QApplication destructor
1397 }
static QWSDisplay * qwsDisplay()
void destroyRegion(int winId)
static QWSDisplay * instance()

Functions

◆ beginPaint()

void QWSDirectPainterSurface::beginPaint ( const QRegion region)
virtual

This function is called before painting onto the surface begins, with the region in which the painting will occur.

See also
endPaint(), paintDevice()

Reimplemented from QWSWindowSurface.

Definition at line 1429 of file qwindowsurface_qws.cpp.

1430 {
1432 #ifndef QT_NO_QWS_MULTIPROCESS
1433  if (!synchronous) {
1434  flushingRegionEvents = true;
1436  flushingRegionEvents = false;
1437  }
1438 #endif
1439 }
virtual void beginPaint(const QRegion &)
This function is called before painting onto the surface begins, with the region in which the paintin...
void waitForRegionEvents(int winId, bool ungrabDisplay)
static QWSDisplay * instance()

◆ flush()

void QWSDirectPainterSurface::flush ( QWidget widget,
const QRegion region,
const QPoint offset 
)
virtual

Flushes the given region from the specified widget onto the screen.

Note that the offset parameter is currently unused.

Reimplemented from QWSWindowSurface.

Definition at line 1409 of file qwindowsurface_qws.cpp.

1410 {
1411  QWSDisplay::instance()->repaintRegion(winId(), 0, true, r);
1412 }
void repaintRegion(int winId, int windowFlags, bool opaque, QRegion)
static QWSDisplay * instance()

◆ hasPendingRegionEvents()

bool QWSDirectPainterSurface::hasPendingRegionEvents ( ) const

Definition at line 1441 of file qwindowsurface_qws.cpp.

1442 {
1443 #ifndef QT_NO_QWS_MULTIPROCESS
1444  if (synchronous)
1445  return false;
1446 
1448 #else
1449  return false;
1450 #endif
1451 }
bool hasPendingRegionEvents() const
static QWSDisplay * instance()

◆ image()

QImage QWSDirectPainterSurface::image ( ) const
inlinevirtual

Implement this function to return an image of the top-level window.

See also
geometry()

Implements QWSWindowSurface.

Definition at line 323 of file qwindowsurface_qws_p.h.

323 { return QImage(); }
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87

◆ isValid()

bool QWSDirectPainterSurface::isValid ( ) const
inlinevirtual

Implement this function to return true if the surface is a valid surface for the given top-level window; otherwise return false.

Since
4.3
See also
window(), key()

Implements QWSWindowSurface.

Definition at line 316 of file qwindowsurface_qws_p.h.

316 { return false; }

◆ key()

QString QWSDirectPainterSurface::key ( ) const
inlinevirtual

Implement this function to return a string that uniquely identifies the class of this surface.

See also
window(), isValid()

Implements QWSWindowSurface.

Definition at line 318 of file qwindowsurface_qws_p.h.

Referenced by setRegion().

318 { return QLatin1String("DirectPainter"); }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

◆ lock()

bool QWSDirectPainterSurface::lock ( int  timeout = -1)
virtual

Reimplemented from QWSWindowSurface.

Definition at line 1453 of file qwindowsurface_qws.cpp.

1454 {
1455 #ifndef QT_NO_THREAD
1456  threadLock.lock();
1457 #endif
1458  Q_UNUSED(timeout);
1459  if (doLocking)
1460  QWSDisplay::grab(true);
1461  return true;
1462 }
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
static void grab()
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ paintDevice()

QPaintDevice* QWSDirectPainterSurface::paintDevice ( )
inlinevirtual

Implement this function to return the appropriate paint device.

Implements QWSWindowSurface.

Definition at line 324 of file qwindowsurface_qws_p.h.

324 { return 0; }

◆ permanentState()

QByteArray QWSDirectPainterSurface::permanentState ( ) const
virtual

Implement this function to return the data required for creating a server-side representation of the surface.

Since
4.3
See also
attach()

Reimplemented from QWSWindowSurface.

Definition at line 1414 of file qwindowsurface_qws.cpp.

Referenced by setRegion().

1415 {
1416  QByteArray res;
1417  if (isRegionReserved())
1418  res.append( 'r');
1419  return res;
1420 }
QByteArray & append(char c)
Appends the character ch to this byte array.
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
bool isRegionReserved() const
Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false.

◆ region()

QRegion QWSDirectPainterSurface::region ( ) const
inline

Definition at line 312 of file qwindowsurface_qws_p.h.

312 { return clipRegion(); }
const QRegion clipRegion() const
Returns the region currently visible on the screen.

◆ screen()

QScreen* QWSDirectPainterSurface::screen ( ) const
inline

Definition at line 329 of file qwindowsurface_qws_p.h.

Referenced by qt_directpainter_region().

329 { return _screen; }

◆ setGeometry()

void QWSDirectPainterSurface::setGeometry ( const QRect rect)
inlinevirtual

Sets the currently allocated area to be the given rect.

This function is called whenever area covered by the top-level window changes.

See also
geometry()

Reimplemented from QWSWindowSurface.

Definition at line 309 of file qwindowsurface_qws_p.h.

Referenced by QDirectPainterPrivate::~QDirectPainterPrivate().

309 { setRegion(rect); }
void setRegion(const QRegion &region)

◆ setLocking()

void QWSDirectPainterSurface::setLocking ( bool  b)
inline

Definition at line 335 of file qwindowsurface_qws_p.h.

◆ setPermanentState()

void QWSDirectPainterSurface::setPermanentState ( const QByteArray data)
virtual

Implement this function to attach a server-side surface instance to the corresponding client side instance using the given data.

Since
4.3

Return true if successful; otherwise return false.

See also
data()

Reimplemented from QWSWindowSurface.

Definition at line 1422 of file qwindowsurface_qws.cpp.

1423 {
1424  if (ba.size() > 0 && ba.at(0) == 'r')
1425  setReserved();
1427 }
void setSurfaceFlags(SurfaceFlags type)
Sets the surface flags describing the contents of this surface, to be the given flags.
SurfaceFlags surfaceFlags() const
Returns the surface flags describing the contents of this surface.

◆ setRegion()

void QWSDirectPainterSurface::setRegion ( const QRegion region)

Definition at line 1399 of file qwindowsurface_qws.cpp.

1400 {
1401  const int id = winId();
1402  QWidget::qwsDisplay()->requestRegion(id, key(), permanentState(), region);
1403 #ifndef QT_NO_QWS_MULTIPROCESS
1404  if (synchronous)
1406 #endif
1407 }
static QWSDisplay * qwsDisplay()
QByteArray permanentState() const
Implement this function to return the data required for creating a server-side representation of the ...
void waitForRegionAck(int winId)
void requestRegion(int winId, const QString &surfacekey, const QByteArray &surfaceData, const QRegion &region)
QString key() const
Implement this function to return a string that uniquely identifies the class of this surface...
static QWSDisplay * instance()

◆ setReserved()

void QWSDirectPainterSurface::setReserved ( )
inline

Definition at line 307 of file qwindowsurface_qws_p.h.

Referenced by setPermanentState().

void setSurfaceFlags(SurfaceFlags type)
Sets the surface flags describing the contents of this surface, to be the given flags.

◆ unlock()

void QWSDirectPainterSurface::unlock ( )
virtual

Reimplemented from QWSWindowSurface.

Definition at line 1464 of file qwindowsurface_qws.cpp.

1465 {
1466  if (doLocking)
1468 #ifndef QT_NO_THREAD
1469  threadLock.unlock();
1470 #endif
1471 }
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
static void ungrab()

◆ windowId()

WId QWSDirectPainterSurface::windowId ( ) const
inline

Definition at line 327 of file qwindowsurface_qws_p.h.

Referenced by QDirectPainterPrivate::~QDirectPainterPrivate().

327 { return static_cast<WId>(winId()); }
unsigned long WId
Definition: qwindowdefs.h:119

Friends and Related Functions

◆ qt_directpainter_region

void qt_directpainter_region ( QDirectPainter ,
const QRegion ,
int   
)
friend

Definition at line 223 of file qdirectpainter_qws.cpp.

224 {
225  QDirectPainterPrivate *d = dp->d_func();
226 
227  QRegion r = alloc;
228  QScreen *screen = d->surface->screen();
229  if (screen->isTransformed()) {
230  const QSize screenSize(screen->width(), screen->height());
231  r = screen->mapToDevice(r, screenSize);
232  }
234  d->surface->setClipRegion(alloc);
235  d->seenRegion = true;
237  if (!d->surface->flushingRegionEvents) // recursion guard
238  dp->regionChanged(r);
239  }
240  }
241 }
QWSDirectPainterSurface * surface
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
virtual QSize mapToDevice(const QSize &) const
Maps the given size from the coordinate space used by the application to the framebuffer coordinate s...
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
virtual void regionChanged(const QRegion &exposedRegion)
This function is called when the allocated region changes.
void setClipRegion(const QRegion &)
Sets the region currently visible on the screen to be the given clip region.
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static QDirectPainter * staticPainter

Properties

◆ _screen

QScreen* QWSDirectPainterSurface::_screen
private

Definition at line 340 of file qwindowsurface_qws_p.h.

Referenced by QWSDirectPainterSurface().

◆ doLocking

bool QWSDirectPainterSurface::doLocking
private

Definition at line 348 of file qwindowsurface_qws_p.h.

Referenced by beginPaint(), lock(), and unlock().

◆ flushingRegionEvents

bool QWSDirectPainterSurface::flushingRegionEvents
private

Definition at line 346 of file qwindowsurface_qws_p.h.

Referenced by beginPaint(), and qt_directpainter_region().

◆ synchronous

bool QWSDirectPainterSurface::synchronous
private

◆ threadLock

QMutex QWSDirectPainterSurface::threadLock
private

Definition at line 342 of file qwindowsurface_qws_p.h.

Referenced by lock(), and unlock().


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