kwineffects: Add GLTexture::render() overload that takes no scissor region
In many cases, we don't care about the scissor region. This change adds a relevant overload to make code easier to read.
This commit is contained in:
parent
52beb213e7
commit
e9af67af3e
12 changed files with 26 additions and 21 deletions
|
@ -135,7 +135,7 @@ void MagnifierEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintDa
|
|||
mvp.ortho(0, size.width(), size.height(), 0, 0, 65535);
|
||||
mvp.translate(area.x(), area.y());
|
||||
s->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
m_texture->render(infiniteRegion(), area);
|
||||
m_texture->render(area);
|
||||
ShaderManager::instance()->popShader();
|
||||
m_texture->unbind();
|
||||
QVector<float> verts;
|
||||
|
|
|
@ -94,7 +94,7 @@ void ScreenEdgeEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintD
|
|||
QMatrix4x4 mvp = data.projectionMatrix();
|
||||
mvp.translate((*it)->geometry.x(), (*it)->geometry.y());
|
||||
binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
texture->render(infiniteRegion(), (*it)->geometry);
|
||||
texture->render((*it)->geometry);
|
||||
texture->unbind();
|
||||
glDisable(GL_BLEND);
|
||||
} else if (effects->compositingType() == QPainterCompositing) {
|
||||
|
|
|
@ -141,7 +141,7 @@ void ScreenTransformEffect::paintScreen(int mask, const QRegion ®ion, KWin::S
|
|||
shader->setUniform(GLShader::ModelViewProjectionMatrix, matrix);
|
||||
|
||||
state.m_texture->bind();
|
||||
state.m_texture->render(infiniteRegion(), textureRect);
|
||||
state.m_texture->render(textureRect);
|
||||
state.m_texture->unbind();
|
||||
}
|
||||
effects->addRepaintFull();
|
||||
|
|
|
@ -229,7 +229,7 @@ void ShowFpsEffect::paintGL(int fps, const QMatrix4x4 &projectionMatrix)
|
|||
QMatrix4x4 mvp = projectionMatrix;
|
||||
mvp.translate(fpsTextRect.x(), fpsTextRect.y());
|
||||
binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
fpsText->render(infiniteRegion(), fpsTextRect);
|
||||
fpsText->render(fpsTextRect);
|
||||
fpsText->unbind();
|
||||
effects->addRepaint(fpsTextRect);
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ void StartupFeedbackEffect::paintScreen(int mask, const QRegion ®ion, ScreenP
|
|||
QMatrix4x4 mvp = data.projectionMatrix();
|
||||
mvp.translate(m_currentGeometry.x(), m_currentGeometry.y());
|
||||
ShaderManager::instance()->getBoundShader()->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
texture->render(infiniteRegion(), m_currentGeometry);
|
||||
texture->render(m_currentGeometry);
|
||||
ShaderManager::instance()->popShader();
|
||||
texture->unbind();
|
||||
glDisable(GL_BLEND);
|
||||
|
|
|
@ -119,7 +119,7 @@ void TrackMouseEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintD
|
|||
mvp.translate(m_lastRect[i].x(), m_lastRect[i].y());
|
||||
shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
m_texture[i]->bind();
|
||||
m_texture[i]->render(infiniteRegion(), m_lastRect[i]);
|
||||
m_texture[i]->render(m_lastRect[i]);
|
||||
m_texture[i]->unbind();
|
||||
}
|
||||
glDisable(GL_BLEND);
|
||||
|
|
|
@ -344,7 +344,7 @@ void ZoomEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData& d
|
|||
QMatrix4x4 mvp = data.projectionMatrix();
|
||||
mvp.translate(rect.x(), rect.y());
|
||||
s->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
cursorTexture->render(infiniteRegion(), rect);
|
||||
cursorTexture->render(rect);
|
||||
ShaderManager::instance()->popShader();
|
||||
cursorTexture->unbind();
|
||||
glDisable(GL_BLEND);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
#include "kwinconfig.h" // KWIN_HAVE_OPENGL
|
||||
|
||||
#include "kwineffects.h"
|
||||
#include "kwinglplatform.h"
|
||||
#include "kwinglutils_funcs.h"
|
||||
#include "kwinglutils.h"
|
||||
|
@ -496,6 +496,11 @@ void GLTexture::unbind()
|
|||
glBindTexture(d->m_target, 0);
|
||||
}
|
||||
|
||||
void GLTexture::render(const QRect &rect)
|
||||
{
|
||||
render(infiniteRegion(), rect, false);
|
||||
}
|
||||
|
||||
void GLTexture::render(const QRegion ®ion, const QRect& rect, bool hardwareClipping)
|
||||
{
|
||||
Q_D(GLTexture);
|
||||
|
|
|
@ -103,6 +103,7 @@ public:
|
|||
virtual void discard();
|
||||
void bind();
|
||||
void unbind();
|
||||
void render(const QRect &rect);
|
||||
void render(const QRegion ®ion, const QRect& rect, bool hardwareClipping = false);
|
||||
|
||||
GLuint texture() const;
|
||||
|
|
|
@ -58,7 +58,7 @@ void OutputScreenCastSource::render(GLRenderTarget *target)
|
|||
|
||||
GLRenderTarget::pushRenderTarget(target);
|
||||
outputTexture->bind();
|
||||
outputTexture->render(infiniteRegion(), geometry);
|
||||
outputTexture->render(geometry);
|
||||
outputTexture->unbind();
|
||||
GLRenderTarget::popRenderTarget();
|
||||
}
|
||||
|
|
|
@ -427,7 +427,7 @@ void ScreenCastStream::recordFrame(const QRegion &damagedRegion)
|
|||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
m_cursor.texture->render(infiniteRegion(), cursorRect);
|
||||
m_cursor.texture->render(cursorRect);
|
||||
glDisable(GL_BLEND);
|
||||
m_cursor.texture->unbind();
|
||||
m_cursor.lastRect = cursorRect;
|
||||
|
|
|
@ -164,7 +164,7 @@ void SceneOpenGL::paintCursor(AbstractOutput *output, const QRegion &rendered)
|
|||
m_cursorTexture->bind();
|
||||
ShaderBinder binder(ShaderTrait::MapTexture);
|
||||
binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
m_cursorTexture->render(region, cursorRect);
|
||||
m_cursorTexture->render(cursorRect);
|
||||
m_cursorTexture->unbind();
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ void SceneOpenGL::paintOffscreenQuickView(OffscreenQuickView *w)
|
|||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
t->bind();
|
||||
t->render(QRegion(infiniteRegion()), w->geometry());
|
||||
t->render(w->geometry());
|
||||
t->unbind();
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
|
@ -944,8 +944,7 @@ void SceneOpenGL::EffectFrame::render(const QRegion &_region, double opacity, do
|
|||
if (m_effectFrame->geometry().isEmpty())
|
||||
return; // Nothing to display
|
||||
|
||||
Q_UNUSED(_region);
|
||||
const QRegion region = infiniteRegion(); // TODO: Old region doesn't seem to work with OpenGL
|
||||
Q_UNUSED(_region); // TODO: Old region doesn't seem to work with OpenGL
|
||||
|
||||
GLShader* shader = m_effectFrame->shader();
|
||||
if (!shader) {
|
||||
|
@ -1087,7 +1086,7 @@ void SceneOpenGL::EffectFrame::render(const QRegion &_region, double opacity, do
|
|||
mvp.translate(pt.x(), pt.y());
|
||||
shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
|
||||
m_unstyledVBO->render(region, GL_TRIANGLES);
|
||||
m_unstyledVBO->render(GL_TRIANGLES);
|
||||
m_unstyledTexture->unbind();
|
||||
} else if (m_effectFrame->style() == EffectFrameStyled) {
|
||||
if (!m_texture) // Lazy creation
|
||||
|
@ -1106,7 +1105,7 @@ void SceneOpenGL::EffectFrame::render(const QRegion &_region, double opacity, do
|
|||
mvp.translate(rect.x(), rect.y());
|
||||
shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
|
||||
m_texture->render(region, rect);
|
||||
m_texture->render(rect);
|
||||
m_texture->unbind();
|
||||
|
||||
}
|
||||
|
@ -1126,7 +1125,7 @@ void SceneOpenGL::EffectFrame::render(const QRegion &_region, double opacity, do
|
|||
shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp);
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
m_selectionTexture->bind();
|
||||
m_selectionTexture->render(region, m_effectFrame->selection());
|
||||
m_selectionTexture->render(m_effectFrame->selection());
|
||||
m_selectionTexture->unbind();
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
@ -1148,7 +1147,7 @@ void SceneOpenGL::EffectFrame::render(const QRegion &_region, double opacity, do
|
|||
}
|
||||
|
||||
m_oldIconTexture->bind();
|
||||
m_oldIconTexture->render(region, QRect(topLeft, m_effectFrame->iconSize()));
|
||||
m_oldIconTexture->render(QRect(topLeft, m_effectFrame->iconSize()));
|
||||
m_oldIconTexture->unbind();
|
||||
if (shader) {
|
||||
const float a = opacity * m_effectFrame->crossFadeProgress();
|
||||
|
@ -1165,7 +1164,7 @@ void SceneOpenGL::EffectFrame::render(const QRegion &_region, double opacity, do
|
|||
m_iconTexture = new GLTexture(m_effectFrame->icon().pixmap(m_effectFrame->iconSize()));
|
||||
}
|
||||
m_iconTexture->bind();
|
||||
m_iconTexture->render(region, QRect(topLeft, m_effectFrame->iconSize()));
|
||||
m_iconTexture->render(QRect(topLeft, m_effectFrame->iconSize()));
|
||||
m_iconTexture->unbind();
|
||||
}
|
||||
|
||||
|
@ -1181,7 +1180,7 @@ void SceneOpenGL::EffectFrame::render(const QRegion &_region, double opacity, do
|
|||
}
|
||||
|
||||
m_oldTextTexture->bind();
|
||||
m_oldTextTexture->render(region, m_effectFrame->geometry());
|
||||
m_oldTextTexture->render(m_effectFrame->geometry());
|
||||
m_oldTextTexture->unbind();
|
||||
if (shader) {
|
||||
const float a = opacity * m_effectFrame->crossFadeProgress();
|
||||
|
@ -1198,7 +1197,7 @@ void SceneOpenGL::EffectFrame::render(const QRegion &_region, double opacity, do
|
|||
|
||||
if (m_textTexture) {
|
||||
m_textTexture->bind();
|
||||
m_textTexture->render(region, m_effectFrame->geometry());
|
||||
m_textTexture->render(m_effectFrame->geometry());
|
||||
m_textTexture->unbind();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue