plugins/zoom: do colorspace conversions between the screen textures
Otherwise colors and especially brightness levels can be quite wrong when the textures are used on a different screen BUG: 488839
This commit is contained in:
parent
2fb485d67d
commit
9293df2681
2 changed files with 5 additions and 2 deletions
|
@ -277,6 +277,7 @@ ZoomEffect::OffscreenData *ZoomEffect::ensureOffscreenData(const RenderTarget &r
|
|||
|
||||
OffscreenData &data = m_offscreenData[effects->waylandDisplay() ? screen : nullptr];
|
||||
data.viewport = rect;
|
||||
data.color = renderTarget.colorDescription();
|
||||
|
||||
const GLenum textureFormat = renderTarget.colorDescription() == ColorDescription::sRGB ? GL_RGBA8 : GL_RGBA16F;
|
||||
if (!data.texture || data.texture->size() != nativeSize || data.texture->internalFormat() != textureFormat) {
|
||||
|
@ -390,7 +391,7 @@ void ZoomEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewp
|
|||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
auto shader = ShaderManager::instance()->pushShader(ShaderTrait::MapTexture);
|
||||
auto shader = ShaderManager::instance()->pushShader(ShaderTrait::MapTexture | ShaderTrait::TransformColorspace);
|
||||
for (auto &[screen, offscreen] : m_offscreenData) {
|
||||
QMatrix4x4 matrix;
|
||||
matrix.translate(xTranslation * scale, yTranslation * scale);
|
||||
|
@ -398,6 +399,7 @@ void ZoomEffect::paintScreen(const RenderTarget &renderTarget, const RenderViewp
|
|||
matrix.translate(offscreen.viewport.x() * scale, offscreen.viewport.y() * scale);
|
||||
|
||||
shader->setUniform(GLShader::Mat4Uniform::ModelViewProjectionMatrix, viewport.projectionMatrix() * matrix);
|
||||
shader->setColorspaceUniforms(offscreen.color, renderTarget.colorDescription());
|
||||
|
||||
offscreen.texture->render(offscreen.viewport.size() * scale);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config-kwin.h"
|
||||
|
||||
#include "core/colorspace.h"
|
||||
#include "effect/effect.h"
|
||||
#include <QTime>
|
||||
#include <QTimeLine>
|
||||
|
@ -95,6 +95,7 @@ private:
|
|||
std::unique_ptr<GLTexture> texture;
|
||||
std::unique_ptr<GLFramebuffer> framebuffer;
|
||||
QRect viewport;
|
||||
ColorDescription color = ColorDescription::sRGB;
|
||||
};
|
||||
|
||||
GLTexture *ensureCursorTexture();
|
||||
|
|
Loading…
Reference in a new issue