libkwineffects: Make OffscreenEffect render window with its output's scale
Render the window at its output's scale to make the window less blurry. BUG: 470607
This commit is contained in:
parent
984af8f4f2
commit
b9da04bf45
1 changed files with 5 additions and 6 deletions
|
@ -91,10 +91,9 @@ void OffscreenEffect::apply(EffectWindow *window, int mask, WindowPaintData &dat
|
||||||
|
|
||||||
void OffscreenData::maybeRender(EffectWindow *window)
|
void OffscreenData::maybeRender(EffectWindow *window)
|
||||||
{
|
{
|
||||||
QRectF logicalGeometry = window->expandedGeometry();
|
const QRectF logicalGeometry = window->expandedGeometry();
|
||||||
// FIXME no render target, as this isn't always called from rendering code
|
const qreal scale = window->screen()->devicePixelRatio();
|
||||||
// The texture size should take the scale into account though...
|
const QSize textureSize = (logicalGeometry.size() * scale).toSize();
|
||||||
QSize textureSize = logicalGeometry.toAlignedRect().size();
|
|
||||||
|
|
||||||
if (!m_texture || m_texture->size() != textureSize) {
|
if (!m_texture || m_texture->size() != textureSize) {
|
||||||
m_texture = GLTexture::allocate(GL_RGBA8, textureSize);
|
m_texture = GLTexture::allocate(GL_RGBA8, textureSize);
|
||||||
|
@ -109,13 +108,13 @@ void OffscreenData::maybeRender(EffectWindow *window)
|
||||||
|
|
||||||
if (m_isDirty) {
|
if (m_isDirty) {
|
||||||
RenderTarget renderTarget(m_fbo.get());
|
RenderTarget renderTarget(m_fbo.get());
|
||||||
RenderViewport viewport(logicalGeometry, 1, renderTarget);
|
RenderViewport viewport(logicalGeometry, scale, renderTarget);
|
||||||
GLFramebuffer::pushFramebuffer(m_fbo.get());
|
GLFramebuffer::pushFramebuffer(m_fbo.get());
|
||||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
QMatrix4x4 projectionMatrix;
|
QMatrix4x4 projectionMatrix;
|
||||||
projectionMatrix.ortho(QRectF(0, 0, logicalGeometry.width(), logicalGeometry.height()));
|
projectionMatrix.ortho(QRectF(0, 0, textureSize.width(), textureSize.height()));
|
||||||
|
|
||||||
WindowPaintData data;
|
WindowPaintData data;
|
||||||
data.setXTranslation(-logicalGeometry.x());
|
data.setXTranslation(-logicalGeometry.x());
|
||||||
|
|
Loading…
Reference in a new issue