From 3ab2ea40c4e8edd29713e4cbb96ce148346fd439 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 24 Jul 2021 16:18:03 +0300 Subject: [PATCH] Remove mask arg in Scene::paintScreen() Render backends don't pass anything to the scene. --- src/plugins/scenes/opengl/scene_opengl.cpp | 3 +-- src/plugins/scenes/qpainter/scene_qpainter.cpp | 5 +---- src/scene.cpp | 15 +++++++-------- src/scene.h | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/plugins/scenes/opengl/scene_opengl.cpp b/src/plugins/scenes/opengl/scene_opengl.cpp index d84c190daa..f8e485c82a 100644 --- a/src/plugins/scenes/opengl/scene_opengl.cpp +++ b/src/plugins/scenes/opengl/scene_opengl.cpp @@ -434,10 +434,9 @@ void SceneOpenGL::paint(int screenId, const QRegion &damage, const QListbeginFrame(screenId); const QRect geometry = screens()->geometry(screenId); @@ -99,8 +97,7 @@ void SceneQPainter::paint(int screenId, const QRegion &damage, const QListsetWindow(geometry); QRegion updateRegion, validRegion; - paintScreen(&mask, damage.intersected(geometry), repaint, &updateRegion, &validRegion, - renderLoop); + paintScreen(damage.intersected(geometry), repaint, &updateRegion, &validRegion, renderLoop); paintCursor(updateRegion); m_painter->end(); diff --git a/src/scene.cpp b/src/scene.cpp index 97a62dee91..add7d28631 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -143,13 +143,12 @@ void Scene::reallocRepaints() } // returns mask and possibly modified region -void Scene::paintScreen(int* mask, const QRegion &damage, const QRegion &repaint, +void Scene::paintScreen(const QRegion &damage, const QRegion &repaint, QRegion *updateRegion, QRegion *validRegion, RenderLoop *renderLoop, const QMatrix4x4 &projection) { const QSize &screenSize = screens()->size(); const QRegion displayRegion(0, 0, screenSize.width(), screenSize.height()); - *mask = (damage == displayRegion) ? 0 : PAINT_SCREEN_REGION; const std::chrono::milliseconds presentTime = std::chrono::duration_cast(renderLoop->nextPresentationTimestamp()); @@ -167,19 +166,19 @@ void Scene::paintScreen(int* mask, const QRegion &damage, const QRegion &repaint QRegion region = damage; ScreenPrePaintData pdata; - pdata.mask = *mask; + pdata.mask = (damage == displayRegion) ? 0 : PAINT_SCREEN_REGION; pdata.paint = region; effects->prePaintScreen(pdata, m_expectedPresentTimestamp); - *mask = pdata.mask; region = pdata.paint; - if (*mask & (PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS)) { + int mask = pdata.mask; + if (mask & (PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS)) { // Region painting is not possible with transformations, // because screen damage doesn't match transformed positions. - *mask &= ~PAINT_SCREEN_REGION; + mask &= ~PAINT_SCREEN_REGION; region = infiniteRegion(); - } else if (*mask & PAINT_SCREEN_REGION) { + } else if (mask & PAINT_SCREEN_REGION) { // make sure not to go outside visible screen region &= displayRegion; } else { @@ -191,7 +190,7 @@ void Scene::paintScreen(int* mask, const QRegion &damage, const QRegion &repaint repaint_region = repaint; ScreenPaintData data(projection, effects->findScreen(painted_screen)); - effects->paintScreen(*mask, region, data); + effects->paintScreen(mask, region, data); Q_EMIT frameRendered(); diff --git a/src/scene.h b/src/scene.h index d411b3b88b..892a09c6e8 100644 --- a/src/scene.h +++ b/src/scene.h @@ -206,7 +206,7 @@ protected: void createStackingOrder(const QList &toplevels); void clearStackingOrder(); // shared implementation, starts painting the screen - void paintScreen(int *mask, const QRegion &damage, const QRegion &repaint, + void paintScreen(const QRegion &damage, const QRegion &repaint, QRegion *updateRegion, QRegion *validRegion, RenderLoop *renderLoop, const QMatrix4x4 &projection = QMatrix4x4()); // Render cursor texture in case hardware cursor is disabled/non-applicable