From a782eb71f659a8f6fdd825cc69482ce4cd7612f3 Mon Sep 17 00:00:00 2001 From: Jaehak Lee Date: Tue, 25 Apr 2023 18:17:58 +0900 Subject: NinePatchImage: support the compressed texture image The compressed texture image is supported by qquickimage and the qquickninepatchimage is inherited by qquickimage. But the compressed texture is not shown when the source of qquickninepatchimage is set as compressed texture because the updatePaintNode of qquickninepatchimage only consider non-compressed texture. This patch is not intended to use the HW compressed image as an actual 9-patch image, but to display them using the super class qquickimage in the case of an HW compressed image other than a normal pixmap image. If the source is HW compressed textures such as ASTC, KTX, and PKM, we have to call updatePaintNode of QQuickImage before checking the validity of the pixmap image. (because nullptr is returned if pixmap image is not valid) The containers themselves (pkm, ktx) are universally supported but the compressed texture formats is up to the underlying 3D API implementation and may vary. So, if the format is not supported by RHI, we skip the test. Refer to QTBUG-113565 for a detailed discussion on texture formats. And when using the software backend, we also skip test cases. Fixes: QTBUG-113446 Change-Id: I2704f86e94b50b3c187eca359fdc1a69eb217811 Reviewed-by: Shawn Rutledge (cherry picked from commit ed69a9d4f3e889b05548e7cebe957afc3a3e577f) --- src/quickcontrols2impl/qquickninepatchimage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/quickcontrols2impl/qquickninepatchimage.cpp b/src/quickcontrols2impl/qquickninepatchimage.cpp index 3f8a9e03e9..cc3869ded9 100644 --- a/src/quickcontrols2impl/qquickninepatchimage.cpp +++ b/src/quickcontrols2impl/qquickninepatchimage.cpp @@ -443,6 +443,9 @@ QSGNode *QQuickNinePatchImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNode d->resetNode = false; } + if (d->ninePatch.isNull()) + return QQuickImage::updatePaintNode(oldNode, data); + QSizeF sz = size(); QImage image = d->pix.image(); if (!sz.isValid() || image.isNull()) { @@ -452,9 +455,6 @@ QSGNode *QQuickNinePatchImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNode return nullptr; } - if (d->ninePatch.isNull()) - return QQuickImage::updatePaintNode(oldNode, data); - QQuickNinePatchNode *patchNode = static_cast(oldNode); if (!patchNode) patchNode = new QQuickNinePatchNode; -- cgit v1.2.1