summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-03-24 07:37:43 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2015-03-24 07:38:02 +0100
commit135ebe4f3d268121047fdbfee49f2dd52006165e (patch)
tree6b303103f36e69e29cfa860b8b7afc584c55d6f3 /src/plugins/platforms/android
parente7feb956280105113b3e58f12e5f32f54199a95a (diff)
parent1e8f50a8d069c97ea6a4f00d664c12e594884f54 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Diffstat (limited to 'src/plugins/platforms/android')
-rw-r--r--src/plugins/platforms/android/androidjnimain.cpp70
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp18
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.h6
3 files changed, 43 insertions, 51 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index b30aab5b11..47018bfece 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -61,40 +61,40 @@ Q_IMPORT_PLUGIN(QAndroidPlatformIntegrationPlugin)
QT_BEGIN_NAMESPACE
-static JavaVM *m_javaVM = Q_NULLPTR;
-static jclass m_applicationClass = Q_NULLPTR;
-static jobject m_classLoaderObject = Q_NULLPTR;
-static jmethodID m_loadClassMethodID = Q_NULLPTR;
-static AAssetManager *m_assetManager = Q_NULLPTR;
-static jobject m_resourcesObj = Q_NULLPTR;
-static jobject m_activityObject = Q_NULLPTR;
-static jmethodID m_createSurfaceMethodID = Q_NULLPTR;
-static jmethodID m_setSurfaceGeometryMethodID = Q_NULLPTR;
-static jmethodID m_destroySurfaceMethodID = Q_NULLPTR;
+static JavaVM *m_javaVM = nullptr;
+static jclass m_applicationClass = nullptr;
+static jobject m_classLoaderObject = nullptr;
+static jmethodID m_loadClassMethodID = nullptr;
+static AAssetManager *m_assetManager = nullptr;
+static jobject m_resourcesObj = nullptr;
+static jobject m_activityObject = nullptr;
+static jmethodID m_createSurfaceMethodID = nullptr;
+static jmethodID m_setSurfaceGeometryMethodID = nullptr;
+static jmethodID m_destroySurfaceMethodID = nullptr;
static bool m_activityActive = true; // defaults to true because when the platform plugin is
// initialized, QtActivity::onResume() has already been called
-static jclass m_bitmapClass = Q_NULLPTR;
-static jmethodID m_createBitmapMethodID = Q_NULLPTR;
-static jobject m_ARGB_8888_BitmapConfigValue = Q_NULLPTR;
-static jobject m_RGB_565_BitmapConfigValue = Q_NULLPTR;
+static jclass m_bitmapClass = nullptr;
+static jmethodID m_createBitmapMethodID = nullptr;
+static jobject m_ARGB_8888_BitmapConfigValue = nullptr;
+static jobject m_RGB_565_BitmapConfigValue = nullptr;
static bool m_statusBarShowing = true;
-static jclass m_bitmapDrawableClass = Q_NULLPTR;
-static jmethodID m_bitmapDrawableConstructorMethodID = Q_NULLPTR;
+static jclass m_bitmapDrawableClass = nullptr;
+static jmethodID m_bitmapDrawableConstructorMethodID = nullptr;
extern "C" typedef int (*Main)(int, char **); //use the standard main method to start the application
-static Main m_main = Q_NULLPTR;
-static void *m_mainLibraryHnd = Q_NULLPTR;
+static Main m_main = nullptr;
+static void *m_mainLibraryHnd = nullptr;
static QList<QByteArray> m_applicationParams;
struct SurfaceData
{
~SurfaceData() { delete surface; }
- QJNIObjectPrivate *surface = Q_NULLPTR;
- AndroidSurfaceClient *client = Q_NULLPTR;
+ QJNIObjectPrivate *surface = nullptr;
+ AndroidSurfaceClient *client = nullptr;
};
QHash<int, AndroidSurfaceClient *> m_surfaces;
@@ -103,7 +103,7 @@ static QMutex m_surfacesMutex;
static int m_surfaceId = 1;
-static QAndroidPlatformIntegration *m_androidPlatformIntegration = Q_NULLPTR;
+static QAndroidPlatformIntegration *m_androidPlatformIntegration = nullptr;
static int m_desktopWidthPixels = 0;
static int m_desktopHeightPixels = 0;
@@ -111,7 +111,7 @@ static double m_scaledDensity = 0;
static volatile bool m_pauseApplication;
-static AndroidAssetsFileEngineHandler *m_androidAssetsFileEngineHandler = Q_NULLPTR;
+static AndroidAssetsFileEngineHandler *m_androidAssetsFileEngineHandler = nullptr;
@@ -325,7 +325,7 @@ namespace QtAndroid
{
m_surfacesMutex.lock();
const int surfaceId = m_surfaceId++;
- m_surfaces[surfaceId] = Q_NULLPTR; // dummy
+ m_surfaces[surfaceId] = nullptr; // dummy
m_surfacesMutex.unlock();
jint x = 0, y = 0, w = -1, h = -1;
@@ -419,7 +419,7 @@ namespace QtAndroid
static jboolean startQtAndroidPlugin(JNIEnv* /*env*/, jobject /*object*//*, jobject applicationAssetManager*/)
{
- m_androidPlatformIntegration = Q_NULLPTR;
+ m_androidPlatformIntegration = nullptr;
m_androidAssetsFileEngineHandler = new AndroidAssetsFileEngineHandler();
return true;
}
@@ -447,7 +447,7 @@ static void *startMainMethod(void */*data*/)
static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring paramsString, jstring environmentString)
{
- m_mainLibraryHnd = Q_NULLPTR;
+ m_mainLibraryHnd = nullptr;
{ // Set env. vars
const char *nativeString = env->GetStringUTFChars(environmentString, 0);
const QList<QByteArray> envVars = QByteArray(nativeString).split('\t');
@@ -473,7 +473,7 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para
// Obtain a handle to the main library (the library that contains the main() function).
// This library should already be loaded, and calling dlopen() will just return a reference to it.
m_mainLibraryHnd = dlopen(m_applicationParams.first().data(), 0);
- if (m_mainLibraryHnd == Q_NULLPTR) {
+ if (m_mainLibraryHnd == nullptr) {
qCritical() << "dlopen failed:" << dlerror();
return false;
}
@@ -490,16 +490,16 @@ static jboolean startQtApplication(JNIEnv *env, jobject /*object*/, jstring para
}
pthread_t appThread;
- return pthread_create(&appThread, Q_NULLPTR, startMainMethod, Q_NULLPTR) == 0;
+ return pthread_create(&appThread, nullptr, startMainMethod, nullptr) == 0;
}
static void quitQtAndroidPlugin(JNIEnv *env, jclass /*clazz*/)
{
Q_UNUSED(env);
- m_androidPlatformIntegration = Q_NULLPTR;
+ m_androidPlatformIntegration = nullptr;
delete m_androidAssetsFileEngineHandler;
- m_androidAssetsFileEngineHandler = Q_NULLPTR;
+ m_androidAssetsFileEngineHandler = nullptr;
}
static void terminateQt(JNIEnv *env, jclass /*clazz*/)
@@ -518,16 +518,16 @@ static void terminateQt(JNIEnv *env, jclass /*clazz*/)
env->DeleteGlobalRef(m_RGB_565_BitmapConfigValue);
if (m_bitmapDrawableClass)
env->DeleteGlobalRef(m_bitmapDrawableClass);
- m_androidPlatformIntegration = Q_NULLPTR;
+ m_androidPlatformIntegration = nullptr;
delete m_androidAssetsFileEngineHandler;
- m_androidAssetsFileEngineHandler = Q_NULLPTR;
+ m_androidAssetsFileEngineHandler = nullptr;
}
static void setSurface(JNIEnv *env, jobject /*thiz*/, jint id, jobject jSurface, jint w, jint h)
{
QMutexLocker lock(&m_surfacesMutex);
const auto &it = m_surfaces.find(id);
- if (it.value() == Q_NULLPTR) // This should never happen...
+ if (it.value() == nullptr) // This should never happen...
return;
if (it == m_surfaces.end()) {
@@ -572,7 +572,7 @@ static void updateWindow(JNIEnv */*env*/, jobject /*thiz*/)
if (!m_androidPlatformIntegration)
return;
- if (QGuiApplication::instance() != Q_NULLPTR) {
+ if (QGuiApplication::instance() != nullptr) {
foreach (QWindow *w, QGuiApplication::topLevelWindows()) {
QRect availableGeometry = w->screen()->availableGeometry();
if (w->geometry().width() > 0 && w->geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0)
@@ -778,8 +778,8 @@ Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void */*reserved*/)
__android_log_print(ANDROID_LOG_INFO, "Qt", "qt start");
UnionJNIEnvToVoid uenv;
- uenv.venv = Q_NULLPTR;
- m_javaVM = Q_NULLPTR;
+ uenv.venv = nullptr;
+ m_javaVM = nullptr;
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) {
__android_log_print(ANDROID_LOG_FATAL, "Qt", "GetEnv failed");
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 5384b6faca..eb96bf11f0 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -88,19 +88,19 @@ void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteA
return &m_androidStyle->m_styleData;
}
else
- return Q_NULLPTR;
+ return nullptr;
}
if (resource == "AndroidStandardPalette") {
if (m_androidStyle)
return &m_androidStyle->m_standardPalette;
else
- return Q_NULLPTR;
+ return nullptr;
}
if (resource == "AndroidQWidgetFonts") {
if (m_androidStyle)
return &m_androidStyle->m_QWidgetsFonts;
else
- return Q_NULLPTR;
+ return nullptr;
}
if (resource == "AndroidDeviceName") {
static QString deviceName = QtAndroid::deviceName();
@@ -110,9 +110,9 @@ void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteA
}
QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &paramList)
- : m_touchDevice(0)
+ : m_touchDevice(nullptr)
#ifndef QT_NO_ACCESSIBILITY
- , m_accessibility(0)
+ , m_accessibility(nullptr)
#endif
{
Q_UNUSED(paramList);
@@ -183,7 +183,7 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
QGuiApplicationPrivate::instance()->setApplicationState(m_defaultApplicationState);
}
-bool QAndroidPlatformIntegration::needsBasicRenderloopWorkaround()
+static bool needsBasicRenderloopWorkaround()
{
static bool needsWorkaround =
QtAndroid::deviceName().compare(QLatin1String("samsung SM-T211"), Qt::CaseInsensitive) == 0
@@ -200,11 +200,7 @@ bool QAndroidPlatformIntegration::hasCapability(Capability cap) const
case NativeWidgets: return true;
case OpenGL: return true;
case ForeignWindows: return true;
- case ThreadedOpenGL:
- if (needsBasicRenderloopWorkaround())
- return false;
- else
- return true;
+ case ThreadedOpenGL: return !needsBasicRenderloopWorkaround();
case RasterGLSurface: return true;
default:
return QPlatformIntegration::hasCapability(cap);
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h
index c0a9229056..ccf683e253 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.h
+++ b/src/plugins/platforms/android/qandroidplatformintegration.h
@@ -117,10 +117,8 @@ public:
void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; }
static void setDefaultApplicationState(Qt::ApplicationState applicationState) { m_defaultApplicationState = applicationState; }
- EGLDisplay m_eglDisplay;
private:
- static bool needsBasicRenderloopWorkaround();
-
+ EGLDisplay m_eglDisplay;
QTouchDevice *m_touchDevice;
QAndroidPlatformScreen *m_primaryScreen;
@@ -140,8 +138,6 @@ private:
static Qt::ApplicationState m_defaultApplicationState;
QPlatformFontDatabase *m_androidFDB;
- QImage *m_FbScreenImage;
- QPainter *m_compositePainter;
QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface;
QAndroidPlatformServices *m_androidPlatformServices;