src/gui/painting/qwindowsurface_qws.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 37 758a864f9613
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
    78 
    78 
    79 #endif // Q_BACKINGSTORE_SUBSURFACES
    79 #endif // Q_BACKINGSTORE_SUBSURFACES
    80 
    80 
    81 inline bool isWidgetOpaque(const QWidget *w)
    81 inline bool isWidgetOpaque(const QWidget *w)
    82 {
    82 {
    83     return w->d_func()->isOpaque;
    83     return w->d_func()->isOpaque && !w->testAttribute(Qt::WA_TranslucentBackground);
    84 }
    84 }
    85 
    85 
    86 static inline QScreen *getScreen(const QWidget *w)
    86 static inline QScreen *getScreen(const QWidget *w)
    87 {
    87 {
    88     const QList<QScreen*> subScreens = qt_screen->subScreens();
    88     const QList<QScreen*> subScreens = qt_screen->subScreens();
   871         return false;
   871         return false;
   872 
   872 
   873     return true;
   873     return true;
   874 }
   874 }
   875 
   875 
       
   876 // ### copied from qwindowsurface_raster.cpp -- should be cross-platform
       
   877 void QWSMemorySurface::beginPaint(const QRegion &rgn)
       
   878 {
       
   879     if (!isWidgetOpaque(window())) {
       
   880         QPainter p(&img);
       
   881         p.setCompositionMode(QPainter::CompositionMode_Source);
       
   882         const QVector<QRect> rects = rgn.rects();
       
   883         const QColor blank = Qt::transparent;
       
   884         for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
       
   885             p.fillRect(*it, blank);
       
   886         }
       
   887     }
       
   888     QWSWindowSurface::beginPaint(rgn);
       
   889 }
       
   890 
   876 // from qwindowsurface.cpp
   891 // from qwindowsurface.cpp
   877 extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
   892 extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
   878 
   893 
   879 bool QWSMemorySurface::scroll(const QRegion &area, int dx, int dy)
   894 bool QWSMemorySurface::scroll(const QRegion &area, int dx, int dy)
   880 {
   895 {