diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/opengl/qopengltextureblitter.cpp | 24 | ||||
-rw-r--r-- | src/gui/opengl/qopengltextureblitter_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qplatformbackingstore.cpp | 6 | ||||
-rw-r--r-- | src/platformsupport/eglconvenience/qeglcompositor.cpp | 3 |
4 files changed, 15 insertions, 20 deletions
diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp index 1fbdd20207..8085089bce 100644 --- a/src/gui/opengl/qopengltextureblitter.cpp +++ b/src/gui/opengl/qopengltextureblitter.cpp @@ -344,25 +344,23 @@ void QOpenGLTextureBlitter::blit(GLuint texture, } QMatrix4x4 QOpenGLTextureBlitter::targetTransform(const QRectF &target, - const QRect &viewport, - Origin origin) + const QRect &viewport) { - qreal x_scale = target.size().width() / viewport.width(); - qreal y_scale = target.size().height() / viewport.height(); + qreal x_scale = target.width() / viewport.width(); + qreal y_scale = target.height() / viewport.height(); const QPointF relative_to_viewport = target.topLeft() - viewport.topLeft(); - qreal x_translate = ((relative_to_viewport.x() / viewport.width()) + (x_scale / 2)) * 2 - 1; - qreal y_translate = ((relative_to_viewport.y() / viewport.height()) + (y_scale / 2)) * 2 - 1; + qreal x_translate = x_scale - 1 + ((relative_to_viewport.x() / viewport.width()) * 2); + qreal y_translate = -y_scale + 1 - ((relative_to_viewport.y() / viewport.height()) * 2); - if (origin == OriginTopLeft) { - y_translate = -y_translate; - } + QMatrix4x4 matrix; + matrix(0,3) = x_translate; + matrix(1,3) = y_translate; - QMatrix4x4 vertexMatrix; + matrix(0,0) = x_scale; + matrix(1,1) = y_scale; - vertexMatrix.translate(x_translate, y_translate); - vertexMatrix.scale(x_scale, y_scale); - return vertexMatrix; + return matrix; } QMatrix3x3 QOpenGLTextureBlitter::sourceTransform(const QRectF &subTexture, diff --git a/src/gui/opengl/qopengltextureblitter_p.h b/src/gui/opengl/qopengltextureblitter_p.h index 5164d8630e..b2ccc13391 100644 --- a/src/gui/opengl/qopengltextureblitter_p.h +++ b/src/gui/opengl/qopengltextureblitter_p.h @@ -72,7 +72,7 @@ public: void blit(GLuint texture, const QMatrix4x4 &targetTransform, Origin sourceOrigin); void blit(GLuint texture, const QMatrix4x4 &targetTransform, const QMatrix3x3 &sourceTransform); - static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport, Origin origin); + static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport); static QMatrix3x3 sourceTransform(const QRectF &subTexture, const QSize &textureSize, Origin origin); private: diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 58fe28bb48..15459dd748 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -218,8 +218,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i GLuint textureId = textures->textureId(i); glBindTexture(GL_TEXTURE_2D, textureId); - QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), windowRect, - QOpenGLTextureBlitter::OriginTopLeft); + QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), windowRect); d_ptr->blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginBottomLeft); } @@ -230,8 +229,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(windowRect, windowRect, - QOpenGLTextureBlitter::OriginTopLeft); + QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(windowRect, windowRect); d_ptr->blitter->setSwizzleRB(true); d_ptr->blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft); d_ptr->blitter->setSwizzleRB(false); diff --git a/src/platformsupport/eglconvenience/qeglcompositor.cpp b/src/platformsupport/eglconvenience/qeglcompositor.cpp index aac4822f66..a38f00d4f6 100644 --- a/src/platformsupport/eglconvenience/qeglcompositor.cpp +++ b/src/platformsupport/eglconvenience/qeglcompositor.cpp @@ -118,8 +118,7 @@ void QEGLCompositor::render(QEGLPlatformWindow *window) uint textureId = textures->textureId(i); glBindTexture(GL_TEXTURE_2D, textureId); QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), - targetWindowRect, - QOpenGLTextureBlitter::OriginTopLeft); + targetWindowRect); m_blitter->setSwizzleRB(window->isRaster()); if (textures->count() > 1 && i == textures->count() - 1) { |