Do not use stackingOrder in LanczosFilter to get all EffectWindows
LanczosFilter tries to discard all cached textures in the timer event by getting the stacking order and iterating over it. But this approach seems wrong from several aspects. First of all the xStackingOrder does not include Deleted windows. So if a cached texture still exists on an EffectWindow for a Deleted it would not be discarded. Also the xStackingOrder could result in an update from X because the stacking order is currently considered dirty. Last but not least the EffectsHandler::stackingOrder creates a temporary list of EffectWindows - good for Effects but not necessarily useful inside KWin core. Instead the LanczosFilter gets the list of Clients, desktops, unmanaged and deleted and iterates over them to check whether there is a texture to discard. REVIEW: 109954
This commit is contained in:
parent
504cb6fa4d
commit
0cbc79193b
2 changed files with 25 additions and 8 deletions
|
@ -20,7 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*********************************************************************/
|
||||
|
||||
#include "lanczosfilter.h"
|
||||
#include "client.h"
|
||||
#include "deleted.h"
|
||||
#include "effects.h"
|
||||
#include "unmanaged.h"
|
||||
#include "options.h"
|
||||
|
||||
#include <kwinglutils.h>
|
||||
|
@ -388,15 +391,27 @@ void LanczosFilter::timerEvent(QTimerEvent *event)
|
|||
delete m_offscreenTex;
|
||||
m_offscreenTarget = 0;
|
||||
m_offscreenTex = 0;
|
||||
foreach (EffectWindow * w, effects->stackingOrder()) {
|
||||
QVariant cachedTextureVariant = w->data(LanczosCacheRole);
|
||||
if (cachedTextureVariant.isValid()) {
|
||||
GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value<void*>());
|
||||
delete cachedTexture;
|
||||
cachedTexture = 0;
|
||||
w->setData(LanczosCacheRole, QVariant());
|
||||
}
|
||||
foreach (Client *c, Workspace::self()->clientList()) {
|
||||
discardCacheTexture(c->effectWindow());
|
||||
}
|
||||
foreach (Client *c, Workspace::self()->desktopList()) {
|
||||
discardCacheTexture(c->effectWindow());
|
||||
}
|
||||
foreach (Unmanaged *u, Workspace::self()->unmanagedList()) {
|
||||
discardCacheTexture(u->effectWindow());
|
||||
}
|
||||
foreach (Deleted *d, Workspace::self()->deletedList()) {
|
||||
discardCacheTexture(d->effectWindow());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LanczosFilter::discardCacheTexture(EffectWindow *w)
|
||||
{
|
||||
QVariant cachedTextureVariant = w->data(LanczosCacheRole);
|
||||
if (cachedTextureVariant.isValid()) {
|
||||
delete static_cast< GLTexture*>(cachedTextureVariant.value<void*>());
|
||||
w->setData(LanczosCacheRole, QVariant());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
class EffectWindow;
|
||||
class EffectWindowImpl;
|
||||
class WindowPaintData;
|
||||
class GLTexture;
|
||||
|
@ -55,6 +56,7 @@ private:
|
|||
void init();
|
||||
void updateOffscreenSurfaces();
|
||||
void setUniforms();
|
||||
void discardCacheTexture(EffectWindow *w);
|
||||
|
||||
void createKernel(float delta, int *kernelSize);
|
||||
void createOffsets(int count, float width, Qt::Orientation direction);
|
||||
|
|
Loading…
Reference in a new issue