plugins/screencast: make context current later, don't make it current twice

This commit is contained in:
Xaver Hugl 2023-01-31 13:29:49 +01:00 committed by Vlad Zahorodnii
parent abd59be232
commit 6f1b36d3b4

View file

@ -354,9 +354,6 @@ bool ScreenCastStream::createStream()
if (m_cursor.mode == KWaylandServer::ScreencastV1Interface::Embedded) {
connect(Cursors::self(), &Cursors::positionChanged, this, [this] {
if (auto scene = Compositor::self()->scene()) {
scene->makeOpenGLContextCurrent();
}
recordFrame({});
});
} else if (m_cursor.mode == KWaylandServer::ScreencastV1Interface::Metadata) {
@ -379,7 +376,6 @@ void ScreenCastStream::stop()
void ScreenCastStream::recordFrame(const QRegion &_damagedRegion)
{
static_cast<OpenGLBackend *>(Compositor::self()->backend())->makeCurrent();
QRegion damagedRegion = _damagedRegion;
Q_ASSERT(!m_stopped);
@ -428,6 +424,7 @@ void ScreenCastStream::recordFrame(const QRegion &_damagedRegion)
}
spa_data->chunk->offset = 0;
static_cast<OpenGLBackend *>(Compositor::self()->backend())->makeCurrent();
if (data || spa_data[0].type == SPA_DATA_MemFd) {
const bool hasAlpha = m_source->hasAlphaChannel();
const int bpp = data && !hasAlpha ? 3 : 4;