plugins/screentransform: Drop m_captured flag

It's redundant now. If there's an entry in m_states dictionary for the
given screen, then there's also a valid captured previous frame.
This commit is contained in:
Vlad Zahorodnii 2023-11-21 17:18:51 +02:00
parent 62f904b698
commit b8f2f87672
2 changed files with 2 additions and 6 deletions

View file

@ -101,9 +101,6 @@ void ScreenTransformEffect::addScreen(Output *screen)
RenderTarget renderTarget(state.m_prev.framebuffer.get()); RenderTarget renderTarget(state.m_prev.framebuffer.get());
scene->paint(renderTarget, screen->geometry()); scene->paint(renderTarget, screen->geometry());
// Now, the effect can cross-fade between current and previous state.
state.m_captured = true;
} else { } else {
m_states.remove(screen); m_states.remove(screen);
} }
@ -122,7 +119,7 @@ void ScreenTransformEffect::removeScreen(Output *screen)
void ScreenTransformEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) void ScreenTransformEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime)
{ {
auto it = m_states.find(data.screen); auto it = m_states.find(data.screen);
if (it != m_states.end() && it->m_captured) { if (it != m_states.end()) {
it->m_timeLine.advance(presentTime); it->m_timeLine.advance(presentTime);
if (it->m_timeLine.done()) { if (it->m_timeLine.done()) {
m_states.remove(data.screen); m_states.remove(data.screen);
@ -195,7 +192,7 @@ static QRectF lerp(const QRectF &a, const QRectF &b, qreal t)
void ScreenTransformEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::Output *screen) void ScreenTransformEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewport &viewport, int mask, const QRegion &region, KWin::Output *screen)
{ {
auto it = m_states.find(screen); auto it = m_states.find(screen);
if (it == m_states.end() || !it->m_captured) { if (it == m_states.end()) {
effects->paintScreen(renderTarget, viewport, mask, region, screen); effects->paintScreen(renderTarget, viewport, mask, region, screen);
return; return;
} }

View file

@ -52,7 +52,6 @@ private:
QRect m_oldGeometry; QRect m_oldGeometry;
OutputTransform m_oldTransform; OutputTransform m_oldTransform;
qreal m_angle = 0; qreal m_angle = 0;
bool m_captured = false;
}; };
void addScreen(Output *screen); void addScreen(Output *screen);