| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | static const int headerSize = 16; | - | ||||||||||||
| 8 | - | |||||||||||||
| 9 | static unsigned int typeMap[5] = { | - | ||||||||||||
| 10 | QOpenGLTexture::RGB8_ETC1, | - | ||||||||||||
| 11 | QOpenGLTexture::RGB8_ETC2, | - | ||||||||||||
| 12 | 0, | - | ||||||||||||
| 13 | QOpenGLTexture::RGBA8_ETC2_EAC, | - | ||||||||||||
| 14 | QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2 | - | ||||||||||||
| 15 | }; | - | ||||||||||||
| 16 | - | |||||||||||||
| 17 | bool QSGPkmHandler::canRead(const QByteArray &suffix, const QByteArray &block) | - | ||||||||||||
| 18 | { | - | ||||||||||||
| 19 | (void)suffix; | - | ||||||||||||
| 20 | - | |||||||||||||
| 21 | return executed 726 times by 34 tests: block.startsWith("PKM ");return block.startsWith("PKM ");Executed by:
executed 726 times by 34 tests: return block.startsWith("PKM ");Executed by:
| 726 | ||||||||||||
| 22 | } | - | ||||||||||||
| 23 | - | |||||||||||||
| 24 | QQuickTextureFactory *QSGPkmHandler::read() | - | ||||||||||||
| 25 | { | - | ||||||||||||
| 26 | if (!device()
| 0-8 | ||||||||||||
| 27 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 28 | - | |||||||||||||
| 29 | QSGCompressedTexture::DataPtr texData(QSGCompressedTexture::DataPtr::create()); | - | ||||||||||||
| 30 | - | |||||||||||||
| 31 | texData->data = device()->readAll(); | - | ||||||||||||
| 32 | if (texData->data.size() < headerSize
| 0-8 | ||||||||||||
| 33 | for (bool qt_category_enabled = QSG_LOG_TEXTUREIO().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 80, __PRETTY_FUNCTION__, QSG_LOG_TEXTUREIO().categoryName()).debug("Invalid PKM file %s", logName().constData()); | 0 | ||||||||||||
| 34 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 35 | } | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 | const char *rawData = texData->data.constData(); | - | ||||||||||||
| 38 | - | |||||||||||||
| 39 | - | |||||||||||||
| 40 | - | |||||||||||||
| 41 | - | |||||||||||||
| 42 | quint16 type = qFromBigEndian<quint16>(rawData + 6); | - | ||||||||||||
| 43 | if (type > sizeof(typeMap)/sizeof(typeMap[0])
| 0-8 | ||||||||||||
| 44 | for (bool qt_category_enabled = QSG_LOG_TEXTUREIO().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 91, __PRETTY_FUNCTION__, QSG_LOG_TEXTUREIO().categoryName()).debug("Unknown compression format in PKM file %s", logName().constData()); | 0 | ||||||||||||
| 45 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 46 | } | - | ||||||||||||
| 47 | texData->format = typeMap[type]; | - | ||||||||||||
| 48 | texData->hasAlpha = !QSGCompressedTexture::formatIsOpaque(texData->format); | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | - | |||||||||||||
| 51 | const int bpb = (
| 0-8 | ||||||||||||
| 52 | QSize paddedSize(qFromBigEndian<quint16>(rawData + 8), qFromBigEndian<quint16>(rawData + 10)); | - | ||||||||||||
| 53 | texData->dataLength = (paddedSize.width() / 4) * (paddedSize.height() / 4) * bpb; | - | ||||||||||||
| 54 | QSize texSize(qFromBigEndian<quint16>(rawData + 12), qFromBigEndian<quint16>(rawData + 14)); | - | ||||||||||||
| 55 | texData->size = texSize; | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | texData->dataOffset = headerSize; | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | if (!texData->isValid()
| 0-8 | ||||||||||||
| 60 | for (bool qt_category_enabled = QSG_LOG_TEXTUREIO().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 107, __PRETTY_FUNCTION__, QSG_LOG_TEXTUREIO().categoryName()).debug("Invalid values in header of PKM file %s", logName().constData()); | 0 | ||||||||||||
| 61 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 62 | } | - | ||||||||||||
| 63 | - | |||||||||||||
| 64 | texData->logName = logName(); | - | ||||||||||||
| 65 | - | |||||||||||||
| 66 | - | |||||||||||||
| 67 | - | |||||||||||||
| 68 | return executed 8 times by 1 test: new QSGCompressedTextureFactory(texData);return new QSGCompressedTextureFactory(texData);Executed by:
executed 8 times by 1 test: return new QSGCompressedTextureFactory(texData);Executed by:
| 8 | ||||||||||||
| 69 | } | - | ||||||||||||
| 70 | - | |||||||||||||
| 71 | - | |||||||||||||
| Switch to Source code | Preprocessed file |