[scene] Discard quads when the surface-to-buffer matrix is changed

The surface-to-buffer matrix provides a generic mechanism for mapping
things from the surface-local coordinate space to the buffer coordinate
space. If it changes, we know for sure that the texture coordinates
have to be re-computed.
This commit is contained in:
Vlad Zahorodnii 2020-06-10 19:40:44 +03:00 committed by Vlad Zahorodnii
parent 1d34d29222
commit 4a681e3d47
3 changed files with 11 additions and 2 deletions

View file

@ -416,9 +416,9 @@ void Scene::addToplevel(Toplevel *c)
connect(monitor, &SubSurfaceMonitor::subSurfaceResized, w, &Window::discardQuads);
connect(monitor, &SubSurfaceMonitor::subSurfaceMapped, w, &Window::discardQuads);
connect(monitor, &SubSurfaceMonitor::subSurfaceUnmapped, w, &Window::discardQuads);
connect(monitor, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged, w, &Window::discardQuads);
connect(c->surface(), &KWaylandServer::SurfaceInterface::scaleChanged, w, &Window::discardQuads);
connect(c->surface(), &KWaylandServer::SurfaceInterface::viewportChanged, w, &Window::discardQuads);
connect(c->surface(), &KWaylandServer::SurfaceInterface::surfaceToBufferMatrixChanged, w, &Window::discardQuads);
}
connect(c, &Toplevel::screenScaleChanged, w, &Window::discardQuads);

View file

@ -46,6 +46,8 @@ void SubSurfaceMonitor::registerSubSurface(SubSurfaceInterface *subSurface)
this, &SubSurfaceMonitor::subSurfaceMapped);
connect(surface, &SurfaceInterface::unmapped,
this, &SubSurfaceMonitor::subSurfaceUnmapped);
connect(surface, &SurfaceInterface::surfaceToBufferMatrixChanged,
this, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged);
registerSurface(surface);
}
@ -64,6 +66,8 @@ void SubSurfaceMonitor::unregisterSubSurface(SubSurfaceInterface *subSurface)
this, &SubSurfaceMonitor::subSurfaceMapped);
disconnect(surface, &SurfaceInterface::unmapped,
this, &SubSurfaceMonitor::subSurfaceUnmapped);
disconnect(surface, &SurfaceInterface::surfaceToBufferMatrixChanged,
this, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged);
unregisterSurface(surface);
}

View file

@ -70,6 +70,11 @@ Q_SIGNALS:
* This signal is emitted when a sub-surface is unmapped.
*/
void subSurfaceUnmapped();
/**
* This signal is emitted when the mapping between the surface-local coordinate space
* and the buffer coordinate space for a sub-surface has changed.
*/
void subSurfaceSurfaceToBufferMatrixChanged();
private:
void registerSubSurface(KWaylandServer::SubSurfaceInterface *subSurface);