diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2010-06-30 08:32:01 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2010-07-01 08:37:02 (GMT) |
commit | e302b2b1e65c616d7ed6adfcf4b252a6741f3053 (patch) | |
tree | 3941f4c4dd453723d0ac49f96609afb252894e06 /src/gui/painting/qpaintengine_raster.cpp | |
parent | 91678119c0d5df8064cd27dd9e0f0119942bcbd5 (diff) | |
download | Qt-e302b2b1e65c616d7ed6adfcf4b252a6741f3053.zip Qt-e302b2b1e65c616d7ed6adfcf4b252a6741f3053.tar.gz Qt-e302b2b1e65c616d7ed6adfcf4b252a6741f3053.tar.bz2 |
Improved performance of 16 bit memrotates using NEON instructions.
Make the memrotate functions a function pointer table so that we can
replace it with optimized versions, and implement an optimized NEON
version for the 90 and 270 rotations.
Measured performance improvement for a 400x400 16-bit pixmap was
17 % for 270 degree rotation and 11 % for 90 degree rotation.
Reviewed-by: Trond
Diffstat (limited to 'src/gui/painting/qpaintengine_raster.cpp')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 84b36c7..09a87aa 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2553,23 +2553,6 @@ namespace { return NoRotation; } - template <typename T> void memRotate(RotationType type, const T *srcBase, int w, int h, int sbpl, T *dstBase, int dbpl) - { - switch (type) { - case Rotation90: - qt_memrotate90(srcBase, w, h, sbpl, dstBase, dbpl); - break; - case Rotation180: - qt_memrotate180(srcBase, w, h, sbpl, dstBase, dbpl); - break; - case Rotation270: - qt_memrotate270(srcBase, w, h, sbpl, dstBase, dbpl); - break; - case NoRotation: - break; - } - } - inline bool isPixelAligned(const QRectF &rect) { return QRectF(rect.toRect()) == rect; } @@ -2650,7 +2633,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe { RotationType rotationType = qRotationType(s->matrix); - if (rotationType != NoRotation && img.rect().contains(sr.toAlignedRect())) { + if (rotationType != NoRotation && qMemRotateFunctions[d->rasterBuffer->format][rotationType] && img.rect().contains(sr.toAlignedRect())) { QRectF transformedTargetRect = s->matrix.mapRect(r); if ((!(s->renderHints & QPainter::SmoothPixmapTransform) && !(s->renderHints & QPainter::Antialiasing)) @@ -2678,10 +2661,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe uint cw = clippedSourceRect.width(); uint ch = clippedSourceRect.height(); - if (d->rasterBuffer->format == QImage::Format_RGB16) - memRotate(rotationType, (quint16 *)srcBase, cw, ch, sbpl, (quint16 *)dstBase, dbpl); - else - memRotate(rotationType, (quint32 *)srcBase, cw, ch, sbpl, (quint32 *)dstBase, dbpl); + qMemRotateFunctions[d->rasterBuffer->format][rotationType](srcBase, cw, ch, sbpl, dstBase, dbpl); return; } |