Commit 0c3a8e6f authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

scene: Make paintScreen() clip the damage region

paintScreen() already tries to ensure that the damage region doesn't go
outside the scene geometry. With this change, it will try to clip the
damage region to the render target rect, which saves us an extra region
intersection and simplifies code that calls paintScreen().
parent 648b2a5b
Pipeline #138162 passed with stage
in 15 minutes and 27 seconds
......@@ -269,8 +269,6 @@ void Scene::paintScreen(AbstractOutput *output, const QList<Toplevel *> &topleve
void Scene::paintScreen(const QRegion &damage, const QRegion &repaint,
QRegion *updateRegion, QRegion *validRegion)
{
const QRegion displayRegion(geometry());
const RenderLoop *renderLoop = painted_screen->renderLoop();
const std::chrono::milliseconds presentTime =
std::chrono::duration_cast<std::chrono::milliseconds>(renderLoop->nextPresentationTimestamp());
......@@ -288,6 +286,7 @@ void Scene::paintScreen(const QRegion &damage, const QRegion &repaint,
auto effectsImpl = static_cast<EffectsHandlerImpl *>(effects);
effectsImpl->startPaint();
const QRegion displayRegion(renderTargetRect());
QRegion region = damage;
auto screen = EffectScreenImpl::get(painted_screen);
......@@ -382,7 +381,7 @@ void Scene::paintGenericScreen(int orig_mask, const ScreenPaintData &)
phase2.append({w, infiniteRegion(), data.clip, data.mask,});
}
damaged_region = geometry();
damaged_region = renderTargetRect();
if (m_paintScreenCount == 1) {
aboutToStartPainting(painted_screen, damaged_region);
......@@ -480,7 +479,7 @@ void Scene::paintSimpleScreen(int orig_mask, const QRegion &region)
const QRegion repaintClip = repaint_region - dirtyArea;
dirtyArea |= repaint_region;
const QRegion displayRegion(geometry());
const QRegion displayRegion(renderTargetRect());
bool fullRepaint(dirtyArea == displayRegion); // spare some expensive region operations
if (!fullRepaint) {
extendPaintRegion(dirtyArea, opaqueFullscreen);
......@@ -607,7 +606,7 @@ void Scene::clearStackingOrder()
void Scene::paintWindow(Window* w, int mask, const QRegion &_region)
{
// no painting outside visible screen (and no transformations)
const QRegion region = _region & geometry();
const QRegion region = _region & renderTargetRect();
if (region.isEmpty()) // completely clipped
return;
......
......@@ -248,7 +248,7 @@ void SceneOpenGL::paint(AbstractOutput *output, const QRegion &damage, const QLi
repaint = m_backend->beginFrame(output);
GLVertexBuffer::streamingBuffer()->beginFrame();
paintScreen(damage.intersected(renderTargetRect()), repaint, &update, &valid);
paintScreen(damage, repaint, &update, &valid);
paintCursor(output, valid);
renderLoop->endFrame();
......
......@@ -86,7 +86,7 @@ void SceneQPainter::paint(AbstractOutput *output, const QRegion &damage, const Q
m_painter->setWindow(geometry);
QRegion updateRegion, validRegion;
paintScreen(damage.intersected(geometry), repaint, &updateRegion, &validRegion);
paintScreen(damage, repaint, &updateRegion, &validRegion);
paintCursor(output, updateRegion);
m_painter->end();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment