qoffscreensurface.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qoffscreensurface.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4class __attribute__((visibility("default"))) QOffscreenSurfacePrivate : public QObjectPrivate-
5{-
6 inline QOffscreenSurface* q_func() { return static_cast<QOffscreenSurface *>(q_ptr); } inline const QOffscreenSurface* q_func() const { return static_cast<const QOffscreenSurface *>(q_ptr); } friend class QOffscreenSurface;-
7-
8public:-
9 QOffscreenSurfacePrivate()-
10 : QObjectPrivate()-
11 , surfaceType(QSurface::OpenGLSurface)-
12 , platformOffscreenSurface(0)-
13 , offscreenWindow(0)-
14 , requestedFormat(QSurfaceFormat::defaultFormat())-
15 , screen(0)-
16 , size(1, 1)-
17 {-
18 }
never executed: end of block
0
19-
20 ~QOffscreenSurfacePrivate()-
21 {-
22 }-
23-
24 QSurface::SurfaceType surfaceType;-
25 QPlatformOffscreenSurface *platformOffscreenSurface;-
26 QWindow *offscreenWindow;-
27 QSurfaceFormat requestedFormat;-
28 QScreen *screen;-
29 QSize size;-
30};-
31QOffscreenSurface::QOffscreenSurface(QScreen *targetScreen)-
32 : QObject(*new QOffscreenSurfacePrivate(), 0)-
33 , QSurface(Offscreen)-
34{-
35 QOffscreenSurfacePrivate * const d = d_func();-
36 d->screen = targetScreen;-
37 if (!d->screen
!d->screenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
38 d->screen = QGuiApplication::primaryScreen();
never executed: d->screen = QGuiApplication::primaryScreen();
0
39-
40-
41-
42 ((!(d->screen)) ? qt_assert("d->screen",__FILE__,139) : qt_noop());-
43-
44 connect(d->screen, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "141"), this, qFlagLocation("1""screenDestroyed(QObject*)" "\0" __FILE__ ":" "141"));-
45}
never executed: end of block
0
46-
47-
48-
49-
50-
51QOffscreenSurface::~QOffscreenSurface()-
52{-
53 destroy();-
54}
never executed: end of block
0
55-
56-
57-
58-
59-
60-
61QOffscreenSurface::SurfaceType QOffscreenSurface::surfaceType() const-
62{-
63 const QOffscreenSurfacePrivate * const d = d_func();-
64 return
never executed: return d->surfaceType;
d->surfaceType;
never executed: return d->surfaceType;
0
65}-
66void QOffscreenSurface::create()-
67{-
68 QOffscreenSurfacePrivate * const d = d_func();-
69 if (!d->platformOffscreenSurface
!d->platformOffscreenSurfaceDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->offscreenWindow
!d->offscreenWindowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
70 d->platformOffscreenSurface = QGuiApplicationPrivate::platformIntegration()->createPlatformOffscreenSurface(this);-
71-
72 if (!d->platformOffscreenSurface
!d->platformOffscreenSurfaceDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
73 if (QThread::currentThread() != (static_cast<QGuiApplication *>(QCoreApplication::instance()))->thread()
QThread::curre...()))->thread()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
74 QMessageLogger(__FILE__, 184, __PRETTY_FUNCTION__).warning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures.");
never executed: QMessageLogger(__FILE__, 184, __PRETTY_FUNCTION__).warning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures.");
0
75 d->offscreenWindow = new QWindow(d->screen);-
76 d->offscreenWindow->setObjectName(QLatin1String("QOffscreenSurface"));-
77-
78-
79 QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow);-
80 d->offscreenWindow->setSurfaceType(QWindow::OpenGLSurface);-
81 d->offscreenWindow->setFormat(d->requestedFormat);-
82 d->offscreenWindow->setGeometry(0, 0, d->size.width(), d->size.height());-
83 d->offscreenWindow->create();-
84 }
never executed: end of block
0
85-
86 QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceCreated);-
87 QGuiApplication::sendEvent(this, &e);-
88 }
never executed: end of block
0
89}
never executed: end of block
0
90-
91-
92-
93-
94-
95-
96void QOffscreenSurface::destroy()-
97{-
98 QOffscreenSurfacePrivate * const d = d_func();-
99-
100 QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);-
101 QGuiApplication::sendEvent(this, &e);-
102-
103 delete d->platformOffscreenSurface;-
104 d->platformOffscreenSurface = 0;-
105 if (d->offscreenWindow
d->offscreenWindowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
106 d->offscreenWindow->destroy();-
107 delete d->offscreenWindow;-
108 d->offscreenWindow = 0;-
109 }
never executed: end of block
0
110}
never executed: end of block
0
111bool QOffscreenSurface::isValid() const-
112{-
113 const QOffscreenSurfacePrivate * const d = d_func();-
114 return
never executed: return (d->platformOffscreenSurface && d->platformOffscreenSurface->isValid()) || (d->offscreenWindow && d->offscreenWindow->handle());
(d->platformOffscreenSurface && d->platformOffscreenSurface->isValid())
never executed: return (d->platformOffscreenSurface && d->platformOffscreenSurface->isValid()) || (d->offscreenWindow && d->offscreenWindow->handle());
0
115 || (d->offscreenWindow && d->offscreenWindow->handle());
never executed: return (d->platformOffscreenSurface && d->platformOffscreenSurface->isValid()) || (d->offscreenWindow && d->offscreenWindow->handle());
0
116}-
117void QOffscreenSurface::setFormat(const QSurfaceFormat &format)-
118{-
119 QOffscreenSurfacePrivate * const d = d_func();-
120 d->requestedFormat = format;-
121}
never executed: end of block
0
122QSurfaceFormat QOffscreenSurface::requestedFormat() const-
123{-
124 const QOffscreenSurfacePrivate * const d = d_func();-
125 return
never executed: return d->requestedFormat;
d->requestedFormat;
never executed: return d->requestedFormat;
0
126}-
127QSurfaceFormat QOffscreenSurface::format() const-
128{-
129 const QOffscreenSurfacePrivate * const d = d_func();-
130 if (d->platformOffscreenSurface
d->platformOffscreenSurfaceDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
131 return
never executed: return d->platformOffscreenSurface->format();
d->platformOffscreenSurface->format();
never executed: return d->platformOffscreenSurface->format();
0
132 if (d->offscreenWindow
d->offscreenWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
133 return
never executed: return d->offscreenWindow->format();
d->offscreenWindow->format();
never executed: return d->offscreenWindow->format();
0
134 return
never executed: return d->requestedFormat;
d->requestedFormat;
never executed: return d->requestedFormat;
0
135}-
136-
137-
138-
139-
140QSize QOffscreenSurface::size() const-
141{-
142 const QOffscreenSurfacePrivate * const d = d_func();-
143 return
never executed: return d->size;
d->size;
never executed: return d->size;
0
144}-
145-
146-
147-
148-
149-
150-
151QScreen *QOffscreenSurface::screen() const-
152{-
153 const QOffscreenSurfacePrivate * const d = d_func();-
154 return
never executed: return d->screen;
d->screen;
never executed: return d->screen;
0
155}-
156void QOffscreenSurface::setScreen(QScreen *newScreen)-
157{-
158 QOffscreenSurfacePrivate * const d = d_func();-
159 if (!newScreen
!newScreenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
160 newScreen = QGuiApplication::primaryScreen();
never executed: newScreen = QGuiApplication::primaryScreen();
0
161 if (newScreen != d->screen
newScreen != d->screenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
162 const bool wasCreated = d->platformOffscreenSurface != 0
d->platformOff...enSurface != 0Description
TRUEnever evaluated
FALSEnever evaluated
|| d->offscreenWindow != 0
d->offscreenWindow != 0Description
TRUEnever evaluated
FALSEnever evaluated
;
0
163 if (wasCreated
wasCreatedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
164 destroy();
never executed: destroy();
0
165 if (d->screen
d->screenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
166 disconnect(d->screen, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "322"), this, qFlagLocation("1""screenDestroyed(QObject*)" "\0" __FILE__ ":" "322"));
never executed: disconnect(d->screen, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "322"), this, qFlagLocation("1""screenDestroyed(QObject*)" "\0" __FILE__ ":" "322"));
0
167 d->screen = newScreen;-
168 if (newScreen
newScreenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
169 connect(d->screen, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "325"), this, qFlagLocation("1""screenDestroyed(QObject*)" "\0" __FILE__ ":" "325"));-
170 if (wasCreated
wasCreatedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
171 create();
never executed: create();
0
172 }
never executed: end of block
0
173 screenChanged(newScreen);-
174 }
never executed: end of block
0
175}
never executed: end of block
0
176-
177-
178-
179-
180-
181-
182void QOffscreenSurface::screenDestroyed(QObject *object)-
183{-
184 QOffscreenSurfacePrivate * const d = d_func();-
185 if (object == static_cast<QObject *>(d->screen)
object == stat... *>(d->screen)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
186 setScreen(0);
never executed: setScreen(0);
0
187}
never executed: end of block
0
188QPlatformOffscreenSurface *QOffscreenSurface::handle() const-
189{-
190 const QOffscreenSurfacePrivate * const d = d_func();-
191 return
never executed: return d->platformOffscreenSurface;
d->platformOffscreenSurface;
never executed: return d->platformOffscreenSurface;
0
192}-
193-
194-
195-
196-
197-
198-
199QPlatformSurface *QOffscreenSurface::surfaceHandle() const-
200{-
201 const QOffscreenSurfacePrivate * const d = d_func();-
202 if (d->offscreenWindow
d->offscreenWindowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
203 return
never executed: return d->offscreenWindow->handle();
d->offscreenWindow->handle();
never executed: return d->offscreenWindow->handle();
0
204-
205 return
never executed: return d->platformOffscreenSurface;
d->platformOffscreenSurface;
never executed: return d->platformOffscreenSurface;
0
206}-
207-
208-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9