src/gui/painting/qwindowsurface.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    47 QT_BEGIN_NAMESPACE
    47 QT_BEGIN_NAMESPACE
    48 
    48 
    49 class QWindowSurfacePrivate
    49 class QWindowSurfacePrivate
    50 {
    50 {
    51 public:
    51 public:
    52     QWindowSurfacePrivate(QWidget *w) : window(w), staticContentsSupport(false) {}
    52     QWindowSurfacePrivate(QWidget *w)
       
    53         : window(w)
       
    54         , staticContentsSupport(0)
       
    55         , partialUpdateSupport(1)
       
    56     {
       
    57     }
    53 
    58 
    54     QWidget *window;
    59     QWidget *window;
    55     QRect geometry;
    60     QRect geometry;
    56     QRegion staticContents;
    61     QRegion staticContents;
    57     QList<QImage*> bufferImages;
    62     QList<QImage*> bufferImages;
    58     bool staticContentsSupport;
    63     uint staticContentsSupport : 1;
       
    64     uint partialUpdateSupport : 1;
    59 };
    65 };
    60 
    66 
    61 /*!
    67 /*!
    62     \class QWindowSurface
    68     \class QWindowSurface
    63     \since 4.3
    69     \since 4.3
   282     return d_ptr->staticContentsSupport;
   288     return d_ptr->staticContentsSupport;
   283 }
   289 }
   284 
   290 
   285 void QWindowSurface::setStaticContentsSupport(bool enable)
   291 void QWindowSurface::setStaticContentsSupport(bool enable)
   286 {
   292 {
       
   293     if (enable && !d_ptr->partialUpdateSupport) {
       
   294         qWarning("QWindowSurface::setStaticContentsSupport: static contents support requires partial update support");
       
   295         return;
       
   296     }
   287     d_ptr->staticContentsSupport = enable;
   297     d_ptr->staticContentsSupport = enable;
   288 }
   298 }
   289 
   299 
   290 void QWindowSurface::setStaticContents(const QRegion &region)
   300 void QWindowSurface::setStaticContents(const QRegion &region)
   291 {
   301 {
   298 }
   308 }
   299 
   309 
   300 bool QWindowSurface::hasStaticContents() const
   310 bool QWindowSurface::hasStaticContents() const
   301 {
   311 {
   302     return d_ptr->staticContentsSupport && !d_ptr->staticContents.isEmpty();
   312     return d_ptr->staticContentsSupport && !d_ptr->staticContents.isEmpty();
       
   313 }
       
   314 
       
   315 bool QWindowSurface::hasPartialUpdateSupport() const
       
   316 {
       
   317     return d_ptr->partialUpdateSupport;
       
   318 }
       
   319 
       
   320 void QWindowSurface::setPartialUpdateSupport(bool enable)
       
   321 {
       
   322     if (!enable && d_ptr->staticContentsSupport) {
       
   323         qWarning("QWindowSurface::setPartialUpdateSupport: static contents support requires partial update support");
       
   324         return;
       
   325     }
       
   326     d_ptr->partialUpdateSupport = enable;
   303 }
   327 }
   304 
   328 
   305 void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
   329 void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
   306 {
   330 {
   307     // make sure we don't detach
   331     // make sure we don't detach