summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-11-03 11:10:01 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-11-03 11:50:11 (GMT)
commitacc1a2bd5520369c690c2769f067aec6bfd869f2 (patch)
tree02fdfc292c9fc8e51275c8c2ce8327e2611c614f /src/gui
parent966613212de269421944a5df355f54c5a6b36c17 (diff)
downloadQt-acc1a2bd5520369c690c2769f067aec6bfd869f2.zip
Qt-acc1a2bd5520369c690c2769f067aec6bfd869f2.tar.gz
Qt-acc1a2bd5520369c690c2769f067aec6bfd869f2.tar.bz2
Fixed grabWidget sometimes returning uninitialized memory.
Use a QImage initialized with transparent to prevent any translucent parts of the widget to end up as garbage, and to ensure that the resulting QPixmap ends up with an alpha format only when needed. Task-number: QTBUG-14945 Reviewed-by: Kim
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qpixmap.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 64d8ed2..290c0f0 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1101,10 +1101,11 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect)
if (!r.intersects(widget->rect()))
return QPixmap();
- QPixmap res(r.size());
+ QImage res(r.size(), QImage::Format_ARGB32_Premultiplied);
+ res.fill(0);
widget->d_func()->render(&res, QPoint(), r, QWidget::DrawWindowBackground
| QWidget::DrawChildren | QWidget::IgnoreMask, true);
- return res;
+ return QPixmap::fromImage(res);
}
/*!