summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-08-04 18:25:59 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-08-04 18:25:59 (GMT)
commit70137e5049b14d3b5c7c018b2f2111704878dfee (patch)
tree89e4bd50f197bb526233332dc4772e62a5446186
parent215e5b51392f3b0129ad62c4f5efdfc3a0ba6ed6 (diff)
parent08d09a78d3faf8b211e78cb63285c35c5544b5fc (diff)
downloadQt-70137e5049b14d3b5c7c018b2f2111704878dfee.zip
Qt-70137e5049b14d3b5c7c018b2f2111704878dfee.tar.gz
Qt-70137e5049b14d3b5c7c018b2f2111704878dfee.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixed crash in concentric circles example QDeclarativeDebug: use QueuedConnection in the packet protocol Implement comp_Source with SSE2 when there is a const alpha
-rw-r--r--src/declarative/debugger/qpacketprotocol.cpp2
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp33
-rw-r--r--src/gui/painting/qpaintengineex.cpp2
-rw-r--r--tests/benchmarks/gui/image/blendbench/main.cpp32
5 files changed, 69 insertions, 2 deletions
diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp
index 878f42f..c2f7709 100644
--- a/src/declarative/debugger/qpacketprotocol.cpp
+++ b/src/declarative/debugger/qpacketprotocol.cpp
@@ -125,7 +125,7 @@ public:
QObject::connect(this, SIGNAL(invalidPacket()),
parent, SIGNAL(invalidPacket()));
QObject::connect(dev, SIGNAL(readyRead()),
- this, SLOT(readyToRead()));
+ this, SLOT(readyToRead()), Qt::QueuedConnection);
QObject::connect(dev, SIGNAL(aboutToClose()),
this, SLOT(aboutToClose()));
QObject::connect(dev, SIGNAL(bytesWritten(qint64)),
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 4ce2bee..1ff3d7b 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -7820,8 +7820,10 @@ void qInitDrawhelperAsm()
uint const_alpha);
extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
extern void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha);
+ extern void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha);
functionForModeAsm[0] = comp_func_SourceOver_sse2;
+ functionForModeAsm[QPainter::CompositionMode_Source] = comp_func_Source_sse2;
functionForModeAsm[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2;
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index e090ae5..7ab9eda 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -229,6 +229,39 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin
}
}
+void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha)
+{
+ if (const_alpha == 255) {
+ ::memcpy(dst, src, length * sizeof(uint));
+ } else {
+ const int ialpha = 255 - const_alpha;
+
+ int x = 0;
+
+ // 1) prologue, align on 16 bytes
+ const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
+ const int prologLength = qMin(length, offsetToAlignOn16Bytes);
+ for (; x < prologLength; ++x)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
+
+ // 2) interpolate pixels with SSE2
+ const __m128i half = _mm_set1_epi16(0x80);
+ const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
+ const __m128i constAlphaVector = _mm_set1_epi16(const_alpha);
+ const __m128i oneMinusConstAlpha = _mm_set1_epi16(ialpha);
+ for (; x < length - 3; x += 4) {
+ const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]);
+ __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
+ INTERPOLATE_PIXEL_255_SSE2(dstVector, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half)
+ _mm_store_si128((__m128i *)&dst[x], dstVector);
+ }
+
+ // 3) Epilogue
+ for (; x < length; ++x)
+ dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
+ }
+}
+
void qt_memfill32_sse2(quint32 *dest, quint32 value, int count)
{
if (count < 7) {
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index e0746fb..881bd6e 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -831,7 +831,7 @@ void QPaintEngineEx::drawEllipse(const QRectF &r)
int point_count = 0;
x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count);
- QVectorPath vp((qreal *) pts, 13, qpaintengineex_ellipse_types, QVectorPath::EllipseHint);
+ QVectorPath vp((qreal *) pts, point_count, qpaintengineex_ellipse_types, QVectorPath::EllipseHint);
draw(vp);
}
diff --git a/tests/benchmarks/gui/image/blendbench/main.cpp b/tests/benchmarks/gui/image/blendbench/main.cpp
index 92d1633..f53654b 100644
--- a/tests/benchmarks/gui/image/blendbench/main.cpp
+++ b/tests/benchmarks/gui/image/blendbench/main.cpp
@@ -103,6 +103,9 @@ class BlendBench : public QObject
private slots:
void blendBench_data();
void blendBench();
+
+ void blendBenchAlpha_data();
+ void blendBenchAlpha();
};
void BlendBench::blendBench_data()
@@ -147,6 +150,35 @@ void BlendBench::blendBench()
}
}
+void BlendBench::blendBenchAlpha_data()
+{
+ blendBench_data();
+}
+
+void BlendBench::blendBenchAlpha()
+{
+ QFETCH(int, brushType);
+ QFETCH(int, compositionMode);
+
+ QImage img(512, 512, QImage::Format_ARGB32_Premultiplied);
+ QImage src(512, 512, QImage::Format_ARGB32_Premultiplied);
+ paint(&src);
+ QPainter p(&img);
+ p.setPen(Qt::NoPen);
+
+ p.setCompositionMode(QPainter::CompositionMode(compositionMode));
+ if (brushType == ImageBrush) {
+ p.setBrush(QBrush(src));
+ } else if (brushType == SolidBrush) {
+ p.setBrush(QColor(127, 127, 127, 127));
+ }
+ p.setOpacity(0.7f);
+
+ QBENCHMARK {
+ p.drawRect(0, 0, 512, 512);
+ }
+}
+
QTEST_MAIN(BlendBench)
#include "main.moc"