OpenCoverage

qsgpkmhandler.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7static const int headerSize = 16;-
8-
9static 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-
17bool QSGPkmHandler::canRead(const QByteArray &suffix, const QByteArray &block)-
18{-
19 (void)suffix;-
20-
21 return
executed 726 times by 34 tests: return block.startsWith("PKM ");
Executed by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • tst_qquickpointattractor
  • tst_qquickpointdirection
  • tst_qquickrectangleextruder
  • tst_qquickshadereffect
  • tst_qquickspritegoal
  • ...
block.startsWith("PKM ");
executed 726 times by 34 tests: return block.startsWith("PKM ");
Executed by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • tst_qquickpointattractor
  • tst_qquickpointdirection
  • tst_qquickrectangleextruder
  • tst_qquickshadereffect
  • tst_qquickspritegoal
  • ...
726
22}-
23-
24QQuickTextureFactory *QSGPkmHandler::read()-
25{-
26 if (!device()
!device()Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickimage
)
0-8
27 return
never executed: return nullptr;
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
texData->data....) < headerSizeDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickimage
|| !canRead(QByteArray(), texData->data)
!canRead(QByte...texData->data)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickimage
) {
0-8
33 for (bool qt_category_enabled = QSG_LOG_TEXTUREIO().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 80, __PRETTY_FUNCTION__, QSG_LOG_TEXTUREIO().categoryName()).debug("Invalid PKM file %s", logName().constData());
never executed: QMessageLogger(__FILE__, 80, __PRETTY_FUNCTION__, QSG_LOG_TEXTUREIO().categoryName()).debug("Invalid PKM file %s", logName().constData());
0
34 return
never executed: return nullptr;
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])
type > sizeof(...of(typeMap[0])Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickimage
) {
0-8
44 for (bool qt_category_enabled = QSG_LOG_TEXTUREIO().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 91, __PRETTY_FUNCTION__, QSG_LOG_TEXTUREIO().categoryName()).debug("Unknown compression format in PKM file %s", logName().constData());
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: return nullptr;
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 = (
(texData->form...GBA8_ETC2_EAC)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickimage
texData->format == QOpenGLTexture::RGBA8_ETC2_EAC)
(texData->form...GBA8_ETC2_EAC)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickimage
? 16 : 8;
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()
!texData->isValid()Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickimage
) {
0-8
60 for (bool qt_category_enabled = QSG_LOG_TEXTUREIO().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 107, __PRETTY_FUNCTION__, QSG_LOG_TEXTUREIO().categoryName()).debug("Invalid values in header of PKM file %s", logName().constData());
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: return nullptr;
nullptr;
never executed: return nullptr;
0
62 }-
63-
64 texData->logName = logName();-
65-
66-
67-
68 return
executed 8 times by 1 test: return new QSGCompressedTextureFactory(texData);
Executed by:
  • tst_qquickimage
new QSGCompressedTextureFactory(texData);
executed 8 times by 1 test: return new QSGCompressedTextureFactory(texData);
Executed by:
  • tst_qquickimage
8
69}-
70-
71-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0