Qt 4.8
Public Functions | Properties | List of all members
QTraceWindowSurface Class Reference
Inheritance diagram for QTraceWindowSurface:
QRasterWindowSurface QWindowSurface

Public Functions

void beginPaint (const QRegion &rgn)
 This function is called before painting onto the surface begins, with the region in which the painting will occur. More...
 
void endPaint (const QRegion &rgn)
 This function is called after painting onto the surface has ended, with the region in which the painting was performed. More...
 
QPaintDevicepaintDevice ()
 Implement this function to return the appropriate paint device. More...
 
 QTraceWindowSurface (QWidget *widget)
 
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...
 
 ~QTraceWindowSurface ()
 
- Public Functions inherited from QRasterWindowSurface
WindowSurfaceFeatures features () const
 
void flush (QWidget *widget, const QRegion &region, const QPoint &offset)
 Flushes the given region from the specified widget onto the screen. More...
 
 QRasterWindowSurface (QWidget *widget, bool setDefaultSurface=true)
 
void setGeometry (const QRect &rect)
 Sets the currently allocated area to be the given rect. More...
 
 ~QRasterWindowSurface ()
 
- 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...
 
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...
 
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

QPaintBufferbuffer
 
QList< QRegionupdates
 
qulonglong winId
 

Additional Inherited Members

- Public Types inherited from QWindowSurface
enum  WindowSurfaceFeature { PartialUpdates = 0x00000001, PreservedContents = 0x00000002, StaticContents = 0x00000004, AllFeatures = 0xffffffff }
 
- Protected Functions inherited from QWindowSurface
bool hasStaticContents () const
 

Detailed Description

Definition at line 53 of file qgraphicssystem_trace.cpp.

Constructors and Destructors

◆ QTraceWindowSurface()

QTraceWindowSurface::QTraceWindowSurface ( QWidget widget)

Definition at line 72 of file qgraphicssystem_trace.cpp.

Referenced by QTraceGraphicsSystem::createWindowSurface().

73  : QRasterWindowSurface(widget)
74  , buffer(0)
75  , winId(0)
76 {
77 }
QRasterWindowSurface(QWidget *widget, bool setDefaultSurface=true)

◆ ~QTraceWindowSurface()

QTraceWindowSurface::~QTraceWindowSurface ( )

Definition at line 79 of file qgraphicssystem_trace.cpp.

80 {
81  if (buffer) {
82  QFile outputFile(QString(QLatin1String("qtgraphics-%0.trace")).arg(winId));
83  if (outputFile.open(QIODevice::WriteOnly)) {
84  QDataStream out(&outputFile);
85  out.setFloatingPointPrecision(QDataStream::SinglePrecision);
86 
87  out.writeBytes("qttraceV2", 9);
88 
89  uint version = 1;
90 
91  out << version << *buffer << updates;
92  }
93  delete buffer;
94  }
95 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
unsigned int uint
Definition: qglobal.h:996
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71

Functions

◆ beginPaint()

void QTraceWindowSurface::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 QRasterWindowSurface.

Definition at line 110 of file qgraphicssystem_trace.cpp.

111 {
112  // ensure paint buffer is created
113  paintDevice();
115 
117 }
void beginPaint(const QRegion &rgn)
This function is called before painting onto the surface begins, with the region in which the paintin...
QPaintDevice * paintDevice()
Implement this function to return the appropriate paint device.
void beginNewFrame()

◆ endPaint()

void QTraceWindowSurface::endPaint ( const QRegion region)
virtual

This function is called after painting onto the surface has ended, with the region in which the painting was performed.

See also
beginPaint(), paintDevice()

Reimplemented from QWindowSurface.

Definition at line 119 of file qgraphicssystem_trace.cpp.

120 {
122  buffer->draw(&p, buffer->numFrames()-1);
123  p.end();
124 
125  winId = (qulonglong)window()->winId();
126 
127  updates << rgn;
128 
130 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
void draw(QPainter *painter, int frame=0) const
virtual void endPaint(const QRegion &)
This function is called after painting onto the surface has ended, with the region in which the paint...
QPaintDevice * paintDevice()
Implement this function to return the appropriate paint device.
int numFrames() const
WId winId() const
Returns the window system identifier of the widget.
Definition: qwidget.cpp:2557
quint64 qulonglong
Definition: qglobal.h:952
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

◆ paintDevice()

QPaintDevice * QTraceWindowSurface::paintDevice ( )
virtual

Implement this function to return the appropriate paint device.

Reimplemented from QRasterWindowSurface.

Definition at line 97 of file qgraphicssystem_trace.cpp.

Referenced by beginPaint().

98 {
99  if (!buffer) {
100  buffer = new QPaintBuffer;
101 #ifdef Q_WS_QPA
102  buffer->setBoundingRect(QRect(QPoint(), size()));
103 #else
105 #endif
106  }
107  return buffer;
108 }
QRect geometry() const
Returns the currently allocated area on the screen.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void setBoundingRect(const QRectF &rect)

◆ scroll()

bool QTraceWindowSurface::scroll ( const QRegion area,
int  dx,
int  dy 
)
virtual

Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative.

Returns true if the area was scrolled successfully; false otherwise.

Reimplemented from QRasterWindowSurface.

Definition at line 132 of file qgraphicssystem_trace.cpp.

133 {
134  // TODO: scrolling should also be streamed and replayed
135  // to test scrolling performance
136  return false;
137 }

Properties

◆ buffer

QPaintBuffer* QTraceWindowSurface::buffer
private

Definition at line 66 of file qgraphicssystem_trace.cpp.

Referenced by beginPaint(), endPaint(), paintDevice(), and ~QTraceWindowSurface().

◆ updates

QList<QRegion> QTraceWindowSurface::updates
private

Definition at line 67 of file qgraphicssystem_trace.cpp.

Referenced by endPaint(), and ~QTraceWindowSurface().

◆ winId

qulonglong QTraceWindowSurface::winId
private

Definition at line 69 of file qgraphicssystem_trace.cpp.

Referenced by endPaint(), and ~QTraceWindowSurface().


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