eglfs: Revive QWidget rendering
After recent changes to widgets and backingstores, attempting to run any widget-based application with eglfs resulted in a crash. The backingstore implementation used here was not fully migrated. Update flush() to create the rendering infrastructure if needed, and make it call into rhiFlush(). Amends eb4cb719257d3b57cd801273d4011579d8c81714 Change-Id: I253c37200f5a902a0e61b62581ac456549f3aeba Fixes: QTBUG-126221 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 0a10d23c4a49dd14a1ded41b7cc6921909b0ee7a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
885a49548d
commit
aca3b95700
@ -134,36 +134,24 @@ void QOpenGLCompositorBackingStore::updateTexture()
|
||||
}
|
||||
}
|
||||
|
||||
void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset)
|
||||
void QOpenGLCompositorBackingStore::flush(QWindow *flushedWindow, const QRegion ®ion, const QPoint &offset)
|
||||
{
|
||||
// Called for ordinary raster windows.
|
||||
auto *handle = dynamic_cast<QOpenGLCompositorWindow *>(window->handle());
|
||||
if (handle && !handle->backingStore())
|
||||
handle->setBackingStore(this);
|
||||
|
||||
Q_UNUSED(region);
|
||||
Q_UNUSED(offset);
|
||||
|
||||
m_rhi = rhi(window);
|
||||
Q_ASSERT(m_rhi);
|
||||
if (!rhi(flushedWindow)) {
|
||||
QPlatformBackingStoreRhiConfig rhiConfig;
|
||||
rhiConfig.setApi(QPlatformBackingStoreRhiConfig::OpenGL);
|
||||
rhiConfig.setEnabled(true);
|
||||
createRhi(flushedWindow, rhiConfig);
|
||||
}
|
||||
|
||||
QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
|
||||
QOpenGLContext *dstCtx = compositor->context();
|
||||
if (!dstCtx)
|
||||
return;
|
||||
|
||||
QWindow *dstWin = compositor->targetWindow();
|
||||
if (!dstWin)
|
||||
return;
|
||||
|
||||
if (!dstCtx->makeCurrent(dstWin))
|
||||
return;
|
||||
|
||||
updateTexture();
|
||||
m_textures->clear();
|
||||
m_textures->appendTexture(nullptr, m_bsTextureWrapper, window->geometry());
|
||||
|
||||
compositor->update();
|
||||
static QPlatformTextureList emptyTextureList;
|
||||
bool translucentBackground = m_image.hasAlphaChannel();
|
||||
rhiFlush(flushedWindow, flushedWindow->devicePixelRatio(),
|
||||
region, offset, &emptyTextureList, translucentBackground);
|
||||
}
|
||||
|
||||
QPlatformBackingStore::FlushResult QOpenGLCompositorBackingStore::rhiFlush(QWindow *window,
|
||||
|
Loading…
x
Reference in New Issue
Block a user