Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). |
4 | ** Contact: http://www.qt-project.org/legal |
5 | ** |
6 | ** This file is part of the plugins of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and Digia. For licensing terms and |
14 | ** conditions see http://qt.digia.com/licensing. For further information |
15 | ** use the contact form at http://qt.digia.com/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
24 | ** |
25 | ** In addition, as a special exception, Digia gives you certain additional |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
28 | ** |
29 | ** GNU General Public License Usage |
30 | ** Alternatively, this file may be used under the terms of the GNU |
31 | ** General Public License version 3.0 as published by the Free Software |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
33 | ** packaging of this file. Please review the following information to |
34 | ** ensure the GNU General Public License version 3.0 requirements will be |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
36 | ** |
37 | ** |
38 | ** $QT_END_LICENSE$ |
39 | ** |
40 | ****************************************************************************/ |
41 | |
42 | #define ENSURE_RUNNING_MEEGO {if (! QMeeGoGraphicsSystemHelper::isRunningMeeGo()) { qFatal("Using meego functionality but not running meego graphics system!"); }} |
43 | |
44 | #include "qmeegographicssystemhelper.h" |
45 | #include <private/qapplication_p.h> |
46 | #include <private/qgraphicssystem_runtime_p.h> |
47 | #include <private/qpixmap_raster_p.h> |
48 | #include <private/qwindowsurface_gl_p.h> |
49 | #include "qmeegoruntime.h" |
50 | |
51 | QString QMeeGoGraphicsSystemHelper::runningGraphicsSystemName() |
52 | { |
53 | if (! QApplicationPrivate::instance()) { |
54 | qWarning("Querying graphics system but application not running yet!"); |
55 | return QString(); |
56 | } |
57 | |
58 | QString name = QApplicationPrivate::instance()->graphics_system_name; |
59 | if (name == QLatin1String("runtime")) { |
60 | QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system; |
61 | name = rsystem->graphicsSystemName(); |
62 | } |
63 | |
64 | return name; |
65 | } |
66 | |
67 | bool QMeeGoGraphicsSystemHelper::isRunningMeeGo() |
68 | { |
69 | return (runningGraphicsSystemName() == QLatin1String("meego")); |
70 | } |
71 | |
72 | bool QMeeGoGraphicsSystemHelper::isRunningRuntime() |
73 | { |
74 | return (QApplicationPrivate::instance()->graphics_system_name == QLatin1String("runtime")); |
75 | } |
76 | |
77 | void QMeeGoGraphicsSystemHelper::switchToMeeGo() |
78 | { |
79 | QMeeGoRuntime::switchToMeeGo(); |
80 | } |
81 | |
82 | void QMeeGoGraphicsSystemHelper::switchToRaster() |
83 | { |
84 | QMeeGoRuntime::switchToRaster(); |
85 | } |
86 | |
87 | Qt::HANDLE QMeeGoGraphicsSystemHelper::imageToEGLSharedImage(const QImage &image) |
88 | { |
89 | ENSURE_RUNNING_MEEGO; |
90 | return QMeeGoRuntime::imageToEGLSharedImage(image); |
91 | } |
92 | |
93 | QPixmap QMeeGoGraphicsSystemHelper::pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage) |
94 | { |
95 | // This function is supported when not running meego too. A raster-backed |
96 | // pixmap will be created... but when you switch back to 'meego', it'll |
97 | // be replaced with a EGL shared image backing. |
98 | return QPixmap(QMeeGoRuntime::pixmapDataFromEGLSharedImage(handle, softImage)); |
99 | } |
100 | |
101 | QPixmap QMeeGoGraphicsSystemHelper::pixmapWithGLTexture(int w, int h) |
102 | { |
103 | ENSURE_RUNNING_MEEGO; |
104 | return QPixmap(QMeeGoRuntime::pixmapDataWithGLTexture(w, h)); |
105 | } |
106 | |
107 | bool QMeeGoGraphicsSystemHelper::destroyEGLSharedImage(Qt::HANDLE handle) |
108 | { |
109 | ENSURE_RUNNING_MEEGO; |
110 | return QMeeGoRuntime::destroyEGLSharedImage(handle); |
111 | } |
112 | |
113 | void QMeeGoGraphicsSystemHelper::updateEGLSharedImagePixmap(QPixmap *p) |
114 | { |
115 | ENSURE_RUNNING_MEEGO; |
116 | return QMeeGoRuntime::updateEGLSharedImagePixmap(p); |
117 | } |
118 | |
119 | void QMeeGoGraphicsSystemHelper::setTranslucent(bool translucent) |
120 | { |
121 | ENSURE_RUNNING_MEEGO; |
122 | QMeeGoRuntime::setTranslucent(translucent); |
123 | } |
124 | |
125 | void QMeeGoGraphicsSystemHelper::setSwapBehavior(SwapMode mode) |
126 | { |
127 | ENSURE_RUNNING_MEEGO; |
128 | |
129 | if (mode == AutomaticSwap) |
130 | QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap; |
131 | else if (mode == AlwaysFullSwap) |
132 | QGLWindowSurface::swapBehavior = QGLWindowSurface::AlwaysFullSwap; |
133 | else if (mode == AlwaysPartialSwap) |
134 | QGLWindowSurface::swapBehavior = QGLWindowSurface::AlwaysPartialSwap; |
135 | else if (mode == KillSwap) |
136 | QGLWindowSurface::swapBehavior = QGLWindowSurface::KillSwap; |
137 | } |
138 | |
139 | void QMeeGoGraphicsSystemHelper::setSwitchPolicy(SwitchPolicy policy) |
140 | { |
141 | QMeeGoRuntime::setSwitchPolicy(policy); |
142 | } |
143 | |
144 | void QMeeGoGraphicsSystemHelper::enableSwitchEvents() |
145 | { |
146 | QMeeGoRuntime::enableSwitchEvents(); |
147 | } |
148 |
Warning: That file was not part of the compilation database. It may have many parsing errors.