aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@live.com>2020-02-19 16:40:31 -0600
committerMichael Brasser <michael.brasser@live.com>2020-02-21 07:22:46 -0600
commitdd481a2bb4f858178b984a38cd8c3621d46446b7 (patch)
tree8729304eee1c448297c672603d75480490224b0d
parent9e5376327fb258e1c0207c2d6b6a2f9254f5b3ee (diff)
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 <laszlo.agocs@qt.io>
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp10
1 files changed, 5 insertions, 5 deletions
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()