diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2018-02-26 15:31:58 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2018-02-28 11:51:01 +0000 |
commit | ba6b7fffbec4f18fffd6a78aa4cb86006e4a3c4b (patch) | |
tree | 172089a22a81aaaf549e10c87c46d0c2a8d37c80 /src/quick/scenegraph | |
parent | c8bac27a97c64f09a2c5c59de676804a25fa06aa (diff) |
Fix: do data size check of pkm format compressed texture files
Reintroduce reading - and sanity checking - the data size from the
file header of pkm files. This was commented out during the
refactoring, since it lacked the fix for ETC2_EAC format (ref. 16cd1f8
on 5.10 branch). This commit also includes that fix.
Change-Id: Id85547fb6bee254d58e49ddff4593704f7ab83ed
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp b/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp index daec23d478..618c0db045 100644 --- a/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp +++ b/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp @@ -95,10 +95,9 @@ QQuickTextureFactory *QSGPkmHandler::read() texData->hasAlpha = !QSGCompressedTexture::formatIsOpaque(texData->format); // texture size - /* Actual data length depends on format; for now just use 0, i.e. rest-of-file + const int bpb = (texData->format == QOpenGLTexture::RGBA8_ETC2_EAC) ? 16 : 8; QSize paddedSize(qFromBigEndian<quint16>(rawData + 8), qFromBigEndian<quint16>(rawData + 10)); - texData->dataLength = (paddedSize.width() / 4) * (paddedSize.height() / 4) * 8; - */ + texData->dataLength = (paddedSize.width() / 4) * (paddedSize.height() / 4) * bpb; QSize texSize(qFromBigEndian<quint16>(rawData + 12), qFromBigEndian<quint16>(rawData + 14)); texData->size = texSize; |