From dd481a2bb4f858178b984a38cd8c3621d46446b7 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 19 Feb 2020 16:40:31 -0600 Subject: Fix texture coords for the compressed texture atlas The texture coords should be based on the actual image size, and not on the padded size. Change-Id: I262b7ca93e26c48324ec892a988f2fc62132175e Reviewed-by: Laszlo Agocs --- .../scenegraph/compressedtexture/qsgcompressedatlastexture.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp index e981921c69..7c98e2c1e1 100644 --- a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp +++ b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp @@ -136,12 +136,12 @@ Texture::Texture(Atlas *atlas, const QRect &textureRect, const QByteArray &data, { float w = atlas->size().width(); float h = atlas->size().height(); - QRect nopad = atlasSubRect(); + const QRect &r = atlasSubRect(); // offset by half-pixel to prevent bleeding when scaling - m_texture_coords_rect = QRectF((nopad.x() + .5) / w, - (nopad.y() + .5) / h, - (nopad.width() - 1.) / w, - (nopad.height() - 1.) / h); + m_texture_coords_rect = QRectF((r.x() + .5) / w, + (r.y() + .5) / h, + (size.width() - 1.) / w, + (size.height() - 1.) / h); } Texture::~Texture() -- cgit v1.2.3