diff options
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qbackingstore.cpp | 11 | ||||
-rw-r--r-- | src/gui/painting/qdrawutil.cpp | 15 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_qws.cpp | 17 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_qws_p.h | 2 |
4 files changed, 39 insertions, 6 deletions
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index c73d9f4..8de9eaa 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -352,6 +352,10 @@ void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QWindowS // Always flush repainted areas. dirtyOnScreen += toClean; +#ifdef Q_WS_QWS + toClean.translate(tlwOffset); +#endif + #ifdef QT_NO_PAINT_DEBUG windowSurface->beginPaint(toClean); #else @@ -766,7 +770,12 @@ void QWidgetBackingStore::paintWindowDecoration() if (decorationRegion.isEmpty()) return; - windowSurface->beginPaint(decorationRegion); + //### The QWS decorations do not always paint the pixels they promise to paint. + // This causes painting problems with QWSMemorySurface. Since none of the other + // window surfaces actually use the region, passing an empty region is a safe + // workaround. + + windowSurface->beginPaint(QRegion()); QPaintEngine *engine = windowSurface->paintDevice()->paintEngine(); Q_ASSERT(engine); diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 5619a2e..35bf2bf 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1361,14 +1361,21 @@ void qDrawPixmaps(QPainter *painter, const QDrawPixmaps::Data *drawingData, int for (int i = 0; i < dataCount; ++i) { QTransform transform = oldTransform; - transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); - transform.rotate(drawingData[i].rotation); - painter->setOpacity(oldOpacity * drawingData[i].opacity); + qreal xOffset = 0; + qreal yOffset = 0; + if (drawingData[i].rotation == 0) { + xOffset = drawingData[i].point.x(); + yOffset = drawingData[i].point.y(); + } else { + transform.translate(drawingData[i].point.x(), drawingData[i].point.y()); + transform.rotate(drawingData[i].rotation); + } painter->setTransform(transform); + painter->setOpacity(oldOpacity * drawingData[i].opacity); qreal w = drawingData[i].scaleX * drawingData[i].source.width(); qreal h = drawingData[i].scaleY * drawingData[i].source.height(); - painter->drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source); + painter->drawPixmap(QRectF(-0.5 * w + xOffset, -0.5 * h + yOffset, w, h), pixmap, drawingData[i].source); } painter->setOpacity(oldOpacity); diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index d3fc9de..a816ed2 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -80,7 +80,7 @@ static void qt_insertWindowSurface(int winId, QWSWindowSurface *surface) inline bool isWidgetOpaque(const QWidget *w) { - return w->d_func()->isOpaque; + return w->d_func()->isOpaque && !w->testAttribute(Qt::WA_TranslucentBackground); } static inline QScreen *getScreen(const QWidget *w) @@ -873,6 +873,21 @@ bool QWSMemorySurface::isValid() const return true; } +// ### copied from qwindowsurface_raster.cpp -- should be cross-platform +void QWSMemorySurface::beginPaint(const QRegion &rgn) +{ + if (!isWidgetOpaque(window())) { + QPainter p(&img); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector<QRect> rects = rgn.rects(); + const QColor blank = Qt::transparent; + for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { + p.fillRect(*it, blank); + } + } + QWSWindowSurface::beginPaint(rgn); +} + // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); diff --git a/src/gui/painting/qwindowsurface_qws_p.h b/src/gui/painting/qwindowsurface_qws_p.h index a8371c8..30900dc 100644 --- a/src/gui/painting/qwindowsurface_qws_p.h +++ b/src/gui/painting/qwindowsurface_qws_p.h @@ -176,6 +176,8 @@ public: QImage image() const { return img; } QPoint painterOffset() const; + void beginPaint(const QRegion &rgn); + bool lock(int timeout = -1); void unlock(); |