plugins/screencast: Prefer glReadnPixels() and glGetnTexImage()
They should prevent potentially writing texture data outside the bounds of the memfd buffer.
This commit is contained in:
parent
b452a5a5fb
commit
74d7c33a97
1 changed files with 6 additions and 4 deletions
|
@ -57,12 +57,14 @@ static void doGrabTexture(GLTexture *texture, QImage *target)
|
|||
if (context->isOpenGLES() || context->glPlatform()->driver() == Driver_NVidia) {
|
||||
GLFramebuffer fbo(texture);
|
||||
GLFramebuffer::pushFramebuffer(&fbo);
|
||||
glReadPixels(0, 0, size.width(), size.height(), closestGLType(target->format()), GL_UNSIGNED_BYTE, target->bits());
|
||||
context->glReadnPixels(0, 0, size.width(), size.height(), closestGLType(target->format()), GL_UNSIGNED_BYTE, target->sizeInBytes(), target->bits());
|
||||
GLFramebuffer::popFramebuffer();
|
||||
} else if (context->openglVersion() >= Version(4, 5)) {
|
||||
glGetTextureImage(texture->texture(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->sizeInBytes(), target->bits());
|
||||
} else {
|
||||
glGetTexImage(texture->target(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->bits());
|
||||
if (context->openglVersion() >= Version(4, 5)) {
|
||||
glGetnTexImage(texture->target(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->sizeInBytes(), target->bits());
|
||||
} else {
|
||||
glGetTexImage(texture->target(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->bits());
|
||||
}
|
||||
}
|
||||
|
||||
if (invertNeededAndSupported) {
|
||||
|
|
Loading…
Reference in a new issue