diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-02-11 15:12:00 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-11 15:12:00 +0100 |
commit | df62c31807f7b0a8b9bc222b47ccc7016cfaee65 (patch) | |
tree | a7df6263cdb4cc96e2d31486437ec19ca0bf01e5 /src/plugins/platforms/android | |
parent | 17de86f2824c1807c0fa7fa7ae0ed3b7d2acca00 (diff) | |
parent | a1fe728fa5bd6cb9e50cf317a58efcf4eea4de2c (diff) |
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/android')
5 files changed, 58 insertions, 18 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 1653c0ffdd..e997a49a25 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -325,6 +325,14 @@ namespace QtAndroid return m_qtTag; } + QString deviceName() + { + QString manufacturer = QJNIObjectPrivate::getStaticObjectField("android/os/Build", "MANUFACTURER", "Ljava/lang/String;").toString(); + QString model = QJNIObjectPrivate::getStaticObjectField("android/os/Build", "MODEL", "Ljava/lang/String;").toString(); + + return manufacturer + QStringLiteral(" ") + model; + } + int createSurface(AndroidSurfaceClient *client, const QRect &geometry, bool onTop) { QJNIEnvironmentPrivate env; @@ -369,6 +377,7 @@ namespace QtAndroid x, y, w, h); } + void destroySurface(int surfaceId) { QMutexLocker lock(&m_surfacesMutex); @@ -385,7 +394,8 @@ namespace QtAndroid m_destroySurfaceMethodID, surfaceId); } -} +} // namespace QtAndroid + static jboolean startQtAndroidPlugin(JNIEnv* /*env*/, jobject /*object*//*, jobject applicationAssetManager*/) { diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h index 24287df474..eb8dd87ae0 100644 --- a/src/plugins/platforms/android/androidjnimain.h +++ b/src/plugins/platforms/android/androidjnimain.h @@ -116,5 +116,6 @@ namespace QtAndroid const char *methodErrorMsgFmt(); const char *qtTagText(); + QString deviceName(); } #endif // ANDROID_APP_H diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index 8925f04818..3dc8632374 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -47,20 +47,21 @@ #include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> -#include <qpa/qplatformwindow.h> #include <qpa/qwindowsysteminterface.h> +#include <qpa/qplatformwindow.h> +#warning sort the headers #include "androidjnimain.h" #include "qabstracteventdispatcher.h" -#include "qandroidplatformaccessibility.h" -#include "qandroidplatformclipboard.h" -#include "qandroidplatformfontdatabase.h" +#include "qandroidplatformrasterwindow.h" +#include "qandroidplatformopenglwindow.h" #include "qandroidplatformbackingstore.h" +#include "qandroidplatformservices.h" +#include "qandroidplatformfontdatabase.h" +#include "qandroidplatformclipboard.h" +#include "qandroidplatformaccessibility.h" #include "qandroidplatformopenglcontext.h" -#include "qandroidplatformopenglwindow.h" -#include "qandroidplatformrasterwindow.h" #include "qandroidplatformscreen.h" -#include "qandroidplatformservices.h" #include "qandroidplatformtheme.h" #include "qandroidsystemlocale.h" @@ -85,6 +86,10 @@ void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteA return &m_palettes; if (resource == "AndroidStyleFonts") return &m_fonts; + if (resource == "AndroidDeviceName") { + static QString deviceName = QtAndroid::deviceName(); + return &deviceName; + } return 0; } @@ -119,11 +124,23 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶ m_androidFDB = new QAndroidPlatformFontDatabase(); m_androidPlatformServices = new QAndroidPlatformServices(); + +#ifndef QT_NO_CLIPBOARD m_androidPlatformClipboard = new QAndroidPlatformClipboard(); +#endif m_androidSystemLocale = new QAndroidSystemLocale; } +bool QAndroidPlatformIntegration::needsWorkaround() +{ + static bool needsWorkaround = + QtAndroid::deviceName().compare(QStringLiteral("samsung SM-T211"), Qt::CaseInsensitive) == 0 + || QtAndroid::deviceName().compare(QStringLiteral("samsung SM-T210"), Qt::CaseInsensitive) == 0 + || QtAndroid::deviceName().compare(QStringLiteral("samsung SM-T215"), Qt::CaseInsensitive) == 0; + return needsWorkaround; +} + bool QAndroidPlatformIntegration::hasCapability(Capability cap) const { switch (cap) { @@ -131,7 +148,10 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const case ApplicationState: return true; case NativeWidgets: return true; case OpenGL: return true; - case ThreadedOpenGL: return true; + case ThreadedOpenGL: + if (needsWorkaround()) + return false; + // fall through default: return QPlatformIntegration::hasCapability(cap); } @@ -173,6 +193,11 @@ QAndroidPlatformIntegration::~QAndroidPlatformIntegration() delete m_androidPlatformNativeInterface; delete m_androidFDB; delete m_androidSystemLocale; + +#ifndef QT_NO_CLIPBOARD + delete m_androidPlatformClipboard; +#endif + QtAndroid::setAndroidPlatformIntegration(NULL); } @@ -184,11 +209,7 @@ QPlatformFontDatabase *QAndroidPlatformIntegration::fontDatabase() const #ifndef QT_NO_CLIPBOARD QPlatformClipboard *QAndroidPlatformIntegration::clipboard() const { -static QAndroidPlatformClipboard *clipboard = 0; - if (!clipboard) - clipboard = new QAndroidPlatformClipboard; - - return clipboard; + return m_androidPlatformClipboard; } #endif diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h index a6cba7ac16..0dc2415337 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/qandroidplatformintegration.h @@ -121,8 +121,9 @@ public: QTouchDevice *touchDevice() const { return m_touchDevice; } void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; } -private: + static bool needsWorkaround(); EGLDisplay m_eglDisplay; +private: QTouchDevice *m_touchDevice; @@ -143,7 +144,11 @@ private: QPainter *m_compositePainter; QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface; QAndroidPlatformServices *m_androidPlatformServices; + +#ifndef QT_NO_CLIPBOARD QPlatformClipboard *m_androidPlatformClipboard; +#endif + QAndroidSystemLocale *m_androidSystemLocale; #ifndef QT_NO_ACCESSIBILITY mutable QPlatformAccessibility *m_accessibility; diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index d99cafe6b7..59ca69c004 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -42,6 +42,7 @@ #include "qandroidplatformopenglcontext.h" #include "qandroidplatformopenglwindow.h" +#include "qandroidplatformintegration.h" #include <QSurface> #include <QtGui/private/qopenglcontext_p.h> @@ -64,12 +65,14 @@ void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface) bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface) { bool ret = QEGLPlatformContext::makeCurrent(surface); + QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context()); const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER)); - if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) { - QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context()); + if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) ctx_d->workaround_missingPrecisionQualifiers = true; - } + + if (!ctx_d->workaround_brokenFBOReadBack && QAndroidPlatformIntegration::needsWorkaround()) + ctx_d->workaround_brokenFBOReadBack = true; return ret; } |