diff options
author | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-09-23 09:35:02 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond.kjernasen@nokia.com> | 2010-09-23 09:38:55 (GMT) |
commit | 3f90a835f43258b5c19f82da8a0f1e4d1b348e42 (patch) | |
tree | 16f734936c3687b81b57e46c98e241df7f6a0ff5 /src/gui/image | |
parent | 932e67e3e817f0e2625ff60594e6e536920a329a (diff) | |
download | Qt-3f90a835f43258b5c19f82da8a0f1e4d1b348e42.zip Qt-3f90a835f43258b5c19f82da8a0f1e4d1b348e42.tar.gz Qt-3f90a835f43258b5c19f82da8a0f1e4d1b348e42.tar.bz2 |
Fixed QPixmap::resize() for X11 pixmap with masks.
Regression from 4.6. Made the tst_QPixmap::resizePreserveMask() test
fail.
Reviewed-by: Samuel
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qpixmap.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 1e502bd..6a13f49 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -664,14 +664,19 @@ void QPixmap::resize_helper(const QSize &s) #if defined(Q_WS_X11) if (x11Data && x11Data->x11_mask) { - QX11PixmapData *pmData = static_cast<QX11PixmapData*>(pd); - pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display, - RootWindow(x11Data->xinfo.display(), - x11Data->xinfo.screen()), - w, h, 1); - GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0); - XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0, qMin(width(), w), qMin(height(), h), 0, 0); - XFreeGC(X11->display, gc); + QPixmapData *newPd = pm.pixmapData(); + QX11PixmapData *pmData = (newPd && newPd->classId() == QPixmapData::X11Class) + ? static_cast<QX11PixmapData*>(newPd) : 0; + if (pmData) { + pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display, + RootWindow(x11Data->xinfo.display(), + x11Data->xinfo.screen()), + w, h, 1); + GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0); + XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0, + qMin(width(), w), qMin(height(), h), 0, 0); + XFreeGC(X11->display, gc); + } } #endif *this = pm; @@ -836,7 +841,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers % HexString<quint64>(info.size()) % HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType); - // Note: If no extension is provided, we try to match the + // Note: If no extension is provided, we try to match the // file against known plugin extensions if (!info.completeSuffix().isEmpty() && !info.exists()) return false; |