summaryrefslogtreecommitdiffstats
path: root/examples/corelib/threads/mandelbrot/renderthread.cpp
diff options
context:
space:
mode:
authorRym Bouabid <rym.bouabid@qt.io>2023-09-08 15:55:27 +0200
committerRym Bouabid <rym.bouabid@qt.io>2023-09-13 20:45:16 +0200
commit7903a52d46401e224f1d85067d51bf443066cbec (patch)
tree65cde3e44ba8a62b41608860d8f9205234b3fa51 /examples/corelib/threads/mandelbrot/renderthread.cpp
parent32e2a910f162cab4f5ace057ba435e4d61c6d95d (diff)
Revamp Mandelbrot example: Add const/constexpr when applicable
Add const in front of local variables when applicable. Replace const by constexpr when the value of the variable can be calculated at compile-time. Task-number: QTBUG-108861 Pick-to: 6.6 6.5 6.6.0 Change-Id: I2cd1bc97aaa07d6d564731d9ccddba9a74e96fef Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'examples/corelib/threads/mandelbrot/renderthread.cpp')
-rw-r--r--examples/corelib/threads/mandelbrot/renderthread.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/corelib/threads/mandelbrot/renderthread.cpp b/examples/corelib/threads/mandelbrot/renderthread.cpp
index 7e4ff5ba8e..77a14a6ac1 100644
--- a/examples/corelib/threads/mandelbrot/renderthread.cpp
+++ b/examples/corelib/threads/mandelbrot/renderthread.cpp
@@ -69,16 +69,16 @@ void RenderThread::run()
//! [3]
//! [4]
- int halfWidth = resultSize.width() / 2;
+ const int halfWidth = resultSize.width() / 2;
//! [4] //! [5]
- int halfHeight = resultSize.height() / 2;
+ const int halfHeight = resultSize.height() / 2;
QImage image(resultSize, QImage::Format_RGB32);
image.setDevicePixelRatio(devicePixelRatio);
int pass = 0;
while (pass < numPasses) {
const int MaxIterations = (1 << (2 * pass + 6)) + 32;
- const int Limit = 4;
+ constexpr int Limit = 4;
bool allBlack = true;
timer.restart();