summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration/client
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@digia.com>2013-08-23 09:21:26 +0200
committerMorten Johan Sørvig <morten.sorvig@digia.com>2014-12-17 13:46:27 +0100
commit7ef5e2e4863bde5495cc17b60680271d3c09f78f (patch)
tree78afeb00fc67787286b264384555d2923242e9b3 /src/hardwareintegration/client
parent198d7a51d4fc894fca691c1f8243372e876af68a (diff)
Implement high-dpi support
Wayland 1.2 added support for display scaling, where wl_output has a "scale" event informing the the client that the compositor will scale the output surfaces by the given factor. The client then has the option of providing large surfaces to match the target pixel densety and bypass the compositor's scaling. This is done by calling wl_surface::set_buffer_scale. Re-use the current high-dpi support in Qt by implementing devicePixelRatio() for QWaylandScreen and QWaylandWindow. Provide high resolution buffers both for raster and OpenGL graphics. Introduce a new coordinate system: buffer coordinates, which is related to the window coordinate system via an "int scale" scale factor. This scale factor corresponds to Qts qreal devicePixelRatio, but we keep the name and the type in the QtWayland implementation. Change-Id: Ie10d7e5b4833480a9a25d96a26ad02150eb6e83f Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
Diffstat (limited to 'src/hardwareintegration/client')
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp5
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
index 9b445e10c..473e7d51d 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
@@ -106,7 +106,7 @@ void QWaylandEglWindow::updateSurface(bool create)
{
QMargins margins = frameMargins();
QRect rect = geometry();
- QSize sizeWithMargins = rect.size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom());
+ QSize sizeWithMargins = (rect.size() + QSize(margins.left() + margins.right(), margins.top() + margins.bottom())) * scale();
// wl_egl_windows must have both width and height > 0
// mesa's egl returns NULL if we try to create a, invalid wl_egl_window, however not all EGL
@@ -175,7 +175,8 @@ GLuint QWaylandEglWindow::contentFBO() const
if (m_resize || !m_contentFBO) {
QOpenGLFramebufferObject *old = m_contentFBO;
- m_contentFBO = new QOpenGLFramebufferObject(geometry().width(), geometry().height(), QOpenGLFramebufferObject::CombinedDepthStencil);
+ QSize fboSize = geometry().size() * scale();
+ m_contentFBO = new QOpenGLFramebufferObject(fboSize.width(), fboSize.height(), QOpenGLFramebufferObject::CombinedDepthStencil);
delete old;
m_resize = false;
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index 81c74a7d5..52baaf30c 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -143,7 +143,8 @@ public:
QOpenGLTextureCache *cache = QOpenGLTextureCache::cacheForContext(m_context->context());
QRect windowRect = window->window()->frameGeometry();
- glViewport(0, 0, windowRect.width(), windowRect.height());
+ int scale = window->scale() ;
+ glViewport(0, 0, windowRect.width() * scale, windowRect.height() * scale);
glDisable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
@@ -205,7 +206,7 @@ public:
m_blitProgram->setAttributeArray(0, squareVertices, 2);
glBindTexture(GL_TEXTURE_2D, window->contentTexture());
QRect r = window->contentsRect();
- glViewport(r.x(), r.y(), r.width(), r.height());
+ glViewport(r.x(), r.y(), r.width() * scale, r.height() * scale);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
//Cleanup