summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-09-21 08:06:18 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-09-21 08:06:18 (GMT)
commita4d1be727573a7a87c523a2ef28074c77d16f165 (patch)
treed4f8f218c41771ca17c7ab324390485af868fa8e /src/gui/painting
parentcd2fd21578a80bc5ac121c0419ee00b1799d0a60 (diff)
parent660ec910ef60513b511e2292255e53701dbb239b (diff)
downloadQt-a4d1be727573a7a87c523a2ef28074c77d16f165.zip
Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.gz
Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/corelib/kernel/qobject.h src/declarative/graphicsitems/qdeclarativeflickable.cpp src/declarative/graphicsitems/qdeclarativeflickable_p_p.h src/declarative/util/qdeclarativelistmodel.cpp
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbrush.cpp15
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp15
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp75
-rw-r--r--src/gui/painting/qgraphicssystem_runtime.cpp6
-rw-r--r--src/gui/painting/qgraphicssystem_runtime_p.h1
-rw-r--r--src/gui/painting/qpaintengineex.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/painting/qprintengine_win.cpp2
-rw-r--r--src/gui/painting/qregion.cpp4
-rw-r--r--src/gui/painting/qstroker.cpp2
11 files changed, 31 insertions, 95 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index d3061d8..d0788c7 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1218,17 +1218,16 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
\o QConicalGradient
\endtable
- The colors in a gradient is defined using stop points of the
- QGradientStop type, i.e. a position and a color. Use the
- setColorAt() function to define a single stop
- point. Alternatively, use the setStops() function to define
- several stop points in one go. Note that the latter function \e
- replaces the current set of stop points.
+ The colors in a gradient are defined using stop points of the
+ QGradientStop type; i.e., a position and a color. Use the setColorAt()
+ function to define a single stop point. Alternatively, use the
+ setStops() function to define several stop points in one go. Note that
+ the latter function \e replaces the current set of stop points.
It is the gradient's complete set of stop points (accessible
through the stops() function) that describes how the gradient area
- should be filled. If no stop points have been specified, a
- gradient of black at 0 to white at 1 is used.
+ should be filled. If no stop points have been specified, a gradient
+ of black at 0 to white at 1 is used.
A diagonal linear gradient from black at (100, 100) to white at
(200, 200) could be specified like this:
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index bd5b0bd..5f190ba 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -4835,7 +4835,7 @@ void QT_FASTCALL blendUntransformed_dest24(DST *dest, const SRC *src,
if (SRC::hasAlpha()) {
while (length >= 4) {
- const quint32 alpha = BYTE_MUL(uint(alpha_4(src)), uint(coverage));
+ const quint32 alpha = QT_PREPEND_NAMESPACE(BYTE_MUL)(uint(alpha_4(src)), uint(coverage));
if (alpha)
interpolate_pixel_4(dest, src, alpha);
length -= 4;
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index ba2ba32..f97d865 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -266,10 +266,10 @@ void qt_memfill32_sse2(quint32 *dest, quint32 value, int count)
int n = (count128 + 3) / 4;
switch (count128 & 0x3) {
- case 0: do { _mm_store_si128(dst128++, value128);
- case 3: _mm_store_si128(dst128++, value128);
- case 2: _mm_store_si128(dst128++, value128);
- case 1: _mm_store_si128(dst128++, value128);
+ case 0: do { _mm_stream_si128(dst128++, value128);
+ case 3: _mm_stream_si128(dst128++, value128);
+ case 2: _mm_stream_si128(dst128++, value128);
+ case 1: _mm_stream_si128(dst128++, value128);
} while (--n > 0);
}
@@ -300,11 +300,14 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u
const __m128i half = _mm_set1_epi16(0x80);
const __m128i minusAlphaOfColorVector = _mm_set1_epi16(minusAlphaOfColor);
+ ALIGNMENT_PROLOGUE_16BYTES(dst, x, length)
+ destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
+
for (; x < length-3; x += 4) {
- __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]);
+ __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);
BYTE_MUL_SSE2(dstVector, dstVector, minusAlphaOfColorVector, colorMask, half);
dstVector = _mm_add_epi8(colorVector, dstVector);
- _mm_storeu_si128((__m128i *)&dst[x], dstVector);
+ _mm_store_si128((__m128i *)&dst[x], dstVector);
}
for (;x < length; ++x)
destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index 4cb4089..fb5602e 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -79,69 +79,6 @@ inline static void blend_pixel(quint32 &dst, const quint32 src)
}
-#define BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
- int x = 0; \
-\
- /* First, get dst aligned. */ \
- const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;\
- const int prologLength = qMin(length, offsetToAlignOn16Bytes);\
-\
- for (; x < prologLength; ++x) {\
- blend_pixel(dst[x], src[x]); \
- } \
-\
- const int minusOffsetToAlignSrcOn16Bytes = (reinterpret_cast<quintptr>(&(src[x])) >> 2) & 0x3;\
-\
- if (!minusOffsetToAlignSrcOn16Bytes) {\
- /* src is aligned, usual algorithm but with aligned operations.\
- See the SSE2 version for more documentation on the algorithm itself. */\
- const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\
- for (; x < length-3; x += 4) { \
- const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \
- const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \
- if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \
- _mm_store_si128((__m128i *)&dst[x], srcVector); \
- } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \
- __m128i alphaChannel = _mm_shuffle_epi8(srcVector, alphaShuffleMask); \
- alphaChannel = _mm_sub_epi16(one, alphaChannel); \
- const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \
- __m128i destMultipliedByOneMinusAlpha; \
- BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \
- const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \
- _mm_store_si128((__m128i *)&dst[x], result); \
- } \
- } /* end for() */\
- } else if ((length - x) >= 8) {\
- /* We are at the first line, so "x - minusOffsetToAlignSrcOn16Bytes" could go before src, and\
- generate an invalid access. */\
-\
- /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\
- __m128i srcVectorPrevLoaded;\
- if (minusOffsetToAlignSrcOn16Bytes > prologLength) {\
- /* We go forward 4 pixels to avoid reading before src. */\
- for (; x < prologLength + 4; ++x)\
- blend_pixel(dst[x], src[x]); \
- }\
- srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\
- const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\
-\
- const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\
- switch (palignrOffset) {\
- case 4:\
- BLENDING_LOOP(4, length)\
- break;\
- case 8:\
- BLENDING_LOOP(8, length)\
- break;\
- case 12:\
- BLENDING_LOOP(12, length)\
- break;\
- }\
- }\
- for (; x < length; ++x) \
- blend_pixel(dst[x], src[x]); \
-}
-
// Basically blend src over dst with the const alpha defined as constAlphaVector.
// nullVector, half, one, colorMask are constant accross the whole image/texture, and should be defined as:
//const __m128i nullVector = _mm_set1_epi32(0);
@@ -153,7 +90,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src)
// The computation being done is:
// result = s + d * (1-alpha)
// with shortcuts if fully opaque or fully transparent.
-#define BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
+#define BLEND_SOURCE_OVER_ARGB32_SSSE3(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \
int x = 0; \
\
/* First, get dst aligned. */ \
@@ -218,14 +155,8 @@ void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
const __m128i one = _mm_set1_epi16(0xff);
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
- // We have to unrol the first row in order to deal with the load on unaligned data
- // prior to the src pointer.
- BLEND_SOURCE_OVER_ARGB32_FIRST_ROW_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask);
- dst = (quint32 *)(((uchar *) dst) + dbpl);
- src = (const quint32 *)(((const uchar *) src) + sbpl);
-
- for (int y = 1; y < h; ++y) {
- BLEND_SOURCE_OVER_ARGB32_MAIN_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask);
+ for (int y = 0; y < h; ++y) {
+ BLEND_SOURCE_OVER_ARGB32_SSSE3(dst, src, w, nullVector, half, one, colorMask, alphaMask);
dst = (quint32 *)(((uchar *) dst) + dbpl);
src = (const quint32 *)(((const uchar *) src) + sbpl);
}
diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp
index 2828e9d..a9fbbee 100644
--- a/src/gui/painting/qgraphicssystem_runtime.cpp
+++ b/src/gui/painting/qgraphicssystem_runtime.cpp
@@ -94,7 +94,8 @@ QRuntimePixmapData::QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelTy
QRuntimePixmapData::~QRuntimePixmapData()
{
- m_graphicsSystem->removePixmapData(this);
+ if (QApplicationPrivate::graphics_system)
+ m_graphicsSystem->removePixmapData(this);
delete m_data;
}
@@ -258,7 +259,8 @@ QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, Q
QRuntimeWindowSurface::~QRuntimeWindowSurface()
{
- m_graphicsSystem->removeWindowSurface(this);
+ if (QApplicationPrivate::graphics_system)
+ m_graphicsSystem->removeWindowSurface(this);
}
QPaintDevice *QRuntimeWindowSurface::paintDevice()
diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h
index 0232241..421fbeb 100644
--- a/src/gui/painting/qgraphicssystem_runtime_p.h
+++ b/src/gui/painting/qgraphicssystem_runtime_p.h
@@ -177,6 +177,7 @@ private:
friend class QRuntimePixmapData;
friend class QRuntimeWindowSurface;
+ friend class QMeeGoGraphicsSystem;
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 881bd6e..1e857e4 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -768,7 +768,7 @@ void QPaintEngineEx::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yR
x1, y2 - (1 - KAPPA) * yRadius,
x1, y2 - yRadius,
x1, y1 + yRadius, // LineTo
- x1, y1 + KAPPA * yRadius, // CurveTo
+ x1, y1 + (1 - KAPPA) * yRadius, // CurveTo
x1 + (1 - KAPPA) * xRadius, y1,
x1 + xRadius, y1
};
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 004d9cd..8f54a2e 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -8932,7 +8932,7 @@ QPainterPath QPaintEngineState::clipPath() const
}
/*!
- Returns wether clipping is enabled or not in the current paint
+ Returns whether clipping is enabled or not in the current paint
engine state.
This variable should only be used when the state() returns a
diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp
index dd4de99..afae0a5 100644
--- a/src/gui/painting/qprintengine_win.cpp
+++ b/src/gui/painting/qprintengine_win.cpp
@@ -851,7 +851,7 @@ void QWin32PrintEnginePrivate::strokePath_dev(const QPainterPath &path, const QC
HPEN pen = ExtCreatePen(((penWidth == 0) ? PS_COSMETIC : PS_GEOMETRIC)
| PS_SOLID | capStyle | joinStyle,
- penWidth, &brush, 0, 0);
+ (penWidth == 0) ? 1 : penWidth, &brush, 0, 0);
HGDIOBJ old_pen = SelectObject(hdc, pen);
StrokePath(hdc);
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index bfeef72..3412f9b 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -1699,8 +1699,8 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include <limits.h>
QT_END_INCLUDE_NAMESPACE
-/* 1 if two BOXs overlap.
- * 0 if two BOXs do not overlap.
+/* 1 if two BOXes overlap.
+ * 0 if two BOXes do not overlap.
* Remember, x2 and y2 are not in the region
*/
#define EXTENTCHECK(r1, r2) \
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index eabbd8a..9cff339 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -609,7 +609,7 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine
}
QLineF miterLine(QPointF(qt_fixed_to_real(focal_x),
qt_fixed_to_real(focal_y)), isect);
- if (miterLine.length() > qt_fixed_to_real(m_strokeWidth * m_miterLimit) / 2) {
+ if (type == QLineF::NoIntersection || miterLine.length() > qt_fixed_to_real(m_strokeWidth * m_miterLimit) / 2) {
emitLineTo(qt_real_to_fixed(nextLine.x1()),
qt_real_to_fixed(nextLine.y1()));
} else {