summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/android/src/opengl')
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp95
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h69
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp61
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h60
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp178
-rw-r--r--src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h91
-rw-r--r--src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp161
7 files changed, 0 insertions, 715 deletions
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
deleted file mode 100644
index 6431914812..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidopenglcontext.h"
-#include "qandroidopenglplatformwindow.h"
-#include "qandroidplatformintegration.h"
-
-#include <QtCore/qdebug.h>
-#include <qpa/qwindowsysteminterface.h>
-
-#include <QtGui/private/qopenglcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QAndroidOpenGLContext::QAndroidOpenGLContext(const QAndroidPlatformIntegration *integration,
- const QSurfaceFormat &format,
- QPlatformOpenGLContext *share,
- EGLDisplay display,
- EGLenum eglApi)
- : QEglFSContext(format, share, display, eglApi)
- , m_platformIntegration(integration)
-{
-}
-
-void QAndroidOpenGLContext::swapBuffers(QPlatformSurface *surface)
-{
- QEglFSContext::swapBuffers(surface);
-
- if (surface->surface()->surfaceClass() == QSurface::Window) {
- QAndroidOpenGLPlatformWindow *window = static_cast<QAndroidOpenGLPlatformWindow *>(surface);
- window->lock();
- QSize size = window->scheduledResize();
- if (size.isValid()) {
- QRect geometry(QPoint(0, 0), size);
- window->setGeometry(geometry);
- QWindowSystemInterface::handleGeometryChange(window->window(), geometry);
- QWindowSystemInterface::handleExposeEvent(window->window(), QRegion(geometry));
- window->scheduleResize(QSize());
- }
- window->unlock();
- }
-}
-
-bool QAndroidOpenGLContext::makeCurrent(QPlatformSurface *surface)
-{
- bool ret = QEglFSContext::makeCurrent(surface);
-
- 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());
- ctx_d->workaround_missingPrecisionQualifiers = true;
- }
-
- return ret;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h b/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h
deleted file mode 100644
index c419ae8392..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglcontext.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDOPENGLCONTEXT_H
-#define QANDROIDOPENGLCONTEXT_H
-
-#include <QtCore/qreadwritelock.h>
-#include "qeglfscontext.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidPlatformIntegration;
-class QAndroidOpenGLContext : public QEglFSContext
-{
-public:
- QAndroidOpenGLContext(const QAndroidPlatformIntegration *integration,
- const QSurfaceFormat &format,
- QPlatformOpenGLContext *share,
- EGLDisplay display,
- EGLenum eglApi = EGL_OPENGL_ES_API);
-
- void swapBuffers(QPlatformSurface *surface);
- bool makeCurrent(QPlatformSurface *surface);
-
-private:
- const QAndroidPlatformIntegration *m_platformIntegration;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDOPENGLCONTEXT_H
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp
deleted file mode 100644
index de4075feff..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidopenglplatformscreen.h"
-#include "qandroidopenglplatformwindow.h"
-#include "androidjnimenu.h"
-
-QT_BEGIN_NAMESPACE
-
-QAndroidOpenGLPlatformScreen::QAndroidOpenGLPlatformScreen(EGLDisplay display)
- : QEglFSScreen(display)
-{
-}
-
-void QAndroidOpenGLPlatformScreen::topWindowChanged(QPlatformWindow *window)
-{
- QtAndroidMenu::setActiveTopLevelWindow(window->window());
- QAndroidOpenGLPlatformWindow *platformWindow = static_cast<QAndroidOpenGLPlatformWindow *>(window);
- if (platformWindow != 0)
- platformWindow->updateStatusBarVisibility();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h
deleted file mode 100644
index e9251592aa..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformscreen.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDOPENGLPLATFORMSCREEN_H
-#define QANDROIDOPENGLPLATFORMSCREEN_H
-
-#include "qeglfsscreen.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidOpenGLPlatformScreen : public QEglFSScreen
-{
-public:
- QAndroidOpenGLPlatformScreen(EGLDisplay display);
-
-protected:
- void topWindowChanged(QPlatformWindow *window);
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDOPENGLPLATFORMSCREEN_H
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
deleted file mode 100644
index 6ed805174b..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qandroidopenglplatformwindow.h"
-#include "androidjnimain.h"
-#include "qandroidplatformintegration.h"
-#include <qpa/qwindowsysteminterface.h>
-
-QT_BEGIN_NAMESPACE
-
-EGLSurface QAndroidOpenGLPlatformWindow::m_staticSurface = 0;
-EGLNativeWindowType QAndroidOpenGLPlatformWindow::m_staticNativeWindow = 0;
-QReadWriteLock QAndroidOpenGLPlatformWindow::m_staticSurfaceLock;
-QBasicAtomicInt QAndroidOpenGLPlatformWindow::m_referenceCount = Q_BASIC_ATOMIC_INITIALIZER(0);
-
-QAndroidOpenGLPlatformWindow::QAndroidOpenGLPlatformWindow(QWindow *window)
- : QEglFSWindow(window)
- , m_state(Qt::WindowNoState)
-{
-}
-
-QAndroidOpenGLPlatformWindow::~QAndroidOpenGLPlatformWindow()
-{
- destroy();
-}
-
-bool QAndroidOpenGLPlatformWindow::isExposed() const
-{
- return QtAndroid::nativeWindow(false) != 0 && QEglFSWindow::isExposed();
-}
-
-void QAndroidOpenGLPlatformWindow::invalidateSurface()
-{
- QWindowSystemInterface::handleExposeEvent(window(), QRegion()); // Obscure event
- QWindowSystemInterface::flushWindowSystemEvents();
-
- m_window = 0;
- m_surface = 0;
-
- if (!m_referenceCount.deref()){
- QWriteLocker locker(&m_staticSurfaceLock);
-
- EGLDisplay display = (static_cast<QEglFSScreen *>(window()->screen()->handle()))->display();
- eglDestroySurface(display, m_staticSurface);
-
- m_staticSurface = 0;
- m_staticNativeWindow = 0;
- }
-}
-
-void QAndroidOpenGLPlatformWindow::updateStaticNativeWindow()
-{
- QWriteLocker locker(&m_staticSurfaceLock);
- m_staticNativeWindow = QtAndroid::nativeWindow(false);
-}
-
-void QAndroidOpenGLPlatformWindow::resetSurface()
-{
- // Only add a reference if we're not already holding one, otherwise we're just updating
- // the native window pointer
- if (m_window == 0)
- m_referenceCount.ref();
-
- if (m_staticSurface == 0) {
- QWriteLocker locker(&m_staticSurfaceLock);
- QEglFSWindow::resetSurface();
- m_staticSurface = m_surface;
- m_staticNativeWindow = m_window;
- } else {
- QReadLocker locker(&m_staticSurfaceLock);
- m_window = m_staticNativeWindow;
- m_surface = m_staticSurface;
- }
-
- {
- lock();
- // Use the desktop size.
- // On some devices, the getters for the native window size gives wrong values
- scheduleResize(QAndroidPlatformIntegration::defaultDesktopSize());
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
- unlock();
- }
-
- QWindowSystemInterface::flushWindowSystemEvents();
-}
-
-void QAndroidOpenGLPlatformWindow::destroy()
-{
- if (!m_referenceCount.deref()) {
- QEglFSWindow::destroy();
- } else {
- m_window = 0;
- m_surface = 0;
- }
-}
-
-void QAndroidOpenGLPlatformWindow::updateStatusBarVisibility()
-{
- Qt::WindowFlags flags = window()->flags();
- bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
- if (!isNonRegularWindow) {
- if (m_state & Qt::WindowFullScreen)
- QtAndroid::hideStatusBar();
- else if (m_state & Qt::WindowMaximized)
- QtAndroid::showStatusBar();
- }
-}
-
-void QAndroidOpenGLPlatformWindow::raise()
-{
- updateStatusBarVisibility();
-}
-
-void QAndroidOpenGLPlatformWindow::setWindowState(Qt::WindowState state)
-{
- if (m_state == state)
- return;
-
- m_state = state;
- if (window()->isVisible())
- updateStatusBarVisibility();
-}
-
-void QAndroidOpenGLPlatformWindow::setVisible(bool visible)
-{
- if (visible)
- updateStatusBarVisibility();
-
- QEglFSWindow::setVisible(visible);
-
- // The Android Activity is activated before Qt is initialized, causing the application state to
- // never be set to 'active'. We explicitly set this state when the first window becomes visible.
- if (visible)
- QtAndroid::setApplicationActive();
-
- QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); // Expose event
- QWindowSystemInterface::flushWindowSystemEvents();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h b/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
deleted file mode 100644
index e4ff0444d4..0000000000
--- a/src/plugins/platforms/android/src/opengl/qandroidopenglplatformwindow.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANDROIDOPENGLPLATFORMWINDOW_H
-#define QANDROIDOPENGLPLATFORMWINDOW_H
-
-#include "qeglfswindow.h"
-#include <QtCore/qmutex.h>
-#include <QtCore/qreadwritelock.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAndroidOpenGLPlatformWindow : public QEglFSWindow
-{
-public:
- QAndroidOpenGLPlatformWindow(QWindow *window);
- ~QAndroidOpenGLPlatformWindow();
-
- QSize scheduledResize() const { return m_scheduledResize; }
- void scheduleResize(const QSize &size) { m_scheduledResize = size; }
-
- void lock() { m_lock.lock(); }
- void unlock() { m_lock.unlock(); }
-
- bool isExposed() const;
-
- void raise();
-
- void invalidateSurface();
- void resetSurface();
- void setWindowState(Qt::WindowState state);
-
- void setVisible(bool visible);
-
- void destroy();
-
- static void updateStaticNativeWindow();
- void updateStatusBarVisibility();
-
-private:
- QSize m_scheduledResize;
- QMutex m_lock;
- Qt::WindowState m_state;
-
- static QReadWriteLock m_staticSurfaceLock;
- static EGLSurface m_staticSurface;
- static EGLNativeWindowType m_staticNativeWindow;
- static QBasicAtomicInt m_referenceCount;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANDROIDOPENGLPLATFORMWINDOW_H
diff --git a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp b/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
deleted file mode 100644
index 278cd553f4..0000000000
--- a/src/plugins/platforms/android/src/opengl/qeglfshooks_android.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qeglfshooks.h"
-#include "androidjnimain.h"
-#include "qandroidplatformintegration.h"
-
-#include <android/native_window.h>
-#include <jni.h>
-
-QT_BEGIN_NAMESPACE
-
-class QEglFSAndroidHooks: public QEglFSHooks
-{
-public:
- void platformInit();
- void platformDestroy();
- EGLNativeDisplayType platformDisplay() const;
- QSize screenSize() const;
- QSizeF physicalScreenSize() const;
- QDpi logicalDpi() const;
- Qt::ScreenOrientation orientation() const;
- Qt::ScreenOrientation nativeOrientation() const;
- int screenDepth() const;
- QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const;
- EGLNativeWindowType createNativeWindow(QPlatformWindow *platformWindow, const QSize &size, const QSurfaceFormat &format);
- void destroyNativeWindow(EGLNativeWindowType window);
- bool hasCapability(QPlatformIntegration::Capability cap) const;
- QEglFSCursor *createCursor(QEglFSScreen *screen) const;
-};
-
-void QEglFSAndroidHooks::platformInit()
-{
-}
-
-void QEglFSAndroidHooks::platformDestroy()
-{
-}
-
-EGLNativeDisplayType QEglFSAndroidHooks::platformDisplay() const
-{
- return EGL_DEFAULT_DISPLAY;
-}
-
-QSize QEglFSAndroidHooks::screenSize() const
-{
- return QAndroidPlatformIntegration::defaultDesktopSize();
-}
-
-QSizeF QEglFSAndroidHooks::physicalScreenSize() const
-{
- return QSizeF(QAndroidPlatformIntegration::m_defaultPhysicalSizeWidth, QAndroidPlatformIntegration::m_defaultPhysicalSizeHeight);
-}
-
-QDpi QEglFSAndroidHooks::logicalDpi() const
-{
- qreal lDpi = QtAndroid::scaledDensity() * 72;
- return QDpi(lDpi, lDpi);
-}
-
-Qt::ScreenOrientation QEglFSAndroidHooks::orientation() const
-{
- return QAndroidPlatformIntegration::m_orientation;
-}
-
-Qt::ScreenOrientation QEglFSAndroidHooks::nativeOrientation() const
-{
- return QAndroidPlatformIntegration::m_nativeOrientation;
-}
-
-EGLNativeWindowType QEglFSAndroidHooks::createNativeWindow(QPlatformWindow *platformWindow, const QSize &size, const QSurfaceFormat &format)
-{
- Q_UNUSED(platformWindow);
- Q_UNUSED(size);
- Q_UNUSED(format);
- ANativeWindow *window = QtAndroid::nativeWindow();
- if (window != 0)
- ANativeWindow_acquire(window);
-
- return window;
-}
-
-void QEglFSAndroidHooks::destroyNativeWindow(EGLNativeWindowType window)
-{
- if (window != 0)
- ANativeWindow_release(window);
-}
-
-bool QEglFSAndroidHooks::hasCapability(QPlatformIntegration::Capability capability) const
-{
- switch (capability) {
- case QPlatformIntegration::OpenGL: return true;
- case QPlatformIntegration::ThreadedOpenGL: return true;
- default: return false;
- };
-}
-
-int QEglFSAndroidHooks::screenDepth() const
-{
- // ### Hardcoded
- return 32;
-}
-
-QSurfaceFormat QEglFSAndroidHooks::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
-{
- QSurfaceFormat ret(inputFormat);
- ret.setAlphaBufferSize(8);
- ret.setRedBufferSize(8);
- ret.setGreenBufferSize(8);
- ret.setBlueBufferSize(8);
- return ret;
-}
-
-QEglFSCursor *QEglFSAndroidHooks::createCursor(QEglFSScreen *screen) const
-{
- Q_UNUSED(screen);
- return 0;
-}
-
-static QEglFSAndroidHooks eglFSAndroidHooks;
-QEglFSHooks *platformHooks = &eglFSAndroidHooks;
-
-QT_END_NAMESPACE