diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2010-09-17 19:53:43 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-04-13 08:17:05 (GMT) |
commit | 26bd3dccdee8c6a8f1cf9d254a2a6be7d403aa8d (patch) | |
tree | 4ce9f5239cfe62c3052acbe8a82a692843d719c4 /src/gui/painting/qdrawhelper_p.h | |
parent | 44dd7ef86a3970694a4f8fd9516575c0533a336e (diff) | |
download | Qt-26bd3dccdee8c6a8f1cf9d254a2a6be7d403aa8d.zip Qt-26bd3dccdee8c6a8f1cf9d254a2a6be7d403aa8d.tar.gz Qt-26bd3dccdee8c6a8f1cf9d254a2a6be7d403aa8d.tar.bz2 |
Optimized radial gradient fetch using SSE 2.
On an i7 this improves performance by 22 % in parcycle, 107 % in default
svgviewer example, and 283 % in a synthetic radial gradient benchmark.
Reviewed-by: Andreas Kling
Diffstat (limited to 'src/gui/painting/qdrawhelper_p.h')
-rw-r--r-- | src/gui/painting/qdrawhelper_p.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 6377fe1..db5ec70 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -268,8 +268,10 @@ struct QGradientData #ifdef Q_WS_QWS #define GRADIENT_STOPTABLE_SIZE 256 +#define GRADIENT_STOPTABLE_SIZE_SHIFT 8 #else #define GRADIENT_STOPTABLE_SIZE 1024 +#define GRADIENT_STOPTABLE_SIZE_SHIFT 10 #endif uint* colorTable; //[GRADIENT_STOPTABLE_SIZE]; @@ -389,6 +391,13 @@ template <class RadialFetchFunc> const uint * QT_FASTCALL qt_fetch_radial_gradient_template(uint *buffer, const Operator *op, const QSpanData *data, int y, int x, int length) { + // avoid division by zero + if (qFuzzyIsNull(op->radial.a)) { + extern void (*qt_memfill32)(quint32 *dest, quint32 value, int count); + qt_memfill32(buffer, data->gradient.colorTable[0], length); + return buffer; + } + const uint *b = buffer; qreal rx = data->m21 * (y + qreal(0.5)) + data->dx + data->m11 * (x + qreal(0.5)); |