summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qpainter.cpp')
-rw-r--r--src/gui/painting/qpainter.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 1d10d75..8e64f3b 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -9248,6 +9248,52 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment
}
/*!
+ \since 4.8
+
+ This function is used to draw the same \a pixmap with multiple target
+ and source rectangles. If \a sourceRects is 0, the whole pixmap will be
+ rendered at each of the target rectangles. The \a hints parameter can be
+ used to pass in drawing hints.
+
+ This function is potentially faster than multiple calls to drawPixmap(),
+ since the backend can optimize state changes.
+
+ \sa QPainter::PixmapFragmentHint
+*/
+
+void QPainter::drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount,
+ const QPixmap &pixmap, PixmapFragmentHints hints)
+{
+ Q_D(QPainter);
+
+ if (!d->engine || pixmap.isNull())
+ return;
+
+#ifndef QT_NO_DEBUG
+ if (sourceRects) {
+ for (int i = 0; i < fragmentCount; ++i) {
+ QRectF sourceRect = sourceRects[i];
+ 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(targetRects, sourceRects, fragmentCount, pixmap, hints);
+ } else {
+ if (sourceRects) {
+ for (int i = 0; i < fragmentCount; ++i)
+ drawPixmap(targetRects[i], pixmap, sourceRects[i]);
+ } else {
+ QRectF sourceRect = pixmap.rect();
+ for (int i = 0; i < fragmentCount; ++i)
+ drawPixmap(targetRects[i], pixmap, sourceRect);
+ }
+ }
+}
+
+/*!
\since 4.7
\class QPainter::PixmapFragment