src/gui/painting/qwindowsurface_qws.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
    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 {