summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qdrawhelper.cpp')
-rw-r--r--src/gui/painting/qdrawhelper.cpp281
1 files changed, 263 insertions, 18 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index b8babd7..36e4300 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -38,15 +38,18 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include <private/qdrawhelper_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qpainter_p.h>
#include <private/qdrawhelper_x86_p.h>
+#include <private/qdrawhelper_armv6_p.h>
#include <private/qmath_p.h>
#include <qmath.h>
QT_BEGIN_NAMESPACE
+
#define MASK(src, a) src = BYTE_MUL(src, a)
#if defined(Q_OS_IRIX) && defined(Q_CC_GNU) && __GNUC__ == 3 && __GNUC__ < 4 && QT_POINTER_SIZE == 8
@@ -1497,12 +1500,34 @@ static const uint * QT_FASTCALL fetchConicalGradient(uint *buffer, const Operato
return b;
}
-
-
#if defined(Q_CC_RVCT)
-// Force ARM code generation for blend methods
+// Force ARM code generation for comp_func_* -methods
# pragma push
# pragma arm
+# if defined(QT_HAVE_ARMV6)
+static __forceinline void preload(const uint *start)
+{
+ asm( "pld [start]" );
+}
+static const uint L2CacheLineLength = 32;
+static const uint L2CacheLineLengthInInts = L2CacheLineLength/sizeof(uint);
+# define PRELOAD_INIT(x) preload(x);
+# define PRELOAD_INIT2(x,y) PRELOAD_INIT(x) PRELOAD_INIT(y)
+# define PRELOAD_COND(x) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts);
+// Two consecutive preloads stall, so space them out a bit by using different modulus.
+# define PRELOAD_COND2(x,y) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts); \
+ if (((uint)&y[i])%L2CacheLineLength == 16) preload(&y[i] + L2CacheLineLengthInInts);
+# else
+# define PRELOAD_INIT(x)
+# define PRELOAD_INIT2(x,y)
+# define PRELOAD_COND(x)
+# define PRELOAD_COND2(x,y)
+# endif
+#else
+# define PRELOAD_INIT(x)
+# define PRELOAD_INIT2(x,y)
+# define PRELOAD_COND(x)
+# define PRELOAD_COND2(x,y)
#endif
/* The constant alpha factor describes an alpha factor that gets applied
@@ -1536,8 +1561,11 @@ static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint
QT_MEMFILL_UINT(dest, length, 0);
} else {
int ialpha = 255 - const_alpha;
- for (int i = 0; i < length; ++i)
+ PRELOAD_INIT(dest)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], ialpha);
+ }
}
}
@@ -1547,8 +1575,11 @@ static void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, ui
QT_MEMFILL_UINT(dest, length, 0);
} else {
int ialpha = 255 - const_alpha;
- for (int i = 0; i < length; ++i)
+ PRELOAD_INIT(dest)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], ialpha);
+ }
}
}
@@ -1563,8 +1594,11 @@ static void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint colo
} else {
int ialpha = 255 - const_alpha;
color = BYTE_MUL(color, const_alpha);
- for (int i = 0; i < length; ++i)
+ PRELOAD_INIT(dest)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
dest[i] = color + BYTE_MUL(dest[i], ialpha);
+ }
}
}
@@ -1574,8 +1608,11 @@ static void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length
::memcpy(dest, src, length * sizeof(uint));
} else {
int ialpha = 255 - const_alpha;
- for (int i = 0; i < length; ++i)
+ PRELOAD_INIT2(dest, src)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
dest[i] = INTERPOLATE_PIXEL_255(src[i], const_alpha, dest[i], ialpha);
+ }
}
}
@@ -1600,20 +1637,26 @@ static void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint
} else {
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
- for (int i = 0; i < length; ++i)
+ PRELOAD_INIT(dest)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
dest[i] = color + BYTE_MUL(dest[i], qAlpha(~color));
+ }
}
}
static void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha)
{
+ PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint s = src[i];
dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s));
}
@@ -1629,7 +1672,9 @@ static void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length,
{
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = d + BYTE_MUL(color, qAlpha(~d));
}
@@ -1637,13 +1682,16 @@ static void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length,
static void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha)
{
+ PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
dest[i] = d + BYTE_MUL(src[i], qAlpha(~d));
}
} else {
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = d + BYTE_MUL(s, qAlpha(~d));
@@ -1657,13 +1705,17 @@ static void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, i
*/
static void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha)
{
+ PRELOAD_INIT(dest)
if (const_alpha == 255) {
- for (int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
dest[i] = BYTE_MUL(color, qAlpha(dest[i]));
+ }
} else {
color = BYTE_MUL(color, const_alpha);
uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(d), d, cia);
}
@@ -1672,12 +1724,16 @@ static void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint co
static void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha)
{
+ PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
- for (int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(src[i], qAlpha(dest[i]));
+ }
} else {
uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, cia);
@@ -1696,19 +1752,25 @@ static void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, ui
if (const_alpha != 255) {
a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
}
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], a);
}
}
static void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha)
{
+ PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
- for (int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(dest[i], qAlpha(src[i]));
+ }
} else {
int cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint a = BYTE_MUL(qAlpha(src[i]), const_alpha) + cia;
dest[i] = BYTE_MUL(dest[i], a);
}
@@ -1722,13 +1784,17 @@ static void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int
static void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha)
{
+ PRELOAD_INIT(dest)
if (const_alpha == 255) {
- for (int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
dest[i] = BYTE_MUL(color, qAlpha(~dest[i]));
+ }
} else {
color = BYTE_MUL(color, const_alpha);
int cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, cia);
}
@@ -1737,12 +1803,16 @@ static void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint c
static void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha)
{
+ PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
- for (int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(src[i], qAlpha(~dest[i]));
+ }
} else {
int cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, cia);
@@ -1760,18 +1830,25 @@ static void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, u
uint a = qAlpha(~color);
if (const_alpha != 255)
a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
- for (int i = 0; i < length; ++i)
+ PRELOAD_INIT(dest)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], a);
+ }
}
static void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha)
{
+ PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
- for (int i = 0; i < length; ++i)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(dest[i], qAlpha(~src[i]));
+ }
} else {
int cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint sia = BYTE_MUL(qAlpha(~src[i]), const_alpha) + cia;
dest[i] = BYTE_MUL(dest[i], sia);
}
@@ -1790,20 +1867,26 @@ static void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint
color = BYTE_MUL(color, const_alpha);
}
uint sia = qAlpha(~color);
- for (int i = 0; i < length; ++i)
+ PRELOAD_INIT(dest)
+ for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[i]), dest[i], sia);
+ }
}
static void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha)
{
+ PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint s = src[i];
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
@@ -1823,7 +1906,9 @@ static void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length,
color = BYTE_MUL(color, const_alpha);
a = qAlpha(color) + 255 - const_alpha;
}
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d));
}
@@ -1831,8 +1916,10 @@ static void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length,
static void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha)
{
+ PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint s = src[i];
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(d, qAlpha(s), s, qAlpha(~d));
@@ -1840,6 +1927,7 @@ static void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, i
} else {
int cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
uint a = qAlpha(s) + cia;
@@ -1860,7 +1948,9 @@ static void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color,
color = BYTE_MUL(color, const_alpha);
uint sia = qAlpha(~color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia);
}
@@ -1868,14 +1958,17 @@ static void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color,
static void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha)
{
+ PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
@@ -1926,7 +2019,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Plus_impl(uint *dest, int
{
uint s = color;
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
d = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
@@ -1946,7 +2041,9 @@ static void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color,
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1982,7 +2079,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Multiply_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2008,7 +2107,9 @@ static void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint co
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2046,7 +2147,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Screen_impl(uint *dest, i
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2072,7 +2175,9 @@ static void QT_FASTCALL comp_func_solid_Screen(uint *dest, int length, uint colo
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2121,7 +2226,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Overlay_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2147,7 +2254,9 @@ static void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint col
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2190,7 +2299,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Darken_impl(uint *dest, i
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2216,7 +2327,9 @@ static void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint colo
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2259,7 +2372,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Lighten_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2285,7 +2400,9 @@ static void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint col
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2338,7 +2455,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorDodge_impl(uint *des
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2364,7 +2483,9 @@ static void QT_FASTCALL comp_func_solid_ColorDodge(uint *dest, int length, uint
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2418,7 +2539,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorBurn_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2444,7 +2567,9 @@ static void QT_FASTCALL comp_func_solid_ColorBurn(uint *dest, int length, uint c
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2494,7 +2619,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_HardLight_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2520,7 +2647,9 @@ static void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint c
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2579,7 +2708,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_SoftLight_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2605,7 +2736,9 @@ static void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint c
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2648,7 +2781,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Difference_impl(uint *des
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2674,7 +2809,9 @@ static void QT_FASTCALL comp_func_solid_Difference(uint *dest, int length, uint
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2711,7 +2848,9 @@ Q_STATIC_TEMPLATE_FUNCTION inline void QT_FASTCALL comp_func_solid_Exclusion_imp
int sg = qGreen(color);
int sb = qBlue(color);
+ PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2737,7 +2876,9 @@ static void QT_FASTCALL comp_func_solid_Exclusion(uint *dest, int length, uint c
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *dest, const uint *src, int length, const T &coverage)
{
+ PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
+ PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -7416,7 +7557,7 @@ static void qt_alphamapblit_quint32(QRasterBuffer *rasterBuffer,
#endif
{
int ialpha = 255 - coverage;
- dest[i] = BYTE_MUL(c, uint(coverage)) + BYTE_MUL(dest[i], ialpha);
+ dest[i] = INTERPOLATE_PIXEL_255(c, coverage, dest[i], ialpha);
}
}
}
@@ -7457,7 +7598,7 @@ static void qt_alphamapblit_quint32(QRasterBuffer *rasterBuffer,
#endif
{
int ialpha = 255 - coverage;
- dest[xp] = BYTE_MUL(c, uint(coverage)) + BYTE_MUL(dest[xp], ialpha);
+ dest[xp] = INTERPOLATE_PIXEL_255(c, coverage, dest[xp], ialpha);
}
}
@@ -8043,6 +8184,96 @@ static uint detectCPUFeatures()
#endif
}
+#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6)
+// Move these to qdrawhelper_arm.c when all
+// functions are implemented using arm assembly.
+static CompositionFunctionSolid qt_functionForModeSolid_ARMv6[numCompositionFunctions] = {
+ comp_func_solid_SourceOver,
+ comp_func_solid_DestinationOver,
+ comp_func_solid_Clear,
+ comp_func_solid_Source,
+ comp_func_solid_Destination,
+ comp_func_solid_SourceIn,
+ comp_func_solid_DestinationIn,
+ comp_func_solid_SourceOut,
+ comp_func_solid_DestinationOut,
+ comp_func_solid_SourceAtop,
+ comp_func_solid_DestinationAtop,
+ comp_func_solid_XOR,
+ comp_func_solid_Plus,
+ comp_func_solid_Multiply,
+ comp_func_solid_Screen,
+ comp_func_solid_Overlay,
+ comp_func_solid_Darken,
+ comp_func_solid_Lighten,
+ comp_func_solid_ColorDodge,
+ comp_func_solid_ColorBurn,
+ comp_func_solid_HardLight,
+ comp_func_solid_SoftLight,
+ comp_func_solid_Difference,
+ comp_func_solid_Exclusion,
+ rasterop_solid_SourceOrDestination,
+ rasterop_solid_SourceAndDestination,
+ rasterop_solid_SourceXorDestination,
+ rasterop_solid_NotSourceAndNotDestination,
+ rasterop_solid_NotSourceOrNotDestination,
+ rasterop_solid_NotSourceXorDestination,
+ rasterop_solid_NotSource,
+ rasterop_solid_NotSourceAndDestination,
+ rasterop_solid_SourceAndNotDestination
+};
+
+static CompositionFunction qt_functionForMode_ARMv6[numCompositionFunctions] = {
+ comp_func_SourceOver_armv6,
+ comp_func_DestinationOver,
+ comp_func_Clear,
+ comp_func_Source_armv6,
+ comp_func_Destination,
+ comp_func_SourceIn,
+ comp_func_DestinationIn,
+ comp_func_SourceOut,
+ comp_func_DestinationOut,
+ comp_func_SourceAtop,
+ comp_func_DestinationAtop,
+ comp_func_XOR,
+ comp_func_Plus,
+ comp_func_Multiply,
+ comp_func_Screen,
+ comp_func_Overlay,
+ comp_func_Darken,
+ comp_func_Lighten,
+ comp_func_ColorDodge,
+ comp_func_ColorBurn,
+ comp_func_HardLight,
+ comp_func_SoftLight,
+ comp_func_Difference,
+ comp_func_Exclusion,
+ rasterop_SourceOrDestination,
+ rasterop_SourceAndDestination,
+ rasterop_SourceXorDestination,
+ rasterop_NotSourceAndNotDestination,
+ rasterop_NotSourceOrNotDestination,
+ rasterop_NotSourceXorDestination,
+ rasterop_NotSource,
+ rasterop_NotSourceAndDestination,
+ rasterop_SourceAndNotDestination
+};
+
+static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userData)
+{
+ QSpanData *data = reinterpret_cast<QSpanData *>(userData);
+
+ CompositionFunctionSolid func = qt_functionForModeSolid_ARMv6[data->rasterBuffer->compositionMode];
+ while (count--) {
+ uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x;
+ func(target, spans->len, data->solid.color, spans->coverage);
+ ++spans;
+ }
+}
+
+#endif // Q_CC_RVCT && QT_HAVE_ARMV6
+
+
void qInitDrawhelperAsm()
{
static uint features = 0xffffffff;
@@ -8158,6 +8389,20 @@ void qInitDrawhelperAsm()
#endif // QT_NO_DEBUG
+#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6)
+ functionForModeAsm = qt_functionForMode_ARMv6;
+ functionForModeSolidAsm = qt_functionForModeSolid_ARMv6;
+
+ qt_memfill32 = qt_memfill32_armv6;
+
+ qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_armv6;
+
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6;
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6;
+#endif // Q_CC_RVCT && QT_HAVE_ARMV6
+
if (functionForModeSolidAsm) {
const int destinationMode = QPainter::CompositionMode_Destination;
functionForModeSolidAsm[destinationMode] = functionForModeSolid_C[destinationMode];