summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-12-11 14:39:29 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-12-11 14:39:29 (GMT)
commit9e5c5e2c68f3aefd60571551664936465dd04913 (patch)
treeb58901160ac2adf4269a1c2ee719d626e112f582
parent0fecf4184e888b202766210b235fde09a81c5257 (diff)
parentd8b7b7278987462791488f756edd26842d059074 (diff)
downloadQt-9e5c5e2c68f3aefd60571551664936465dd04913.zip
Qt-9e5c5e2c68f3aefd60571551664936465dd04913.tar.gz
Qt-9e5c5e2c68f3aefd60571551664936465dd04913.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6
-rw-r--r--src/corelib/tools/qcache.h3
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp11
-rw-r--r--src/gui/painting/qpainter.cpp78
-rw-r--r--tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp2
4 files changed, 89 insertions, 5 deletions
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index ee9523f..086a52f 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -70,8 +70,9 @@ class QCache
if (l == &n) l = n.p;
if (f == &n) f = n.n;
total -= n.c;
+ T *object = n.t;
hash.remove(*n.keyPtr);
- delete n.t;
+ delete object;
}
inline T *relink(const Key &key) {
typename QHash<Key, Node>::iterator i = hash.find(key);
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 8bbe929..c879c5c 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -10684,9 +10684,14 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
QRectF effectRectF;
if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) {
- effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
- if (system == Qt::LogicalCoordinates)
- effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
+ if (info) {
+ effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
+ if (info && system == Qt::LogicalCoordinates)
+ effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
+ } else {
+ // no choice but to send a logical coordinate bounding rect to boundingRectFor
+ effectRectF = item->graphicsEffect()->boundingRectFor(sourceRect);
+ }
} else if (mode == QGraphicsEffect::PadToTransparentBorder) {
// adjust by 1.5 to account for cosmetic pens
effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 66bf4f7..13d9a04 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1317,6 +1317,84 @@ void QPainterPrivate::updateState(QPainterState *newState)
Another workaround is to convert the paths to polygons first and then draw the
polygons instead.
+ \section1 Performance
+
+ QPainter is a rich framework that allows developers to do a great
+ variety of graphical operations, such as gradients, composition
+ modes and vector graphcis. And QPainter can do this across a
+ variety of different hardware and software stack. Naturally the
+ underlying combination of hardware and software has some
+ implications for performance, and ensuring that every single
+ operation is fast in combination with all the various combinations
+ of composition modes, brushes, clipping, transformation, etc, is
+ close to an impossible task because of the number of
+ permutations. As a compromise we have selected a subset of the
+ QPainter API and backends, were performance is guaranteed to be as
+ good as we can sensibly get it for the given combination of
+ hardware and software.
+
+ The backends we focus on as high-performance engines are:
+
+ \list
+
+ \o Raster - This backend implements all rendering in pure software
+ and is always used to render into QImages. For optimal performance
+ only use the format types QImage::Format_ARGB32_Premultiplied,
+ QImage::Format_RGB32 or QImage::Format_RGB16. Any other format,
+ including QImage::Format_ARGB32, has significantly worse
+ performance. This engine is also used by default on Windows and on
+ QWS. It can be used as default graphics system on any
+ OS/hardware/software combination by passing \c {-graphcissystem
+ raster} on the command line
+
+ \o OpenGL 2.0 (ES) - This backend is the primary backend for
+ hardware accellerated graphics. It can be run on desktop machines
+ and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0
+ spesification. This includes most graphics chips produced in the
+ last couple of years. The engine can be enabled by using QPainter
+ onto a QGLWidget or by passing \c {-graphicssystem opengl} on the
+ command line when the underlying system supports it.
+
+ \endlist
+
+ These operations are:
+
+ \list
+
+ \o Simple transformations, meaning translation and scaling, pluss
+ 0, 90, 180, 270 degree rotations.
+
+ \o \c drawPixmap() in combination with simple transformations and
+ opacity with non-smooth transformation mode
+ (\c QPainter::SmoothPixmapTransform not enabled as a render hint);
+
+ \o Text drawing with regular font sizes with simple
+ transformations with solid colors using no or 8-bit antialiasing.
+
+ \o Rectangle fills with solid color, two-color linear gradients
+ and simple transforms.
+
+ \o Rectangular clipping with simple transformations and intersect
+ clip.
+
+ \o Composition Modes \c QPainter::CompositionMode_Source and
+ QPainter::CompositionMode_SourceOver
+
+ \o Rounded rectangle filling using solid color and two-color
+ linear gradients fills.
+
+ \o 3x3 patched pixmaps, via qDrawBorderPixmap.
+
+ \endlist
+
+ This list gives an indication of which features to safely use in
+ an application where performance is critical. For certain setups,
+ other operations may be fast too, but before making extensive use
+ of them, it is recommended to benchmark and verify them on the
+ system where the software will run in the end. There are also
+ cases where expensive operations are ok to use, for instance when
+ the result is cached in a QPixmap.
+
\sa QPaintDevice, QPaintEngine, {QtSvg Module}, {Basic Drawing Example},
{Drawing Utility Functions}
*/
diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index 9991ab4..7a0d40a 100644
--- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -352,7 +352,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data()
QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates)
<< int(QGraphicsEffect::PadToEffectiveBoundingRect)
- << QSize(30, 30) << QPoint(-10, -10)
+ << QSize(20, 20) << QPoint(-5, -5)
<< 0x00000000u;
QTest::newRow("dev,nopad") << int(Qt::DeviceCoordinates)