summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJere Tuliniemi <jere.tuliniemi@qt.io>2019-12-05 11:39:38 +0200
committerJere Tuliniemi <jere.tuliniemi@qt.io>2019-12-05 13:16:12 +0200
commit9b684e9b943c089638451035691e08c53539c682 (patch)
tree77fd82743a6f8d7d455eb0ff1cc4007afce2f5b5
parent24b10f52ca19366a9ebd75870d5a02f384253fd9 (diff)
Fix opaque pixel detectionHEADmaster
The scan would stop upon first transparent pixel, so subsequent opaque pixels wouldn't be detected. Task-number: QT3DS-4012 Change-Id: I2b12104393433ef142812234fec5ee5ca6732691 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/runtimerender/resourcemanager/Qt3DSRenderLoadedTexture.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/runtimerender/resourcemanager/Qt3DSRenderLoadedTexture.cpp b/src/runtimerender/resourcemanager/Qt3DSRenderLoadedTexture.cpp
index 577bd55..e88931a 100644
--- a/src/runtimerender/resourcemanager/Qt3DSRenderLoadedTexture.cpp
+++ b/src/runtimerender/resourcemanager/Qt3DSRenderLoadedTexture.cpp
@@ -680,8 +680,9 @@ bool ScanImageForAlpha(const void *inData, QT3DSU32 inWidth, QT3DSU32 inHeight,
QT3DSU32 alphaRightShift = inPixelSizeInBytes * 8 - inAlphaSizeInBits;
QT3DSU32 maxAlphaValue = (1 << inAlphaSizeInBits) - 1;
- for (QT3DSU32 rowIdx = 0; rowIdx < inHeight && hasAlpha == false; ++rowIdx) {
- for (QT3DSU32 idx = 0; idx < inWidth && hasAlpha == false;
+ for (QT3DSU32 rowIdx = 0; rowIdx < inHeight && (hasAlpha == false || hasOpaque == false);
+ ++rowIdx) {
+ for (QT3DSU32 idx = 0; idx < inWidth && (hasAlpha == false || hasOpaque == false);
++idx, rowPtr += inPixelSizeInBytes) {
QT3DSU32 pixelValue = 0;
if (inPixelSizeInBytes == 2)