Commit 29837278 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

effects: Make DeformEffect disable clipping if specified region is infinite

The Scene no longer clips window quads if the specified paint region is
infinite. The infinite region is defined as (INT_MIN/2, INT_MIN/2,
INT_MAX, INT_MAX). If you try to scale the infinite region, you will
easily hit integer overflow.

This change makes the DeformEffect disable geometry clipping if the given
paint region is infinite region in order to avoid hitting integer
overflow.
parent f07d6bd4
Pipeline #174290 passed with stage
in 26 minutes and 8 seconds
......@@ -154,9 +154,6 @@ void DeformEffectPrivate::paint(EffectWindow *window, GLTexture *texture, const
quads.makeInterleavedArrays(primitiveType, map, texture->matrix(NormalizedCoordinates));
vbo->unmap();
vbo->bindArrays();
glEnable(GL_SCISSOR_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
const qreal rgb = data.brightness() * data.opacity();
const qreal a = data.opacity();
......@@ -169,12 +166,24 @@ void DeformEffectPrivate::paint(EffectWindow *window, GLTexture *texture, const
shader->setUniform(GLShader::TextureWidth, texture->width());
shader->setUniform(GLShader::TextureHeight, texture->height());
const bool clipping = region != infiniteRegion();
const QRegion clipRegion = clipping ? effects->mapToRenderTarget(region) : infiniteRegion();
if (clipping) {
glEnable(GL_SCISSOR_TEST);
}
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
texture->bind();
vbo->draw(effects->mapToRenderTarget(region), primitiveType, 0, verticesPerQuad * quads.count(), true);
vbo->draw(clipRegion, primitiveType, 0, verticesPerQuad * quads.count(), clipping);
texture->unbind();
glDisable(GL_BLEND);
glDisable(GL_SCISSOR_TEST);
if (clipping) {
glDisable(GL_SCISSOR_TEST);
}
vbo->unbindArrays();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment