From 29d8159c4478a5275d2ea102daf270a91ed7e92e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 29 Jan 2016 10:43:35 +0100 Subject: Avoid repeated QByteArray creation when resolving opengl functions Add an getProcAddress(const char *) overload to QOpenGLContext, and refactor the QPA interface to take a const char *. Like this we can avoid lots of mallocs when resoving GL methods. Change-Id: Ic45b985fbaa0da8d32ba3e3b485351173352ca6f Reviewed-by: Laszlo Agocs Reviewed-by: Sean Harmer --- src/plugins/platforms/directfb/qdirectfbglcontext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/directfb') diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp index 1136591c78..e1607b131a 100644 --- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp @@ -80,10 +80,10 @@ void QDirectFbGLContext::doneCurrent() m_dfbGlContext->Unlock(m_dfbGlContext); } -void *QDirectFbGLContext::getProcAddress(const QString &procName) +void *QDirectFbGLContext::getProcAddress(const char *procName) { void *proc; - DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext,qPrintable(procName),&proc); + DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext, procName, &proc); if (result == DFB_OK) return proc; return 0; -- cgit v1.2.3 From 5e9a5246fb688a33ff27bed010226595f579f23d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 2 Feb 2016 12:50:33 +0100 Subject: Ensure we can query all GL functions in all platform plugins This is required to simplify our code in the opengl classes and makes it possible to remove OS dependent code paths in Qt Gui. Change-Id: Ice09440840c86b2d6ac8d3955d273846695338d4 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/directfb/qdirectfbglcontext.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/directfb') diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp index e1607b131a..847435d96e 100644 --- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp @@ -40,6 +40,7 @@ #include "qdirectfbglcontext.h" #include +#include #include @@ -80,13 +81,13 @@ void QDirectFbGLContext::doneCurrent() m_dfbGlContext->Unlock(m_dfbGlContext); } -void *QDirectFbGLContext::getProcAddress(const char *procName) +QFunctionPointer QDirectFbGLContext::getProcAddress(const char *procName) { void *proc; DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext, procName, &proc); if (result == DFB_OK) - return proc; - return 0; + return (QFunctionPointer) proc; + return dlsym(RTLD_DEFAULT, procName); } void QDirectFbGLContext::swapBuffers() -- cgit v1.2.3 From d0cdc7ad1e2728caf363abf328b2ad81f2ed5a5b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 2 Mar 2016 22:17:13 -0800 Subject: DirectFB: Fix build in C++98 mode Many DirectFB types have constructors in C++, so we can't initialize them with = {...}, like we would be able to if they had been regular POD types. Change-Id: Ic747cc2ab45e4dc6bb70ffff143840e5780ac2bc Reviewed-by: Lars Knoll Reviewed-by: Andy Nichols --- src/plugins/platforms/directfb/qdirectfbbackingstore.cpp | 6 +++--- src/plugins/platforms/directfb/qdirectfbblitter.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms/directfb') diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp index 369fa3b9f8..8fe4bca788 100644 --- a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp +++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp @@ -67,7 +67,7 @@ void QDirectFbBackingStore::flush(QWindow *, const QRegion ®ion, const QPoint QVector rects = region.rects(); for (int i = 0 ; i < rects.size(); i++) { const QRect rect = rects.at(i); - DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; + DFBRegion dfbReg(rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()); m_dfbSurface->Flip(m_dfbSurface.data(), &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); } } @@ -86,9 +86,9 @@ void QDirectFbBackingStore::resize(const QSize &size, const QRegion& reg) static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) { - const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; + const DFBRectangle rect(r.x(), r.y(), r.width(), r.height()); surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); - const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; + const DFBRegion region(rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy); surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); } diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp index b87310ed76..75af3f74d6 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp +++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp @@ -173,8 +173,8 @@ void QDirectFbBlitter::drawPixmapOpacity(const QRectF &rect, const QPixmap &pixm { QRect sQRect = subrect.toRect(); QRect dQRect = rect.toRect(); - DFBRectangle sRect = { sQRect.x(), sQRect.y(), sQRect.width(), sQRect.height() }; - DFBRectangle dRect = { dQRect.x(), dQRect.y(), dQRect.width(), dQRect.height() }; + DFBRectangle sRect(sQRect.x(), sQRect.y(), sQRect.width(), sQRect.height()); + DFBRectangle dRect(dQRect.x(), dQRect.y(), dQRect.width(), dQRect.height()); DFBResult result; // skip if dst too small -- cgit v1.2.3 From a28364bc1c7144b9c5c383cc5d18d62a68076a38 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 12 Feb 2016 16:03:42 +0100 Subject: consistently put {qt,qml}_{module,plugin} at the end of project files this fixes static builds by ensuring that all dependencies are exported. Task-number: QTBUG-51071 Change-Id: Icbce502dcbcb4d4b4d922c42679f44e2cc930bf3 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/directfb/directfb.pro | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/plugins/platforms/directfb') diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index 89d8d42cea..5c81e0283a 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -1,10 +1,5 @@ TARGET = qdirectfb -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QDirectFbIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) - QT += core-private gui-private platformsupport-private LIBS += $$QMAKE_LIBS_DIRECTFB @@ -51,3 +46,8 @@ contains(QT_CONFIG, directfb_egl) { CONFIG += qpa/genericunixfontdatabase OTHER_FILES += directfb.json + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QDirectFbIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) -- cgit v1.2.3 From 6417bbde8565e0be2d049426b71e6fda538e4440 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 17 Oct 2015 17:48:34 +0200 Subject: QtBase (remainder): use printf-style qWarning/qDebug where possible (I) The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Had to fix broken qImDebug() definition. Instead of defining it as a nullary macro in the QT_NO_DEBUG case and as a variadic macro in the other, define it in both cases, as is customary, as a non-function macro so that overload selection works without requiring variadic macro support of the compiler. Saves e.g. ~250b in text size in QtPrintSupport on optimized GCC 5.3 AMD64 builds. Change-Id: Ie30fe2f7942115d5dbf99fff1750ae0d477c379f Reviewed-by: Kai Koehne --- src/plugins/platforms/directfb/qdirectfbglcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/directfb') diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp index 847435d96e..8018433fb6 100644 --- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp @@ -93,7 +93,7 @@ QFunctionPointer QDirectFbGLContext::getProcAddress(const char *procName) void QDirectFbGLContext::swapBuffers() { // m_dfbGlContext->Unlock(m_dfbGlContext); //maybe not in doneCurrent() - qDebug() << "Swap buffers"; + qDebug("Swap buffers"); } QPlatformWindowFormat QDirectFbGLContext::platformWindowFormat() const -- cgit v1.2.3