void renderWindow(QQuickWindow *window);
void exposureChanged(QQuickWindow *window);
QImage grab(QQuickWindow *window);
- void resize(QQuickWindow *window, const QSize &size);
void maybeUpdate(QQuickWindow *window);
void update(QQuickWindow *window) { maybeUpdate(window); } // identical for this implementation.
-void QSGGuiThreadRenderLoop::resize(QQuickWindow *, const QSize &)
-{
-}
-
-
-
void QSGGuiThreadRenderLoop::maybeUpdate(QQuickWindow *window)
{
if (!m_windows.contains(window))
// typically a result of QQuickWindow::update().
const QEvent::Type WM_RequestRepaint = QEvent::Type(QEvent::User + 5);
-// Passed by the RL to the RT when a window has changed size.
-const QEvent::Type WM_Resize = QEvent::Type(QEvent::User + 6);
-
// Passed by the RL to the RT to free up maybe release SG and GL contexts
// if no windows are rendering.
const QEvent::Type WM_TryRelease = QEvent::Type(QEvent::User + 7);
bool inDestructor;
};
-class WMResizeEvent : public WMWindowEvent
-{
-public:
- WMResizeEvent(QQuickWindow *c, const QSize &s) : WMWindowEvent(c, WM_Resize), size(s) { }
- QSize size;
-};
-
-
class WMExposeEvent : public WMWindowEvent
{
public:
pendingUpdate |= RepaintRequest;
- if (windowFor(m_windows, se->window)) {
+ if (Window *w = windowFor(m_windows, se->window)) {
+ w->size = se->size;
RLDEBUG1(" Render: - window already added...");
return true;
}
pendingUpdate |= SyncRequest;
return true;
- case WM_Resize: {
- RLDEBUG(" Render: WM_Resize");
- WMResizeEvent *re = static_cast<WMResizeEvent *>(e);
- Window *w = windowFor(m_windows, re->window);
- w->size = re->size;
- // No need to wake up here as we will get a sync shortly.. (see QSGThreadedRenderLoop::resize());
- return true; }
-
case WM_TryRelease:
RLDEBUG1(" Render: WM_TryRelease");
mutex.lock();
return result;
}
-/*
- Notify the render thread that the window is now a new size. Then
- locks GUI until render has adapted.
- */
-
-void QSGThreadedRenderLoop::resize(QQuickWindow *w, const QSize &size)
-{
- RLDEBUG1("GUI: resize");
-
- if (!m_thread->isRunning() || !m_windows.size() || !w->isExposed() || windowFor(m_windows, w) == 0) {
- return;
- }
-
- if (size.width() == 0 || size.height() == 0)
- return;
-
- RLDEBUG("GUI: - posting resize event...");
- m_thread->postEvent(new WMResizeEvent(w, size));
-
- polishAndSync();
-}
#include "qsgthreadedrenderloop.moc"