src/gui/painting/qbackingstore.cpp File Reference

#include <qglobal.h>
#include <qapplication.h>
#include "qbackingstore_p.h"
#include "private/qwidget_p.h"
#include <qdebug.h>
#include <qstack.h>
#include <qevent.h>
#include <qabstractscrollarea.h>
#include "private/qabstractscrollarea_p.h"
#include "private/qt_x11_p.h"
#include "qwindowsurface_raster_p.h"
#include "qwindowsurface_x11_p.h"

Include dependency graph for qbackingstore.cpp:

Go to the source code of this file.

Functions

bool qt_sendSpontaneousEvent (QObject *, QEvent *)
Q_GUI_EXPORT void qt_x11_set_global_double_buffer (bool enable)
static void qt_showYellowThing (QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped)
static bool qt_flushPaint (QWidget *widget, const QRegion &toBePainted)
static void qt_unflushPaint (QWidget *widget, const QRegion &rgn)
static bool qt_flushUpdate (QWidget *widget, const QRegion &rgn)
void qt_syncBackingStore (QRegion rgn, QWidget *widget, bool recursive)
void qt_syncBackingStore (QRegion rgn, QWidget *widget)
QWindowSurfaceqt_default_window_surface (QWidget *widget)
void qt_syncBackingStore (QWidget *widget)
static bool qRectIntersects (const QRect &r1, const QRect &r2)

Variables

static bool qt_enable_backingstore = true


Function Documentation

static bool qRectIntersects ( const QRect r1,
const QRect r2 
) [inline, static]

Definition at line 305 of file qbackingstore.cpp.

References QRect::bottom(), QRect::left(), qMax(), qMin(), QRect::right(), and QRect::top().

Referenced by QWidgetBackingStore::copyToScreen(), and QWidgetBackingStore::paintSiblingsRecursive().

00306 {
00307     return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) &&
00308              qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));
00309 }

Here is the call graph for this function:

QWindowSurface* qt_default_window_surface ( QWidget widget  ) 

Definition at line 226 of file qbackingstore.cpp.

References Qt::Desktop, and QWidget::windowType().

Referenced by QWidgetBackingStore::cleanRegion(), and QWidgetBackingStore::QWidgetBackingStore().

00227 {
00228 #ifdef Q_WS_WIN
00229     return new QRasterWindowSurface(widget);
00230 #elif defined(Q_WS_X11)
00231     return new QX11WindowSurface(widget);
00232 #elif defined(Q_WS_QWS)
00233     if (widget->windowType() == Qt::Desktop)
00234         return 0;
00235     return qt_screen->createSurface(widget);
00236 #else
00237     Q_UNUSED(widget);
00238     return 0;
00239 #endif
00240 }

Here is the call graph for this function:

static bool qt_flushPaint ( QWidget widget,
const QRegion toBePainted 
) [static]

Definition at line 175 of file qbackingstore.cpp.

References qgetenv(), qt_showYellowThing(), and QByteArray::toInt().

Referenced by QWidgetPrivate::drawWidget(), and QWidget::repaint().

00176 {
00177     static int checked_env = -1;
00178     if(checked_env == -1)
00179         checked_env = qgetenv("QT_FLUSH_PAINT").toInt();
00180 
00181     if (checked_env == 0)
00182         return false;
00183 
00184     qt_showYellowThing(widget, toBePainted, checked_env*10, true);
00185 
00186     return true;
00187 }

Here is the call graph for this function:

static bool qt_flushUpdate ( QWidget widget,
const QRegion rgn 
) [static]

Definition at line 196 of file qbackingstore.cpp.

References qgetenv(), qt_showYellowThing(), and QByteArray::toInt().

Referenced by QWidgetBackingStore::copyToScreen().

00197 {
00198     static int checked_env = -1;
00199     if(checked_env == -1) {
00200         checked_env = qgetenv("QT_FLUSH_UPDATE").toInt();
00201     }
00202 
00203     if (checked_env == 0)
00204         return false;
00205 
00206     qt_showYellowThing(widget, rgn, checked_env*10, false);
00207 
00208     return true;
00209 }

Here is the call graph for this function:

bool qt_sendSpontaneousEvent ( QObject ,
QEvent  
)

Definition at line 4185 of file qapplication_x11.cpp.

References QCoreApplication::sendSpontaneousEvent().

Referenced by QKeyMapper::changeKeyboard(), QWidgetPrivate::drawWidget(), and QKeyMapper::sendKeyEvent().

04186 {
04187     return QCoreApplication::sendSpontaneousEvent(receiver, event);
04188 }

Here is the call graph for this function:

static void qt_showYellowThing ( QWidget widget,
const QRegion toBePainted,
int  msec,
bool  unclipped 
) [static]

Definition at line 108 of file qbackingstore.cpp.

References i, p, QWidgetBackingStore::paintOnScreen(), QPaintEngine::Raster, QPaintEngine::setSystemClip(), QApplication::syncX(), QWidget::testAttribute(), QPaintEngine::type(), Qt::WA_PaintUnclipped, and Qt::WA_WState_InPaintEvent.

Referenced by qt_flushPaint(), and qt_flushUpdate().

