diff options
author | Jonas Karlsson <[email protected]> | 2025-06-02 12:10:29 +0200 |
---|---|---|
committer | Jonas Karlsson <[email protected]> | 2025-06-02 14:46:23 +0200 |
commit | 3778a608665218c264a0bb5438f3fbb7fea45d80 (patch) | |
tree | 258bc98b8917c3bfb8295b2494d90fcc844f6ffc | |
parent | 9cda9ae1ee5fa02a4626cf28b9a12b5116a09901 (diff) |
Fixes these two valid warnings:
expression is redundant
in file:src/runtimerender/rendererimpl/qssglightmapper.cpp line:59 col:27
if (value == PIXEL_VOID || value != PIXEL_UNSET)
result of integer division used in a floating point context; possible loss of precision
in file:src/runtimerender/rendererimpl/qssglightmapper.cpp line:1300 col:19
double mean = kernelSize / 2;
Amends: 202b89413a3f7a1caedeae9262c03c7c5e03f6e8
Pick-to: 6.10
Change-Id: I2300696dba5e29acc3d5cc9d274fb2af756ff2f6
Reviewed-by: Christian Strømme <[email protected]>
Reviewed-by: Edward Welbourne <[email protected]>
-rw-r--r-- | src/runtimerender/rendererimpl/qssglightmapper.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/runtimerender/rendererimpl/qssglightmapper.cpp b/src/runtimerender/rendererimpl/qssglightmapper.cpp index 6b2da57a..50d3713a 100644 --- a/src/runtimerender/rendererimpl/qssglightmapper.cpp +++ b/src/runtimerender/rendererimpl/qssglightmapper.cpp @@ -38,8 +38,8 @@ QT_BEGIN_NAMESPACE #ifdef QT_QUICK3D_HAS_LIGHTMAPPER static constexpr int DIRECT_MAP_UPSCALE_FACTOR = 3; -static constexpr quint32 PIXEL_VOID = 0; -static constexpr quint32 PIXEL_UNSET = -1; +static constexpr quint32 PIXEL_VOID = 0; // Pixel not part of any mask +static constexpr quint32 PIXEL_UNSET = -1; // Pixel part of mask, but not yet set static void floodFill(quint32 *maskUintPtr, const int rows, const int cols) { @@ -56,7 +56,7 @@ static void floodFill(quint32 *maskUintPtr, const int rows, const int cols) const quint32 value = maskUintPtr[idx]; // If the target color is already the same as the replacement color, no need to proceed - if (value == PIXEL_VOID || value != PIXEL_UNSET) + if (value != PIXEL_UNSET) continue; // Fill the current cell with the replacement color @@ -1304,7 +1304,7 @@ QList<QVector3D> applyGaussianBlur(const QList<QVector3D>& image, const QList<qu double sum = 0.0; double kernel[kernelSize][kernelSize]; - double mean = kernelSize / 2; + double mean = kernelSize * 0.5; for (int y = 0; y < kernelSize; ++y) { for (int x = 0; x < kernelSize; ++x) { kernel[y][x] = exp(-0.5 * (pow((x - mean) / sigma, 2.0) + pow((y - mean) / sigma, 2.0))) / (2 * M_PI * sigma * sigma); @@ -2011,9 +2011,6 @@ void QSSGLightmapperPrivate::computeIndirectLight(const StageProgressReporter &r bool QSSGLightmapperPrivate::postProcess(const StageProgressReporter &reporter) { - constexpr quint32 PIXEL_VOID = 0; - constexpr quint32 PIXEL_UNSET = -1; - QSSGRhiContextPrivate *rhiCtxD = QSSGRhiContextPrivate::get(rhiCtx); QRhi *rhi = rhiCtx->rhi(); QRhiCommandBuffer *cb = rhiCtx->commandBuffer(); |