diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-07-02 10:28:53 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-07-02 10:28:53 (GMT) |
commit | 6dc1536c1d3964a16484b2a55aa161b49e639901 (patch) | |
tree | de78809e0b347467f8aa53a6c1f82a064e49a16b /src/opengl | |
parent | b1832b5a32e1ff5536e5fe9efeca3013ba947eec (diff) | |
download | Qt-6dc1536c1d3964a16484b2a55aa161b49e639901.zip Qt-6dc1536c1d3964a16484b2a55aa161b49e639901.tar.gz Qt-6dc1536c1d3964a16484b2a55aa161b49e639901.tar.bz2 |
Fixed GL blur filter to handle painter translates and larger FBO sizes.
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qglpixmapfilter.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 4e859d4..662e818 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -338,6 +338,8 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBindTexture(GL_TEXTURE_2D, 0); QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(painter->paintEngine()); @@ -355,12 +357,26 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const // first pass, to fbo fbo->bind(); manager->setCustomShader(customShader); + + QTransform transform = engine->state()->matrix; + + if (!transform.isIdentity()) { + engine->state()->matrix = QTransform(); + engine->transformChanged(); + } + engine->drawPixmap(src.rect(), src, src.rect()); + + if (!transform.isIdentity()) { + engine->state()->matrix = transform; + engine->transformChanged(); + } + fbo->release(); // second pass, to widget m_program->setUniformValue("delta", 0.0, 1.0); - engine->drawTexture(src.rect().translated(pos.x(), pos.y()), fbo->texture(), src.size(), src.rect()); + engine->drawTexture(src.rect().translated(pos.x(), pos.y()), fbo->texture(), fbo->size(), src.rect().translated(0, fbo->height() - src.height())); manager->setCustomShader(0); painter->restore(); |