summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorAndy Shaw <qt-info@nokia.com>2010-07-05 07:11:33 (GMT)
committerAndy Shaw <qt-info@nokia.com>2010-07-05 07:11:33 (GMT)
commitd2b17542aabb4236022ce7edf5f005cc6ebfc0e1 (patch)
tree2bd548b7f958a3e27b593272b31e8574474da738 /src/gui/painting
parentb8a390950552ba55b2d930636ee4ba11388d46f6 (diff)
downloadQt-d2b17542aabb4236022ce7edf5f005cc6ebfc0e1.zip
Qt-d2b17542aabb4236022ce7edf5f005cc6ebfc0e1.tar.gz
Qt-d2b17542aabb4236022ce7edf5f005cc6ebfc0e1.tar.bz2
Warn when drawPixmapFragments is called with an invalid source rect
When drawPixmapFragments() is called with fragments that has invalid source rects in it, then usually it causes the pixmap drawn on screen to appear corrupted. However it has been reported that a crash can occur (not reproducable locally) so by adding a warning in debug mode only means that this can hopefully be caught at development time. Reviewed-by: Trond
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qpainter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 2ea6673..9dadbd5 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -8969,6 +8969,15 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment
if (!d->engine)
return;
+#ifndef QT_NO_DEBUG
+ for (int i = 0; i < fragmentCount; ++i) {
+ QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
+ fragments[i].width, fragments[i].height);
+ if (!(QRectF(pixmap.rect()).contains(sourceRect)))
+ qWarning("QPainter::drawPixmapFragments - the source rect is not contained by the pixmap's rectangle");
+ }
+#endif
+
if (d->engine->isExtended()) {
d->extended->drawPixmapFragments(fragments, fragmentCount, pixmap, hints);
} else {