screencastutils.h   screencastutils.h 
/* /*
SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org> SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later SPDX-License-Identifier: LGPL-2.0-or-later
*/ */
#pragma once #pragma once
#include "kwinglplatform.h" #include "kwinglplatform.h"
#include "kwingltexture.h" #include "kwingltexture.h"
#include "kwinglutils.h"
#include <spa/buffer/buffer.h> #include <spa/buffer/buffer.h>
#include <spa/param/video/raw.h> #include <spa/param/video/raw.h>
namespace KWin namespace KWin
{ {
// in-place vertical mirroring // in-place vertical mirroring
static void mirrorVertically(uchar *data, int height, int stride) static void mirrorVertically(uchar *data, int height, int stride)
{ {
const int halfHeight = height / 2; const int halfHeight = height / 2;
skipping to change at line 62 skipping to change at line 63
bool isGLES = GLPlatform::instance()->isGLES(); bool isGLES = GLPlatform::instance()->isGLES();
bool invertNeeded = isGLES ^ texture->isYInverted(); bool invertNeeded = isGLES ^ texture->isYInverted();
const bool invertNeededAndSupported = invertNeeded && GLPlatform::insta nce()->supports(PackInvert); const bool invertNeededAndSupported = invertNeeded && GLPlatform::insta nce()->supports(PackInvert);
GLboolean prev; GLboolean prev;
if (invertNeededAndSupported) { if (invertNeededAndSupported) {
glGetBooleanv(GL_PACK_INVERT_MESA, &prev); glGetBooleanv(GL_PACK_INVERT_MESA, &prev);
glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE); glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE);
} }
texture->bind(); texture->bind();
if (GLPlatform::instance()->isGLES()) { // BUG: The nvidia driver fails to glGetTexImage
// Drop driver() == DriverNVidia some time after that's fixed
if (GLPlatform::instance()->isGLES() || GLPlatform::instance()->driver(
) == Driver_NVidia) {
GLFramebuffer fbo(texture);
GLFramebuffer::pushFramebuffer(&fbo);
glReadPixels(0, 0, size.width(), size.height(), closestGLType(forma t), GL_UNSIGNED_BYTE, spa->data); glReadPixels(0, 0, size.width(), size.height(), closestGLType(forma t), GL_UNSIGNED_BYTE, spa->data);
GLFramebuffer::popFramebuffer();
} else if (GLPlatform::instance()->glVersion() >= kVersionNumber(4, 5)) { } else if (GLPlatform::instance()->glVersion() >= kVersionNumber(4, 5)) {
glGetTextureImage(texture->texture(), 0, closestGLType(format), GL_ UNSIGNED_BYTE, spa->chunk->size, spa->data); glGetTextureImage(texture->texture(), 0, closestGLType(format), GL_ UNSIGNED_BYTE, spa->chunk->size, spa->data);
} else { } else {
glGetTexImage(texture->target(), 0, closestGLType(format), GL_UNSIG NED_BYTE, spa->data); glGetTexImage(texture->target(), 0, closestGLType(format), GL_UNSIG NED_BYTE, spa->data);
} }
if (invertNeededAndSupported) { if (invertNeededAndSupported) {
if (!prev) { if (!prev) {
glPixelStorei(GL_PACK_INVERT_MESA, prev); glPixelStorei(GL_PACK_INVERT_MESA, prev);
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 8 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/