00109 {
00110     //flags to fool painter
00111     bool paintUnclipped = widget->testAttribute(Qt::WA_PaintUnclipped);
00112     if (unclipped && !QWidgetBackingStore::paintOnScreen(widget))
00113         widget->setAttribute(Qt::WA_PaintUnclipped);
00114 
00115     bool setFlag = !widget->testAttribute(Qt::WA_WState_InPaintEvent);
00116     if(setFlag)
00117         widget->setAttribute(Qt::WA_WState_InPaintEvent);
00118 
00119 
00120     static int i = 0;
00121 
00122     //setup the engine
00123     QPaintEngine *pe = widget->paintEngine();
00124     if (pe) {
00125         pe->setSystemClip(toBePainted);
00126         {
00127             QPainter p(widget);
00128             p.setClipRegion(toBePainted);
00129 
00130             switch (i) {
00131             case 0:
00132                 p.fillRect(widget->rect(), QColor(255,255,0));
00133                 break;
00134             case 1:
00135                 p.fillRect(widget->rect(), QColor(255,200,55));
00136                 break;
00137             case 2:
00138                 p.fillRect(widget->rect(), QColor(200,255,55));
00139                 break;
00140             case 3:
00141                 p.fillRect(widget->rect(), QColor(200,200,0));
00142                 break;
00143             }
00144             i = (i+1) & 3;
00145             p.end();
00146         }
00147     }
00148 
00149     if(setFlag)
00150         widget->setAttribute(Qt::WA_WState_InPaintEvent, false);
00151 
00152     //restore
00153     widget->setAttribute(Qt::WA_PaintUnclipped, paintUnclipped);
00154 
00155     if (pe) {
00156         pe->setSystemClip(QRegion());
00157         //flush
00158         if (pe->type() == QPaintEngine::Raster) {
00159             QRasterPaintEngine *rpe = static_cast<QRasterPaintEngine *>(pe);
00160             rpe->flush(widget, QPoint());
00161         }
00162     }
00163 
00164     QApplication::syncX();
00165 
00166 #if defined(Q_OS_UNIX)
00167     ::usleep(1000*msec);
00168 #elif defined(Q_OS_WIN)
00169     ::Sleep(msec);
00170 #endif
00171 
00172 }

Here is the call graph for this function:

void qt_syncBackingStore ( QWidget widget  ) 

Definition at line 264 of file qbackingstore.cpp.

References QWidgetBackingStore::cleanRegion(), QWidgetBackingStore::paintOnScreen(), and QWidget::window().

00265 {
00266     // dirtyOnScreen may get out of sync when widget is scrolled or moved
00267     widget->d_func()->dirtyOnScreen &= widget->d_func()->clipRect();
00268 
00269     const QRegion dirty =  widget->d_func()->dirtyOnScreen;
00270     QWidget *tlw = widget->window();
00271     if (!QWidgetBackingStore::paintOnScreen(widget)) {
00272         QWidgetBackingStore *bs = tlw->d_func()->topData()->backingStore;
00273         bs->cleanRegion(dirty, widget);
00274     } else {
00275         widget->repaint(dirty);
00276     }
00277 }

Here is the call graph for this function:

void qt_syncBackingStore ( QRegion  rgn,
QWidget widget 
)

Definition at line 221 of file qbackingstore.cpp.

References qt_syncBackingStore().

00222 {
00223     qt_syncBackingStore(rgn, widget, false);
00224 }

Here is the call graph for this function:

void qt_syncBackingStore ( QRegion  rgn,
QWidget widget,
bool  recursive 
)

Definition at line 212 of file qbackingstore.cpp.

References QWidgetBackingStore::paintOnScreen().

Referenced by qt_syncBackingStore().

00213 {
00214     if (!QWidgetBackingStore::paintOnScreen(widget)) {
00215         if (QWidgetBackingStore *bs = widget->d_func()->maybeBackingStore())
00216             bs->cleanRegion(rgn, widget, recursive);
00217     } else {
00218         widget->repaint(rgn);
00219     }
00220 }

Here is the call graph for this function:

static void qt_unflushPaint ( QWidget widget,
const QRegion rgn 
) [static]

Definition at line 189 of file qbackingstore.cpp.

References QWidgetBackingStore::copyToScreen(), and QWidgetBackingStore::paintOnScreen().

Referenced by QWidgetPrivate::drawWidget().

00190 {
00191     if (!QWidgetBackingStore::paintOnScreen(widget))
00192         QWidgetBackingStore::copyToScreen(widget, rgn);
00193 }

Here is the call graph for this function:

Q_GUI_EXPORT void qt_x11_set_global_double_buffer ( bool  enable  ) 

Definition at line 67 of file qbackingstore.cpp.

References qt_enable_backingstore.

00068 {
00069     qt_enable_backingstore = enable;
00070 }


Variable Documentation

bool qt_enable_backingstore = true [static]

Definition at line 63 of file qbackingstore.cpp.

Referenced by QWidgetBackingStore::paintOnScreen(), and qt_x11_set_global_double_buffer().


Generated on Thu Mar 15 13:31:33 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1