effects/contrast: Remove paint area tracking
Unlike the blur effect, neighbor pixels don't affect the results of the contrast effect so it doesn't have to extend the painted area.
This commit is contained in:
parent
d06746fa5c
commit
c2e3496888
2 changed files with 0 additions and 59 deletions
|
@ -347,61 +347,6 @@ void ContrastEffect::uploadGeometry(GLVertexBuffer *vbo, const QRegion ®ion)
|
|||
vbo->setAttribLayout(layout, 2, sizeof(QVector2D));
|
||||
}
|
||||
|
||||
void ContrastEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime)
|
||||
{
|
||||
m_paintedArea = QRegion();
|
||||
m_currentContrast = QRegion();
|
||||
|
||||
effects->prePaintScreen(data, presentTime);
|
||||
}
|
||||
|
||||
void ContrastEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, std::chrono::milliseconds presentTime)
|
||||
{
|
||||
// this effect relies on prePaintWindow being called in the bottom to top order
|
||||
|
||||
effects->prePaintWindow(w, data, presentTime);
|
||||
|
||||
if (!w->isPaintingEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!shader || !shader->isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we don't have to blur a region we don't see
|
||||
m_currentContrast -= data.clip;
|
||||
// if we have to paint a non-opaque part of this window that intersects with the
|
||||
// currently blurred region (which is not cached) we have to redraw the whole region
|
||||
if ((data.paint-data.clip).intersects(m_currentContrast)) {
|
||||
data.paint |= m_currentContrast;
|
||||
}
|
||||
|
||||
// in case this window has regions to be blurred
|
||||
const QRect screen = effects->virtualScreenGeometry();
|
||||
const QRegion contrastArea = contrastRegion(w).translated(w->pos()) & screen;
|
||||
|
||||
// we are not caching the window
|
||||
|
||||
// if this window or an window underneath the modified area is painted again we have to
|
||||
// do everything
|
||||
if (m_paintedArea.intersects(contrastArea) || data.paint.intersects(contrastArea)) {
|
||||
data.paint |= contrastArea;
|
||||
|
||||
// we have to check again whether we do not damage a blurred area
|
||||
// of a window we do not cache
|
||||
if (contrastArea.intersects(m_currentContrast)) {
|
||||
data.paint |= m_currentContrast;
|
||||
}
|
||||
}
|
||||
|
||||
m_currentContrast |= contrastArea;
|
||||
|
||||
|
||||
// m_paintedArea keep track of all repainted areas
|
||||
m_paintedArea -= data.clip;
|
||||
m_paintedArea |= data.paint;
|
||||
}
|
||||
|
||||
bool ContrastEffect::shouldContrast(const EffectWindow *w, int mask, const WindowPaintData &data) const
|
||||
{
|
||||
if (!shader || !shader->isValid())
|
||||
|
|
|
@ -33,8 +33,6 @@ public:
|
|||
static bool enabledByDefault();
|
||||
|
||||
static QMatrix4x4 colorMatrix(qreal contrast, qreal intensity, qreal saturation);
|
||||
void prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime) override;
|
||||
void prePaintWindow(EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime) override;
|
||||
void drawWindow(EffectWindow *w, int mask, const QRegion ®ion, WindowPaintData &data) override;
|
||||
void paintEffectFrame(EffectFrame *frame, const QRegion ®ion, double opacity, double frameOpacity) override;
|
||||
|
||||
|
@ -66,8 +64,6 @@ private:
|
|||
private:
|
||||
ContrastShader *shader;
|
||||
long net_wm_contrast_region = 0;
|
||||
QRegion m_paintedArea; // actually painted area which is greater than m_damagedArea
|
||||
QRegion m_currentContrast; // keeps track of the currently contrasted area of non-caching windows(from bottom to top)
|
||||
QHash< const EffectWindow*, QMatrix4x4> m_colorMatrices;
|
||||
QHash< const EffectWindow*, QMetaObject::Connection > m_contrastChangedConnections; // used only in Wayland to keep track of effect changed
|
||||
static KWaylandServer::ContrastManagerInterface *s_contrastManager;
|
||||
|
|
Loading…
Reference in a new issue