diff options
author | Aleix Pol <aleixpol@kde.org> | 2013-12-13 20:20:09 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-18 15:35:40 +0100 |
commit | 446f9f2812e9f351caca11750792dadbd4e53662 (patch) | |
tree | ed0e6668e4e78648e3e9c48bd8210ca870d85417 | |
parent | b095479d1418d7dc83a5b15f1d8118b39f768b16 (diff) |
Fix QPixmap and OpenGL threading warnings when painting
If the QPA supports threaded pixmaps, don't print out a message warning
the user about painting a pixmap in the non-main thread.
Likewise, if the QPA supports threaded OpenGL, don't print out a warning
when the user is about to paint on OpenGL from a non-main thread.
Change-Id: I5b4928ee49b1d6c1b638b036fade12dc794258df
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
-rw-r--r-- | src/gui/painting/qpainter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 424ed554a2..41a2e39fc9 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -62,6 +62,7 @@ #include "qglyphrun.h" #include <qpa/qplatformtheme.h> +#include <qpa/qplatformintegration.h> #include <private/qfontengine_p.h> #include <private/qpaintengine_p.h> @@ -155,7 +156,9 @@ static bool qt_painter_thread_test(int devType, const char *what) // can be drawn onto these devices safely from any thread break; default: - if (QThread::currentThread() != qApp->thread()) { + if (QThread::currentThread() != qApp->thread() + && (devType!=QInternal::Pixmap || !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) + && (devType!=QInternal::OpenGL || !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL))) { qWarning("QPainter: It is not safe to use %s outside the GUI thread", what); return false; } |