summaryrefslogtreecommitdiffstats
path: root/examples/corelib/threads/doc/src/mandelbrot.qdoc
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-14 13:36:39 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-03-12 08:24:09 +0100
commita719c630f14e175902f6f82b753c3d5030724cc6 (patch)
tree2d75408f01bdf0c77cf7963c73acaf58df1431bf /examples/corelib/threads/doc/src/mandelbrot.qdoc
parent2c390e85cffbfa1eaeabaadfa823abcb61c1156a (diff)
Mandelbrot Example: Use High DPI scaling
Create the pixmap with a device pixel ratio set. Change-Id: I7f7e90aec4d117304852f050be70e14a0c6bf69d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'examples/corelib/threads/doc/src/mandelbrot.qdoc')
-rw-r--r--examples/corelib/threads/doc/src/mandelbrot.qdoc25
1 files changed, 19 insertions, 6 deletions
diff --git a/examples/corelib/threads/doc/src/mandelbrot.qdoc b/examples/corelib/threads/doc/src/mandelbrot.qdoc
index b32fa097b3..2b12743538 100644
--- a/examples/corelib/threads/doc/src/mandelbrot.qdoc
+++ b/examples/corelib/threads/doc/src/mandelbrot.qdoc
@@ -187,6 +187,10 @@
generate more and more precise (and computationally expensive)
approximations of the fractal.
+ We create a high resolution pixmap by applying the device
+ pixel ratio to the target size (see
+ \l{Drawing High Resolution Versions of Pixmaps and Images}).
+
If we discover inside the loop that \c restart has been set to \c
true (by \c render()), we break out of the loop immediately, so
that the control quickly returns to the very top of the outer
@@ -273,12 +277,21 @@
\snippet threads/mandelbrot/mandelbrotwidget.cpp 8
If the pixmap has the right scale factor, we draw the pixmap directly onto
- the widget. Otherwise, we scale and translate the \l{Coordinate
- System}{coordinate system} before we draw the pixmap. By reverse mapping
- the widget's rectangle using the scaled painter matrix, we also make sure
- that only the exposed areas of the pixmap are drawn. The calls to
- QPainter::save() and QPainter::restore() make sure that any painting
- performed afterwards uses the standard coordinate system.
+ the widget.
+
+ Otherwise, we create a preview pixmap to be shown until the calculation
+ finishes and translate the \l{Coordinate System}{coordinate system}
+ accordingly.
+
+ Since we are going to use transformations on the painter
+ and use an overload of QPainter::drawPixmap() that does not support
+ high resolution pixmaps in that case, we create a pixmap with device pixel
+ ratio 1.
+
+ By reverse mapping the widget's rectangle using the scaled painter matrix,
+ we also make sure that only the exposed areas of the pixmap are drawn.
+ The calls to QPainter::save() and QPainter::restore() make sure that any
+ painting performed afterwards uses the standard coordinate system.
\snippet threads/mandelbrot/mandelbrotwidget.cpp 9