summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/painting.pri26
-rw-r--r--src/gui/painting/qblendfunctions_armv6_rvct.s223
-rw-r--r--src/gui/painting/qdrawhelper.cpp288
-rw-r--r--src/gui/painting/qdrawhelper_armv6_p.h81
-rw-r--r--src/gui/painting/qdrawhelper_armv6_rvct.inc496
-rw-r--r--src/gui/painting/qdrawhelper_armv6_rvct.s178
-rw-r--r--src/gui/painting/qdrawhelper_p.h95
-rw-r--r--src/gui/painting/qgraphicssystem.cpp4
-rw-r--r--src/gui/painting/qgraphicssystemfactory.cpp2
-rw-r--r--src/gui/painting/qgrayraster.c5
-rw-r--r--src/gui/painting/qpaintdevice_s60.cpp42
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp16
-rw-r--r--src/gui/painting/qpathclipper_p.h7
-rw-r--r--src/gui/painting/qregion.h4
-rw-r--r--src/gui/painting/qregion_s60.cpp22
-rw-r--r--src/gui/painting/qtessellator.cpp3
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp204
-rw-r--r--src/gui/painting/qwindowsurface_s60_p.h65
18 files changed, 1688 insertions, 73 deletions
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 528559c..33d53e4 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -82,6 +82,7 @@ SOURCES += \
DEFINES += QT_RASTER_IMAGEENGINE
win32:DEFINES += QT_RASTER_PAINTENGINE
embedded:DEFINES += QT_RASTER_PAINTENGINE
+ symbian:DEFINES += QT_RASTER_PAINTENGINE
SOURCES += \
painting/qpaintengine_raster.cpp \
painting/qdrawhelper.cpp \
@@ -162,14 +163,14 @@ unix:x11 {
painting/qprintengine_mac.mm \
}
-unix:!mac {
+unix:!mac:!symbian {
HEADERS += \
painting/qprinterinfo_unix_p.h
SOURCES += \
painting/qprinterinfo_unix.cpp
}
-win32|x11|mac|embedded {
+win32|x11|mac|embedded|symbian {
SOURCES += painting/qbackingstore.cpp
HEADERS += painting/qbackingstore_p.h
}
@@ -186,6 +187,12 @@ embedded {
painting/qpaintdevice_qws.cpp
}
+symbian {
+ SOURCES += \
+ painting/qpaintdevice_s60.cpp \
+ painting/qregion_s60.cpp
+}
+
x11|embedded {
contains(QT_CONFIG,qtopia) {
DEFINES += QT_NO_CUPS QT_NO_LPR
@@ -367,3 +374,18 @@ win32:contains(QT_CONFIG, direct3d) {
SOURCES += painting/qwindowsurface_d3d.cpp
}
+symbian {
+ HEADERS += painting/qwindowsurface_s60_p.h
+ SOURCES += painting/qwindowsurface_s60.cpp
+ armccIfdefBlock = \
+ "$${LITERAL_HASH}if defined(ARMV6)" \
+ "MACRO QT_HAVE_ARMV6" \
+ "SOURCEPATH painting" \
+ "SOURCE qblendfunctions_armv6_rvct.s" \
+ "SOURCE qdrawhelper_armv6_rvct.s" \
+ "$${LITERAL_HASH}endif"
+
+ MMP_RULES += armccIfdefBlock
+ QMAKE_CXXFLAGS.ARMCC *= -O3
+}
+
diff --git a/src/gui/painting/qblendfunctions_armv6_rvct.s b/src/gui/painting/qblendfunctions_armv6_rvct.s
new file mode 100644
index 0000000..312bd07
--- /dev/null
+++ b/src/gui/painting/qblendfunctions_armv6_rvct.s
@@ -0,0 +1,223 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;** Contact: Qt Software Information (qt-info@nokia.com)
+;**
+;** This file is part of the QtGui module of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** No Commercial Usage
+;** This file contains pre-release code and may not be distributed.
+;** You may use this file in accordance with the terms and conditions
+;** contained in the either Technology Preview License Agreement or the
+;** Beta Release License Agreement.
+;**
+;** GNU Lesser General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU Lesser
+;** General Public License version 2.1 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.LGPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU Lesser General Public License version 2.1 requirements
+;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain
+;** additional rights. These rights are described in the Nokia Qt LGPL
+;** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+;** package.
+;**
+;** GNU General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU
+;** General Public License version 3.0 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.GPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU General Public License version 3.0 requirements will be
+;** met: http://www.gnu.org/copyleft/gpl.html.
+;**
+;** If you are unsure which license is appropriate for your use, please
+;** contact the sales department at qt-sales@nokia.com.
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
+
+;
+; W A R N I N G
+; -------------
+;
+; This file is not part of the Qt API. It exists purely as an
+; implementation detail. This header file may change from version to
+; version without notice, or even be removed.
+;
+; We mean it.
+;
+
+
+ ARM
+ PRESERVE8
+
+ INCLUDE qdrawhelper_armv6_rvct.inc
+
+
+;-----------------------------------------------------------------------------
+; qt_blend_rgb32_on_rgb32_arm
+;
+; @brief
+;
+; @param dest Destination pixels (r0)
+; @param dbpl Destination bytes per line (r1)
+; @param src Source pixels (r2)
+; @param sbpl Source bytes per line (r3)
+; @param w Width (s0 -> r4)
+; @param h Height (s1 -> r5)
+; @param const_alpha Constant alpha (s2 -> r6)
+;
+;---------------------------------------------------------------------------
+qt_blend_rgb32_on_rgb32_armv6 Function
+ stmfd sp!, {r4-r12, r14}
+
+ ; read arguments off the stack
+ add r8, sp, #10 * 4
+ ldmia r8, {r9-r11}
+
+ ; Reorganize registers
+
+ mov r4, r10
+ mov r5, r1
+ mov r6, r3
+
+ mov r1, r2
+ mov r2, r9
+ mov r3, r11
+
+ ; Now we have registers
+ ; @param dest Destination pixels (r0)
+ ; @param src Source pixels (r1)
+ ; @param w Width (r2)
+ ; @param const_alpha Constant alpha (r3)
+ ; @param h Height (r4)
+ ; @param dbpl Destination bytes per line (r5)
+ ; @param sbpl Source bytes per line (r6)
+
+ cmp r3, #256 ; test if we have fully opaque constant alpha value
+ bne rgb32_blend_const_alpha ; branch if not
+
+rgb32_blend_loop
+
+ subs r4, r4, #1
+ bmi rgb32_blend_exit ; while(h--)
+
+rgb321 PixCpySafe r0, r1, r2
+
+ add r0, r0, r5 ; dest = dest + dbpl
+ add r1, r1, r6 ; src = src + sbpl
+
+ b rgb32_blend_loop
+
+
+rgb32_blend_const_alpha
+
+ ;ldr r14, =ComponentHalf ; load 0x800080 to r14
+ mov r14, #0x800000
+ add r14, r14, #0x80
+
+ sub r3, r3, #1 ; const_alpha -= 1;
+
+rgb32_blend_loop_const_alpha
+
+ subs r4, r4, #1
+ bmi rgb32_blend_exit ; while(h--)
+
+rgb322 BlendRowSafe PixelSourceOverConstAlpha
+
+ add r0, r0, r5 ; dest = dest + dbpl
+ add r1, r1, r6 ; src = src + sbpl
+
+ b rgb32_blend_loop_const_alpha
+
+rgb32_blend_exit
+
+ ldmfd sp!, {r4-r12, pc} ; pop and return
+
+
+
+;-----------------------------------------------------------------------------
+; qt_blend_argb32_on_argb32_arm
+;
+; @brief
+;
+; @param dest Destination pixels (r0)
+; @param dbpl Destination bytes per line (r1)
+; @param src Source pixels (r2)
+; @param sbpl Source bytes per line (r3)
+; @param w Width (s0 -> r4)
+; @param h Height (s1 -> r5)
+; @param const_alpha Constant alpha (s2 -> r6)
+;
+;---------------------------------------------------------------------------
+qt_blend_argb32_on_argb32_armv6 Function
+ stmfd sp!, {r4-r12, r14}
+
+ ; read arguments off the stack
+ add r8, sp, #10 * 4
+ ldmia r8, {r9-r11}
+
+ ; Reorganize registers
+
+ mov r4, r10
+ mov r5, r1
+ mov r6, r3
+
+ mov r1, r2
+ mov r2, r9
+ mov r3, r11
+
+ ; Now we have registers
+ ; @param dest Destination pixels (r0)
+ ; @param src Source pixels (r1)
+ ; @param w Width (r2)
+ ; @param const_alpha Constant alpha (r3)
+ ; @param h Height (r4)
+ ; @param dbpl Destination bytes per line (r5)
+ ; @param sbpl Source bytes per line (r6)
+
+ ;ldr r14, =ComponentHalf ; load 0x800080 to r14
+ mov r14, #0x800000
+ add r14, r14, #0x80
+
+ cmp r3, #256 ; test if we have fully opaque constant alpha value
+ bne argb32_blend_const_alpha ; branch if not
+
+argb32_blend_loop
+
+ subs r4, r4, #1
+ bmi argb32_blend_exit ; while(h--)
+
+argb321 BlendRowSafe PixelSourceOver
+
+ add r0, r0, r5 ; dest = dest + dbpl
+ add r1, r1, r6 ; src = src + sbpl
+
+ b argb32_blend_loop
+
+argb32_blend_const_alpha
+
+ sub r3, r3, #1 ; const_alpha -= 1;
+
+argb32_blend_loop_const_alpha
+
+ subs r4, r4, #1
+ bmi argb32_blend_exit ; while(h--)
+
+argb322 BlendRowSafe PixelSourceOverConstAlpha
+
+ add r0, r0, r5 ; dest = dest + dbpl
+ add r1, r1, r6 ; src = src + sbpl
+
+ b argb32_blend_loop_const_alpha
+
+argb32_blend_exit
+
+ ldmfd sp!, {r4-r12, pc} ; pop and return
+
+
+ END ; File end
+
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 9f2831d..ed4dd57 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,7 +1500,35 @@ static const uint * QT_FASTCALL fetchConicalGradient(uint *buffer, const Operato
return b;
}
-
+#if defined(Q_CC_RVCT)
+// 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
to the result of the composition operation combining it with the destination.
@@ -1530,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);
+ }
}
}
@@ -1541,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);
+ }
}
}
@@ -1557,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);
+ }
}
}
@@ -1568,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);
+ }
}
}
@@ -1594,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));
}
@@ -1623,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));
}
@@ -1631,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));
@@ -1651,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);
}
@@ -1666,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);
@@ -1690,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);
}
@@ -1716,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);
}
@@ -1731,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);
@@ -1754,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);
}
@@ -1784,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));
@@ -1817,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));
}
@@ -1825,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));
@@ -1834,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;
@@ -1854,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);
}
@@ -1862,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));
@@ -1920,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));
@@ -1940,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];
@@ -1976,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);
@@ -2002,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];
@@ -2040,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);
@@ -2066,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];
@@ -2115,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);
@@ -2141,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];
@@ -2184,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);
@@ -2210,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];
@@ -2253,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);
@@ -2279,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];
@@ -2332,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);
@@ -2358,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];
@@ -2411,7 +2538,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);
@@ -2437,7 +2566,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];
@@ -2487,7 +2618,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);
@@ -2513,7 +2646,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];
@@ -2572,7 +2707,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);
@@ -2598,7 +2735,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];
@@ -2641,7 +2780,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);
@@ -2667,7 +2808,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];
@@ -2704,7 +2847,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);
@@ -2730,7 +2875,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];
@@ -2756,6 +2903,11 @@ static void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int len
comp_func_Exclusion_impl(dest, src, length, QPartialCoverage(const_alpha));
}
+#if defined(Q_CC_RVCT)
+// Restore pragma state from previous #pragma arm
+# pragma pop
+#endif
+
static void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
int length,
uint color,
@@ -7404,7 +7556,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);
}
}
}
@@ -7445,7 +7597,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);
}
}
@@ -8031,6 +8183,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;
@@ -8146,6 +8388,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];
diff --git a/src/gui/painting/qdrawhelper_armv6_p.h b/src/gui/painting/qdrawhelper_armv6_p.h
new file mode 100644
index 0000000..a4c1df2
--- /dev/null
+++ b/src/gui/painting/qdrawhelper_armv6_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDRAWHELPER_ARMV6_P_H
+#define QDRAWHELPER_ARMV6_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qdrawhelper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6)
+
+extern "C" void qt_blend_rgb32_on_rgb32_armv6(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+extern "C" void qt_blend_argb32_on_argb32_armv6(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+extern "C" void qt_memfill32_armv6(quint32 *dest, quint32 value, int count);
+
+extern "C" void comp_func_Source_armv6(uint *dest, const uint *src, int length, uint const_alpha);
+extern "C" void comp_func_SourceOver_armv6(uint *dest, const uint *src, int length, uint const_alpha);
+
+#endif // QT_HAVE_ARMV6
+
+QT_END_NAMESPACE
+
+#endif // QDRAWHELPER_ARMV6_P_H
diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.inc b/src/gui/painting/qdrawhelper_armv6_rvct.inc
new file mode 100644
index 0000000..b3e0605
--- /dev/null
+++ b/src/gui/painting/qdrawhelper_armv6_rvct.inc
@@ -0,0 +1,496 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;** Contact: Qt Software Information (qt-info@nokia.com)
+;**
+;** This file is part of the QtGui module of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** No Commercial Usage
+;** This file contains pre-release code and may not be distributed.
+;** You may use this file in accordance with the terms and conditions
+;** contained in the either Technology Preview License Agreement or the
+;** Beta Release License Agreement.
+;**
+;** GNU Lesser General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU Lesser
+;** General Public License version 2.1 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.LGPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU Lesser General Public License version 2.1 requirements
+;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain
+;** additional rights. These rights are described in the Nokia Qt LGPL
+;** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+;** package.
+;**
+;** GNU General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU
+;** General Public License version 3.0 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.GPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU General Public License version 3.0 requirements will be
+;** met: http://www.gnu.org/copyleft/gpl.html.
+;**
+;** If you are unsure which license is appropriate for your use, please
+;** contact the sales department at qt-sales@nokia.com.
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
+
+;
+; W A R N I N G
+; -------------
+;
+; This file is not part of the Qt API. It exists purely as an
+; implementation detail. This header file may change from version to
+; version without notice, or even be removed.
+;
+; We mean it.
+;
+
+;-----------------------------------------------------------------------------
+; Globals.
+; Earch marcro expects that caller has loaded 0x800080 to r14.
+;-----------------------------------------------------------------------------
+
+ComponentHalf EQU 0x800080
+
+;-----------------------------------------------------------------------------
+; ARM assembly implementations of accelerated graphics operations.
+;
+; Conventions:
+;
+; - r0 = Target buffer pointer
+; - r1 = Source buffer pointer
+; - r2 = Length of the buffer to blend
+; - r3 = Constant alpha for source buffer
+;
+;-----------------------------------------------------------------------------
+
+; A macro for transparently defining ARM functions
+ MACRO
+$func Function
+ AREA Function_$func, CODE
+ GLOBAL $func
+ ALIGN 4
+ CODE32
+$func
+ MEND
+
+
+;-----------------------------------------------------------------------------
+; Armv6 boosted implementation of BYTE_MUL(...) function found in qdrawhelper_p.h.
+;
+; @param dst Destination register where to store the result
+; @param x Value to multiply
+; @param a Multiplicator byte
+; @param r14 Component half 0x800080
+;
+; @note Trashes x, r8
+;-----------------------------------------------------------------------------
+ MACRO
+ ByteMul $dst, $x, $a
+
+ ; static inline uint BYTE_MUL(uint x, uint a)
+
+ ; uint r8 = (x & 0xff00ff) * a + 0x800080
+ uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF
+ mla r8, r8, $a, r14
+
+ ; x = ((r >> 8) & 0xff00ff) * a + 0x800080
+ uxtb16 $x, $x, ror #8
+ mla $x, $x, $a, r14
+
+
+ ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8
+ ; r8 &= 0xff00ff
+ uxtab16 r8, r8, r8, ror #8
+ uxtb16 r8, r8, ror #8
+
+ ; x = x + ((x >>8) & 0xff00ff)
+ uxtab16 $x, $x, $x, ror #8
+
+ ; x &= 0xff00ff00
+ ; x |= r8
+ uxtb16 $x, $x, ror #8
+ orr $dst, r8, $x, lsl #8
+
+ MEND
+
+;-----------------------------------------------------------------------------
+; Armv6 boosted implementation of INTERPOLATE_PIXEL_255(...) function found in
+; qdrawhelper_p.h.
+;
+; @param dst Destination register where to store the result
+; @param x First value to multiply
+; @param a Multiplicator byte for first value
+; @param y Second value to multiply
+; @param b Multiplicator byte for second value
+; @param r14 Component half 0x800080
+;
+;
+; @note Trashes x, r8, r14
+;-----------------------------------------------------------------------------
+ MACRO
+ InterpolatePixel255 $dst, $x, $a, $y, $b
+
+ ; static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b)
+
+ ; First calculate the parts where we need 0x800080
+
+ ; uint r8 = (((x & 0xff00ff) * a) + 0x800080)
+ uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF
+ mla r8, r8, $a, r14
+
+ ; x = ((((x >> 8) & 0xff00ff) * a) + 0x800080)
+ uxtb16 $x, $x, ror #8
+ mla $x, $x, $a, r14
+
+ ; Now we are trashing r14 to free it for other purposes
+
+ ; uint r14 = (y & 0xff00ff) * b
+ uxtb16 r14, $y ; r14 = y & 0x00FF00FF
+ mul r14, r14, $b
+
+ ; r8 = r8 + r14
+ add r8, r8, r14
+
+ ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8
+ ; r8 &= 0xff00ff
+ uxtab16 r8, r8, r8, ror #8
+ uxtb16 r8, r8, ror #8
+
+ ; r14 = ((y >> 8) & 0xff00ff) * b
+ uxtb16 r14, $y, ror #8 ; r14 = ((y >> 8) & 0xFF00FF)
+ mul r14, r14, $b
+
+ ; x = x + r14
+ add $x, $x, r14
+
+ ; x = x + ((x >>8) & 0xff00ff)
+ uxtab16 $x, $x, $x, ror #8
+
+ ; x &= 0xff00ff00
+ ; x |= r8
+ uxtb16 $x, $x, ror #8
+ orr $dst, r8, $x, lsl #8
+
+ MEND
+
+;-----------------------------------------------------------------------------
+;
+;-----------------------------------------------------------------------------
+ MACRO
+$label Blend4Pixels $BlendPixel
+
+ ; Blend first 4 pixels
+
+ ldmia r1!, {r4-r7}
+ ldm r0, {r9-r12}
+
+b4p1_$label $BlendPixel r9, r4, r3
+b4p2_$label $BlendPixel r10, r5, r3
+b4p3_$label $BlendPixel r11, r6, r3
+b4p4_$label $BlendPixel r12, r7, r3
+
+ stmia r0!, {r9-r12}
+
+ MEND
+
+;-----------------------------------------------------------------------------
+;
+;-----------------------------------------------------------------------------
+ MACRO
+$label Blend8Pixels $BlendPixel
+
+b8p1_$label Blend4Pixels $BlendPixel
+b8p2_$label Blend4Pixels $BlendPixel
+
+ MEND
+
+;-----------------------------------------------------------------------------
+;
+;-----------------------------------------------------------------------------
+ MACRO
+$label Blend16Pixels $BlendPixel
+
+b16p1_$label Blend8Pixels $BlendPixel
+b16p2_$label Blend8Pixels $BlendPixel
+
+ MEND
+
+;-----------------------------------------------------------------------------
+;
+;-----------------------------------------------------------------------------
+ MACRO
+$label Blend32Pixels $BlendPixel
+
+b32p1_$label Blend16Pixels $BlendPixel
+b32p2_$label Blend16Pixels $BlendPixel
+
+ MEND
+
+;-----------------------------------------------------------------------------
+; A macro for source over compositing one row of pixels and saving the results
+; to destination buffer.
+;
+; @param dest Destination buffer (r0)
+; @param src Source buffer (r1)
+; @param length Length (r2)
+; @param const_alpha Constant alpha (r3)
+; @param r14 Component Half (0x800080) (r14)
+;
+; @note Advances r0, r1
+; @note Trashes r2, r4-r12
+;-----------------------------------------------------------------------------
+ MACRO
+$label BlendRow $BlendPixel
+
+ pld [r1]
+
+bloop_$label
+ ; Blend 32 pixels per loop iteration
+ subs r2, r2, #32
+ bmi b_remaining_$label
+
+brp1_$label Blend32Pixels $BlendPixel
+
+ b bloop_$label
+
+b_remaining_$label
+
+ ; Remaining 31 pixels
+
+ addmi r2, r2, #32
+
+ ; Blend 16 pixels
+ tst r2, #16
+ beq b_remaining8_$label
+
+brp2_$label Blend16Pixels $BlendPixel
+
+b_remaining8_$label
+
+ ; Blend 8 pixels
+ tst r2, #8
+ beq b_remaining4_$label
+
+brp3_$label Blend8Pixels $BlendPixel
+
+b_remaining4_$label
+
+ ; Blend 4 pixels
+ tst r2, #4
+ beq b_remaining3_$label
+
+brp4_$label Blend4Pixels $BlendPixel
+
+b_remaining3_$label
+
+ ; Remaining 3 pixels
+
+ tst r2, #2
+ beq b_last_$label
+
+ ldmia r1!, {r4-r5}
+ ldm r0, {r9-r10}
+
+brp5_$label $BlendPixel r9, r4, r3
+brp6_$label $BlendPixel r10, r5, r3
+
+ stmia r0!, {r9-r10}
+
+b_last_$label
+
+ tst r2, #1
+ beq bexit_$label
+
+ ldr r4, [r1]
+ ldr r9, [r0]
+
+bpl_$label $BlendPixel r9, r4, r3
+
+ str r9, [r0]
+
+bexit_$label
+
+ MEND
+
+;-----------------------------------------------------------------------------
+; A macro for source over compositing one row of pixels and saving the results
+; to destination buffer. Restores all registers.
+;
+; @param dest Destination buffer (r0)
+; @param src Source buffer (r1)
+; @param length Length (r2)
+; @param const_alpha Constant alpha (r3)
+; @param r14 Component Half (0x800080) (r14)
+;
+; @note Advances r0, r1
+; @note Trashes r2, r4-r12
+;-----------------------------------------------------------------------------
+ MACRO
+$label BlendRowSafe $BlendPixel
+
+ stmfd sp!, {r0-r6} ; Preserves registers only up to r6
+
+brs_$label BlendRow $BlendPixel
+
+ ldmfd sp!, {r0-r6}
+
+ MEND
+
+
+;-----------------------------------------------------------------------------
+; Pix Copy.
+; NOTE! Cache line size of ARM1136JF-S and ARM1136J-S is 32 bytes (8 pixels).
+;
+; @param dst Destination pixels (r0)
+; @param src Source pixels (r1)
+; @param len Length (r2)
+;
+; @note Trashes r3-r10
+;-----------------------------------------------------------------------------
+ MACRO
+$label PixCpy $dst, $src, $len
+
+ pld [$src]
+
+pcpy_loop_$label
+ ; Copy 8 pixels per loop iteration
+ pld [$src, #96]
+ subs $len, $len, #8
+ ldmgeia $src!, {r3-r10}
+ stmgeia $dst!, {r3-r10}
+ bgt pcpy_loop_$label
+
+pcpy_remaining_$label
+
+ ; Copy up to 7 remaining pixels
+
+ ; Copy 4 pixels
+ tst $len, #4
+ ldmneia $src!, {r3-r6}
+ stmneia $dst!, {r3-r6}
+
+ tst $len, #2
+ ldmneia $src!, {r3-r4}
+ stmneia $dst!, {r3-r4}
+
+ tst $len, #1
+ ldrne r3, [$src]
+ strne r3, [$dst]
+
+ MEND
+
+;-----------------------------------------------------------------------------
+; General Pix Copy. Maximum 8 pixels at time. Restores all registers.
+;
+; @param dst Destination pixels (r0)
+; @param src Source pixels (r1)
+; @param len Length (r2)
+;
+; @note Trashes r3-r10
+;-----------------------------------------------------------------------------
+ MACRO
+$label PixCpySafe $dst, $src, $len
+
+ stmfd sp!, {r0-r6} ; Preserves registers only up to r6
+
+pcs_$label PixCpy $dst, $src, $len
+
+ ldmfd sp!, {r0-r6} ; pop
+
+ MEND
+
+
+;-----------------------------------------------------------------------------
+; A macro for source over compositing one pixel and saving the result to
+; dst register.
+;
+; @param dst Destination register, must contain destination pixel upon entry
+; @param src Source register, must contain source pixel upon entry
+; @param const_alpha Constant source alpha
+; @param r14 Component half 0x800080
+;
+; @note Trashes const_alpha, r8
+;-----------------------------------------------------------------------------
+ MACRO
+$label PixelSourceOver $dst, $src, $const_alpha
+
+ ; Negate src and extract alpha
+ mvn $const_alpha, $src ; bitwise not
+ uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24);
+
+ ;cmp $const_alpha, #255 ; test for full transparency ( negated )
+ ;beq exit_$label
+ cmp $const_alpha, #0 ; test for full opacity ( negated )
+ moveq $dst, $src
+ beq exit_$label
+
+ ByteMul $dst, $dst, $const_alpha
+ add $dst, $src, $dst
+
+exit_$label
+ MEND
+
+;-----------------------------------------------------------------------------
+; A macro for source over compositing one pixel and saving the result to
+; dst register.
+;
+; @param dst Destination register, must contain destination pixel upon entry
+; @param src Source register, must contain source pixel upon entry
+; @param const_alpha Constant source alpha
+; @param r14 Component half 0x800080
+;
+; @note Trashes src, const_alpha, r8
+;-----------------------------------------------------------------------------
+ MACRO
+$label PixelSourceOverConstAlpha $dst, $src, $const_alpha
+
+ ; store alpha because we are going to trash it
+ stmfd sp!, {$const_alpha}
+
+ ByteMul $src, $src, $const_alpha
+
+ ; Negate src and extract alpha
+ mvn $const_alpha, $src ; bitwise not
+ uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24);
+
+ ByteMul $dst, $dst, $const_alpha
+
+ add $dst, $src, $dst
+
+ ; recover alpha
+ ldmfd sp!, {$const_alpha}
+
+ MEND
+
+;-----------------------------------------------------------------------------
+; A macro for source over compositing one pixel and saving the result to
+; a register.
+;
+; @param dst Destination register, must contain destination pixel upon entry
+; @param src Source register, must contain source pixel upon entry
+; @param const_alpha Constant source alpha
+; @param r14 Component half 0x800080
+;
+; @note Trashes src, r8
+;-----------------------------------------------------------------------------
+ MACRO
+$label PixelSourceConstAlpha $dst, $src, $const_alpha
+
+ ; store r2 and r14 because we are going to trash them
+ stmfd sp!, {r2, r14}
+
+ rsb r2, $const_alpha, #255
+ InterpolatePixel255 $dst, $src, $const_alpha, $dst, r2
+
+ ; recover r2 and r14
+ ldmfd sp!, {r2, r14}
+
+ MEND
+
+ END ; File end
diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.s b/src/gui/painting/qdrawhelper_armv6_rvct.s
new file mode 100644
index 0000000..3ffe48b
--- /dev/null
+++ b/src/gui/painting/qdrawhelper_armv6_rvct.s
@@ -0,0 +1,178 @@
+;/****************************************************************************
+;**
+;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;** Contact: Qt Software Information (qt-info@nokia.com)
+;**
+;** This file is part of the QtGui module of the Qt Toolkit.
+;**
+;** $QT_BEGIN_LICENSE:LGPL$
+;** No Commercial Usage
+;** This file contains pre-release code and may not be distributed.
+;** You may use this file in accordance with the terms and conditions
+;** contained in the either Technology Preview License Agreement or the
+;** Beta Release License Agreement.
+;**
+;** GNU Lesser General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU Lesser
+;** General Public License version 2.1 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.LGPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU Lesser General Public License version 2.1 requirements
+;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;**
+;** In addition, as a special exception, Nokia gives you certain
+;** additional rights. These rights are described in the Nokia Qt LGPL
+;** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+;** package.
+;**
+;** GNU General Public License Usage
+;** Alternatively, this file may be used under the terms of the GNU
+;** General Public License version 3.0 as published by the Free Software
+;** Foundation and appearing in the file LICENSE.GPL included in the
+;** packaging of this file. Please review the following information to
+;** ensure the GNU General Public License version 3.0 requirements will be
+;** met: http://www.gnu.org/copyleft/gpl.html.
+;**
+;** If you are unsure which license is appropriate for your use, please
+;** contact the sales department at qt-sales@nokia.com.
+;** $QT_END_LICENSE$
+;**
+;****************************************************************************/
+
+;
+; W A R N I N G
+; -------------
+;
+; This file is not part of the Qt API. It exists purely as an
+; implementation detail. This header file may change from version to
+; version without notice, or even be removed.
+;
+; We mean it.
+;
+
+ ARM
+ PRESERVE8
+
+ INCLUDE qdrawhelper_armv6_rvct.inc
+
+;-----------------------------------------------------------------------------
+; qt_memfill32_armv6
+;
+; @brief Not yet in use!
+;
+; @param dest Destination buffer (r0)
+; @param value Value (r1)
+; @param count Count (r2)
+;
+;---------------------------------------------------------------------------
+qt_memfill32_armv6 Function
+ stmfd sp!, {r4-r12, r14}
+
+ mov r3, r1
+ mov r4, r1
+ mov r5, r1
+ mov r6, r1
+ mov r7, r1
+ mov r8, r1
+ mov r9, r1
+
+mfill_loop
+ ; Fill 32 pixels per loop iteration
+ subs r2, r2, #32
+ stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9}
+ stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9}
+ stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9}
+ stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9}
+ bgt mfill_loop
+
+mfill_remaining
+
+ ; Fill up to 31 remaining pixels
+
+ ; Fill 16 pixels
+ tst r2, #16
+ stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9}
+ stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9}
+
+ ; Fill 8 pixels
+ tst r2, #8
+ stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9}
+
+ ; Fill 4 pixels
+ tst r2, #4
+ stmneia r0!, {r1, r3, r4, r5}
+
+ ; Fill 2 pixels
+ tst r2, #2
+ stmneia r0!, {r1, r3}
+
+ ; Fill last one
+ tst r2, #1
+ strne r1, [r0]
+
+ ldmfd sp!, {r4-r12, pc} ; pop and return
+
+;-----------------------------------------------------------------------------
+; comp_func_Source_arm
+;
+; @brief
+;
+; @param dest Destination buffer (r0)
+; @param src Source buffer (r1)
+; @param length Length (r2)
+; @param const_alpha Constant alpha (r3)
+;
+;---------------------------------------------------------------------------
+comp_func_Source_armv6 Function
+ stmfd sp!, {r4-r12, r14}
+
+ cmp r3, #255 ; if(r3 == 255)
+ bne src2 ; branch if not
+
+src1 PixCpy r0, r1, r2
+
+ ldmfd sp!, {r4-r12, pc} ; pop and return
+
+src2
+ ;ldr r14, =ComponentHalf ; load 0x800080 to r14
+ mov r14, #0x800000
+ add r14, r14, #0x80
+
+src22 BlendRow PixelSourceConstAlpha
+
+ ldmfd sp!, {r4-r12, pc} ; pop and return
+
+;-----------------------------------------------------------------------------
+; comp_func_SourceOver_arm
+;
+; @brief
+;
+; @param dest Destination buffer (r0)
+; @param src Source buffer (r1)
+; @param length Length (r2)
+; @param const_alpha Constant alpha (r3)
+;
+;---------------------------------------------------------------------------
+comp_func_SourceOver_armv6 Function
+ stmfd sp!, {r4-r12, r14}
+
+ ;ldr r14, =ComponentHalf ; load 0x800080 to r14
+ mov r14, #0x800000
+ add r14, r14, #0x80
+
+ cmp r3, #255 ; if(r3 == 255)
+ bne srcovr2 ; branch if not
+
+srcovr1 BlendRow PixelSourceOver
+
+ ldmfd sp!, {r4-r12, pc} ; pop and return
+
+srcovr2
+
+srcovr22 BlendRow PixelSourceOverConstAlpha
+
+ ldmfd sp!, {r4-r12, pc} ; pop and return
+
+
+ END ; File end
+
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index de97683..ddda7f7 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -87,7 +87,7 @@ QT_BEGIN_NAMESPACE
#if defined(Q_CC_RVCT)
// RVCT doesn't like static template functions
# define Q_STATIC_TEMPLATE_FUNCTION
-# define Q_STATIC_INLINE_FUNCTION inline
+# define Q_STATIC_INLINE_FUNCTION static __forceinline
#else
# define Q_STATIC_TEMPLATE_FUNCTION static
# define Q_STATIC_INLINE_FUNCTION static inline
@@ -300,19 +300,23 @@ struct QSpanData
};
-static inline uint BYTE_MUL_RGB16(uint x, uint a) {
+Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) {
a += 1;
uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0;
t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f;
return t;
}
-static inline uint BYTE_MUL_RGB16_32(uint x, uint a) {
+Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) {
uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0;
t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f;
return t;
}
+#if defined(Q_CC_RVCT)
+# pragma push
+# pragma arm
+#endif
Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
uint t = (x & 0xff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
@@ -324,8 +328,11 @@ Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
x |= t;
return x;
}
+#if defined(Q_CC_RVCT)
+# pragma pop
+#endif
-static inline uint PREMUL(uint x) {
+Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
uint a = x >> 24;
uint t = (x & 0xff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
@@ -390,7 +397,7 @@ public:
return qt_colorConvert<quint16, quint32>(data, 0);
}
- static inline quint32p fromRawData(quint32 v)
+ Q_STATIC_INLINE_FUNCTION quint32p fromRawData(quint32 v)
{
quint32p p;
p.data = v;
@@ -421,7 +428,7 @@ class qrgb565;
class qargb8565
{
public:
- static inline bool hasAlpha() { return true; }
+ Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
inline qargb8565() {}
inline qargb8565(quint32 v);
@@ -438,8 +445,8 @@ public:
data[1] &= 0xdf;
return *this;
}
- static inline quint8 alpha(quint8 a) { return (a + 1) >> 3; }
- static inline quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
+ Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
+ Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
inline qargb8565 byte_mul(quint8 a) const;
inline qargb8565 operator+(qargb8565 v) const;
@@ -456,7 +463,7 @@ private:
class qrgb565
{
public:
- static inline bool hasAlpha() { return false; }
+ Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
qrgb565(int v = 0) : data(v) {}
@@ -471,8 +478,8 @@ public:
inline quint8 alpha() const { return 0xff; }
inline qrgb565 truncedAlpha() { return *this; }
- static inline quint8 alpha(quint8 a) { return (a + 1) >> 3; }
- static inline quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
+ Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
+ Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
inline qrgb565 byte_mul(quint8 a) const;
@@ -647,7 +654,7 @@ class qrgb555;
class qargb8555
{
public:
- static inline bool hasAlpha() { return true; }
+ Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
qargb8555() {}
inline qargb8555(quint32 v);
@@ -659,8 +666,8 @@ public:
inline quint8 alpha() const { return data[0]; }
inline qargb8555 truncedAlpha() { data[0] &= 0xf8; return *this; }
- static inline quint8 alpha(quint8 a) { return (a + 1) >> 3; }
- static inline quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
+ Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
+ Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
inline qargb8555 operator+(qargb8555 v) const;
inline qargb8555 byte_mul(quint8 a) const;
@@ -677,7 +684,7 @@ private:
class qrgb555
{
public:
- static inline bool hasAlpha() { return false; }
+ Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
inline qrgb555(int v = 0) : data(v) {}
@@ -726,8 +733,8 @@ public:
inline quint8 alpha() const { return 0xff; }
inline qrgb555 truncedAlpha() { return *this; }
- static inline quint8 alpha(quint8 a) { return (a + 1) >> 3; }
- static inline quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
+ Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; }
+ Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); }
inline bool operator==(const qrgb555 &v) const { return v.data == data; }
inline bool operator!=(const qrgb555 &v) const { return v.data != data; }
@@ -875,7 +882,7 @@ class qrgb666;
class qargb6666
{
public:
- static inline bool hasAlpha() { return true; }
+ Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
inline qargb6666() {}
inline qargb6666(quint32 v) { *this = qargb6666(quint32p(v)); }
@@ -887,8 +894,8 @@ public:
inline quint8 alpha() const;
inline qargb6666 truncedAlpha() { return *this; }
- static inline quint8 alpha(quint8 a) { return (a + 1) >> 2; }
- static inline quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }
+ Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 2; }
+ Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }
inline qargb6666 byte_mul(quint8 a) const;
inline qargb6666 operator+(qargb6666 v) const;
@@ -905,7 +912,7 @@ private:
class qrgb666
{
public:
- static inline bool hasAlpha() { return false; }
+ Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
inline qrgb666() {}
inline qrgb666(quint32 v);
@@ -915,8 +922,8 @@ public:
inline quint8 alpha() const { return 0xff; }
inline qrgb666 truncedAlpha() { return *this; }
- static inline quint8 alpha(quint8 a) { return (a + 1) >> 2; }
- static inline quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }
+ Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 2; }
+ Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }
inline qrgb666 operator+(qrgb666 v) const;
inline qrgb666 byte_mul(quint8 a) const;
@@ -1073,7 +1080,7 @@ quint32 qargb6666::rawValue() const
class qrgb888
{
public:
- static inline bool hasAlpha() { return false; }
+ Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
inline qrgb888() {}
inline qrgb888(quint32 v);
@@ -1082,8 +1089,8 @@ public:
inline quint8 alpha() const { return 0xff; }
inline qrgb888 truncedAlpha() { return *this; }
- static inline quint8 alpha(quint8 a) { return a; }
- static inline quint8 ialpha(quint8 a) { return 255 - a; }
+ Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return a; }
+ Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 255 - a; }
inline qrgb888 byte_mul(quint8 a) const;
inline qrgb888 operator+(qrgb888 v) const;
@@ -1262,7 +1269,7 @@ class qrgb444;
class qargb4444
{
public:
- static inline bool hasAlpha() { return true; }
+ Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
inline qargb4444() {}
inline qargb4444(quint32 v) { *this = qargb4444(quint32p(v)); }
@@ -1276,8 +1283,8 @@ public:
inline quint8 alpha() const { return ((data & 0xf000) >> 8) | ((data & 0xf000) >> 12); }
inline qargb4444 truncedAlpha() { return *this; }
- static inline quint8 alpha(quint8 a) { return (a + 1) >> 4; }
- static inline quint8 ialpha(quint8 a) { return 0x10 - alpha(a); }
+ Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 4; }
+ Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x10 - alpha(a); }
inline qargb4444 byte_mul(quint8 a) const;
inline bool operator==(const qargb4444 &v) const { return data == v.data; }
@@ -1293,7 +1300,7 @@ private:
class qrgb444
{
public:
- static inline bool hasAlpha() { return false; }
+ Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
inline qrgb444() {}
inline qrgb444(quint32 v);
@@ -1305,8 +1312,8 @@ public:
inline qrgb444 operator+(qrgb444 v) const;
inline quint8 alpha() const { return 0xff; }
inline qrgb444 truncedAlpha() { return *this; }
- static inline quint8 alpha(quint8 a) { return (a + 1) >> 4; }
- static inline quint8 ialpha(quint8 a) { return 0x10 - alpha(a); }
+ Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 4; }
+ Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x10 - alpha(a); }
inline qrgb444 byte_mul(quint8 a) const;
inline bool operator==(const qrgb444 &v) const { return data == v.data; }
@@ -1767,7 +1774,14 @@ do { \
} \
} while (0)
+#if defined(Q_CC_RVCT)
+# pragma push
+# pragma arm
+#endif
Q_STATIC_INLINE_FUNCTION int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
+#if defined(Q_CC_RVCT)
+# pragma pop
+#endif
inline ushort qConvertRgb32To16(uint c)
{
@@ -1810,7 +1824,7 @@ inline int qBlue565(quint16 rgb) {
}
#if 1
-static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
+Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
t >>= 8;
t &= 0xff00ff;
@@ -1821,7 +1835,11 @@ static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
return x;
}
-static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
+#if defined(Q_CC_RVCT)
+# pragma push
+# pragma arm
+#endif
+Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
t &= 0xff00ff;
@@ -1832,9 +1850,12 @@ static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
x |= t;
return x;
}
+#if defined(Q_CC_RVCT)
+# pragma pop
+#endif
#else
// possible implementation for 64 bit
-static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
+Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
t >>= 8;
@@ -1842,7 +1863,7 @@ static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
return (uint(t)) | (uint(t >> 24));
}
-static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
+Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080);
@@ -1857,7 +1878,7 @@ Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
return (uint(t)) | (uint(t >> 24));
}
-static inline uint PREMUL(uint x) {
+Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
uint a = x >> 24;
ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080);
diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp
index 7b1f637..7248d27 100644
--- a/src/gui/painting/qgraphicssystem.cpp
+++ b/src/gui/painting/qgraphicssystem.cpp
@@ -44,7 +44,7 @@
#ifdef Q_WS_X11
# include <private/qpixmap_x11_p.h>
#endif
-#ifdef Q_WS_WIN
+#if defined(Q_WS_WIN) || defined(Q_WS_S60)
# include <private/qpixmap_raster_p.h>
#endif
#ifdef Q_WS_MAC
@@ -64,7 +64,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ
#endif
#if defined(Q_WS_X11)
return new QX11PixmapData(type);
-#elif defined(Q_WS_WIN)
+#elif defined(Q_WS_WIN) || defined(Q_WS_S60)
return new QRasterPixmapData(type);
#elif defined(Q_WS_MAC)
return new QMacPixmapData(type);
diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp
index d6afa53..99158c8 100644
--- a/src/gui/painting/qgraphicssystemfactory.cpp
+++ b/src/gui/painting/qgraphicssystemfactory.cpp
@@ -64,7 +64,7 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key)
if (system.isEmpty()) {
system = QLatin1String("opengl");
}
-#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN)
+#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_WS_S60)
if (system.isEmpty()) {
system = QLatin1String("raster");
}
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 73e50da..b057b5f 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -158,7 +158,12 @@
#include <private/qrasterdefs_p.h>
#include <private/qgrayraster_p.h>
+// Bug in stdlib.h, see more information from fixed_stdlib.h
+#if (defined __SYMBIAN32__ && !defined __cplusplus)
+#include <fixed_stdlib.h>
+#else
#include <stdlib.h>
+#endif // defined __SYMBIAN32__ && !defined __cplusplus
#include <stdio.h>
/* This macro is used to indicate that a function parameter is unused. */
diff --git a/src/gui/painting/qpaintdevice_s60.cpp b/src/gui/painting/qpaintdevice_s60.cpp
new file mode 100644
index 0000000..ec1b765
--- /dev/null
+++ b/src/gui/painting/qpaintdevice_s60.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_EMBEDDED_LICENSE$
+**
+****************************************************************************/
+
+#include "qpaintdevice.h"
+#include "qpainter.h"
+#include "qwidget.h"
+#include "qbitmap.h"
+#include "qapplication.h"
+#include <private/qapplication_p.h>
+#include "qprinter.h"
+
+QT_BEGIN_NAMESPACE
+
+QPaintDevice::QPaintDevice()
+{
+ painters = 0;
+}
+
+
+QPaintDevice::~QPaintDevice()
+{
+ if (paintingActive())
+ qWarning("QPaintDevice: Cannot destroy paint device that is being "
+ "painted. Be sure to QPainter::end() painters!");
+}
+
+int QPaintDevice::metric(PaintDeviceMetric) const
+{
+ qWarning("QPaintDevice::metrics: Device has no metric information");
+ return 0;
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 847904b..1192a58 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -91,6 +91,8 @@
# include <private/qfontengine_qpf_p.h>
# endif
# include <private/qabstractfontengine_p.h>
+#elif defined(Q_WS_S60) && defined(QT_NO_FREETYPE)
+# include <private/qfontengine_s60_p.h>
#endif
#if defined(Q_WS_WIN64)
@@ -3186,7 +3188,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
ensurePen();
ensureState();
-#if defined (Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined (Q_WS_WIN) || defined(Q_WS_MAC) || (defined(Q_WS_S60) && defined(QT_NO_FREETYPE))
bool drawCached = true;
@@ -3219,7 +3221,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
return;
}
-#else // Q_WS_WIN || Q_WS_MAC
+#else // Q_WS_WIN || Q_WS_MAC || Q_WS_S60 && QT_NO_FREETYPE
QFontEngine *fontEngine = ti.fontEngine;
@@ -3239,7 +3241,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
}
#endif // Q_WS_QWS
-#if (defined(Q_WS_X11) || defined(Q_WS_QWS)) && !defined(QT_NO_FREETYPE)
+#if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_S60)) && !defined(QT_NO_FREETYPE)
#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2)
if (fontEngine->type() == QFontEngine::QPF2) {
@@ -4195,8 +4197,14 @@ int QCustomRasterPaintDevice::bytesPerLine() const
{
return (width() * depth() + 7) / 8;
}
-#endif // Q_WS_QWS
+#elif defined(Q_WS_S60)
+
+void QRasterBuffer::prepareBuffer(int width, int height)
+{
+}
+
+#endif // Q_WS_S60
/*!
\class QCustomRasterPaintDevice
diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h
index 981ca84..8e14eb5 100644
--- a/src/gui/painting/qpathclipper_p.h
+++ b/src/gui/painting/qpathclipper_p.h
@@ -160,8 +160,6 @@ public:
Direction directionTo(int vertex) const;
int vertex(Direction direction) const;
- bool isBezier() const;
-
private:
int m_next[2][2];
};
@@ -347,11 +345,6 @@ inline int QPathEdge::vertex(Direction direction) const
return direction == Backward ? first : second;
}
-inline bool QPathEdge::isBezier() const
-{
- return bezier >= 0;
-}
-
inline QPathVertex::QPathVertex(const QPointF &p, int e)
: edge(e)
, x(p.x())
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index c090877..f67b2b7 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -59,7 +59,7 @@ QT_MODULE(Gui)
template <class T> class QVector;
class QVariant;
-#if defined(Q_WS_QWS) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_WS_QWS) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
struct QRegionPrivate;
#endif
@@ -199,7 +199,7 @@ private:
#elif defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
mutable RgnHandle unused; // Here for binary compatability reasons. ### Qt 5 remove.
#endif
-#if defined(Q_WS_QWS) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_OS_WINCE)
+#if defined(Q_WS_QWS) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
QRegionPrivate *qt_rgn;
#endif
};
diff --git a/src/gui/painting/qregion_s60.cpp b/src/gui/painting/qregion_s60.cpp
new file mode 100644
index 0000000..4504118
--- /dev/null
+++ b/src/gui/painting/qregion_s60.cpp
@@ -0,0 +1,22 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_EMBEDDED_LICENSE$
+**
+****************************************************************************/
+
+#include "qbitmap.h"
+#include "qbuffer.h"
+#include "qimage.h"
+#include "qpolygon.h"
+#include "qregion.h"
+
+QT_BEGIN_NAMESPACE
+
+QRegion::QRegionData QRegion::shared_empty = { Q_BASIC_ATOMIC_INITIALIZER(1), 0 };
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qtessellator.cpp b/src/gui/painting/qtessellator.cpp
index e02f02d..a3f00e2 100644
--- a/src/gui/painting/qtessellator.cpp
+++ b/src/gui/painting/qtessellator.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
#ifdef DEBUG
#define QDEBUG qDebug
#else
-#define QDEBUG if (1); else qDebug
+#define QDEBUG if (1){} else qDebug
#endif
static const bool emit_clever = true;
@@ -703,7 +703,6 @@ struct QCoincidingEdge {
}
};
-
static void cancelEdges(QCoincidingEdge &e1, QCoincidingEdge &e2)
{
if (e1.before) {
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
new file mode 100644
index 0000000..2618ce2
--- /dev/null
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_EMBEDDED_LICENSE$
+**
+****************************************************************************/
+
+#include <qglobal.h> // for Q_WS_WIN define (non-PCH)
+
+#include <QtGui/qpaintdevice.h>
+#include <private/qwidget_p.h>
+#include "qwindowsurface_s60_p.h"
+#include "qt_s60_p.h"
+#include "private/qdrawhelper_p.h"
+
+QT_BEGIN_NAMESPACE
+
+struct QS60WindowSurfacePrivate
+{
+ QImage device;
+ CFbsBitmap *bitmap;
+ uchar* bytes;
+
+ // Since only one CFbsBitmap is allowed to be locked at a time, this is static.
+ static QS60WindowSurface* lockedSurface;
+};
+QS60WindowSurface* QS60WindowSurfacePrivate::lockedSurface = NULL;
+
+QS60WindowSurface::QS60WindowSurface(QWidget* widget)
+ : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
+{
+ d_ptr->bytes = 0;
+ d_ptr->bitmap = 0;
+
+ TDisplayMode mode = S60->screenDevice()->DisplayMode();
+ bool isOpaque = qt_widget_private(widget)->isOpaque;
+ if (mode == EColor16MA && isOpaque)
+ mode = EColor16MU; // Faster since 16MU -> 16MA is typically accelerated
+ else if (mode == EColor16MU && !isOpaque)
+ mode = EColor16MA; // Try for transparency anyway
+
+
+ // We create empty CFbsBitmap here -> it will be resized in setGeometry
+ d_ptr->bitmap = new (ELeave) CFbsBitmap;
+ User::LeaveIfError( d_ptr->bitmap->Create(TSize(0, 0), mode ) );
+
+ updatePaintDeviceOnBitmap();
+
+ setStaticContentsSupport(true);
+}
+
+QS60WindowSurface::~QS60WindowSurface()
+{
+ // Ensure that locking and unlocking of this surface were symmetrical
+ Q_ASSERT(QS60WindowSurfacePrivate::lockedSurface != this);
+
+ delete d_ptr->bitmap;
+ delete d_ptr;
+}
+
+void QS60WindowSurface::beginPaint(const QRegion &rgn)
+{
+ if(!d_ptr->bitmap)
+ return;
+
+ Q_ASSERT(!QS60WindowSurfacePrivate::lockedSurface);
+ QS60WindowSurfacePrivate::lockedSurface = this;
+ lockBitmapHeap();
+
+ if (!qt_widget_private(window())->isOpaque) {
+ QRgb *data = reinterpret_cast<QRgb *>(d_ptr->device.bits());
+ const int row_stride = d_ptr->device.bytesPerLine() / 4;
+
+ const QVector<QRect> rects = rgn.rects();
+ for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
+ const int x_start = it->x();
+ const int width = it->width();
+
+ const int y_start = it->y();
+ const int height = it->height();
+
+ QRgb *row = data + row_stride * y_start;
+ for (int y = 0; y < height; ++y) {
+ qt_memfill(row + x_start, 0U, width);
+ row += row_stride;
+ }
+ }
+ }
+}
+
+void QS60WindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &)
+{
+ const QVector<QRect> subRects = region.rects();
+ for (int i = 0; i < subRects.count(); ++i) {
+ TRect tr = qt_QRect2TRect(subRects[i]);
+ widget->winId()->DrawNow(tr);
+ }
+}
+
+bool QS60WindowSurface::scroll(const QRegion &area, int dx, int dy)
+{
+ QRect rect = area.boundingRect();
+
+ if (dx == 0 && dy == 0)
+ return false;
+
+ if (d_ptr->device.isNull())
+ return false;
+
+ CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(d_ptr->bitmap);
+ CBitmapContext *bitmapContext;
+ TInt err = bitmapDevice->CreateBitmapContext(bitmapContext);
+ if (err != KErrNone) {
+ CBase::Delete(bitmapDevice);
+ return false;
+ }
+ bitmapContext->CopyRect(TPoint(dx, dy), qt_QRect2TRect(rect));
+ CBase::Delete(bitmapContext);
+ CBase::Delete(bitmapDevice);
+ return true;
+}
+
+void QS60WindowSurface::endPaint(const QRegion &rgn)
+{
+ if(!d_ptr->bitmap)
+ return;
+
+ Q_ASSERT(QS60WindowSurfacePrivate::lockedSurface);
+ unlockBitmapHeap();
+ QS60WindowSurfacePrivate::lockedSurface = NULL;
+}
+
+QPaintDevice* QS60WindowSurface::paintDevice()
+{
+ return &d_ptr->device;
+}
+
+void QS60WindowSurface::setGeometry(const QRect& rect)
+{
+ if (rect == geometry())
+ return;
+
+ QWindowSurface::setGeometry(rect);
+
+ TRect nativeRect(qt_QRect2TRect(rect));
+ User::LeaveIfError(d_ptr->bitmap->Resize(nativeRect.Size()));
+
+ if (!rect.isNull())
+ updatePaintDeviceOnBitmap();
+}
+
+void QS60WindowSurface::lockBitmapHeap()
+{
+ if (!QS60WindowSurfacePrivate::lockedSurface)
+ return;
+
+ // Get some local variables to make later code lines more clear to read
+ CFbsBitmap*& bitmap = QS60WindowSurfacePrivate::lockedSurface->d_ptr->bitmap;
+ QImage& device = QS60WindowSurfacePrivate::lockedSurface->d_ptr->device;
+ uchar*& bytes = QS60WindowSurfacePrivate::lockedSurface->d_ptr->bytes;
+
+ bitmap->LockHeap();
+ uchar *newBytes = (uchar*)bitmap->DataAddress();
+ if (newBytes != bytes) {
+ bytes = newBytes;
+
+ // Get some values for QImage creation
+ TDisplayMode mode = bitmap->DisplayMode();
+ if (mode == EColor16MA
+ && qt_widget_private(QS60WindowSurfacePrivate::lockedSurface->window())->isOpaque)
+ mode = EColor16MU;
+ QImage::Format format = qt_TDisplayMode2Format( mode );
+ TSize bitmapSize = bitmap->SizeInPixels();
+ int bytesPerLine = CFbsBitmap::ScanLineLength( bitmapSize.iWidth, mode);
+
+ device = QImage( bytes, bitmapSize.iWidth, bitmapSize.iHeight, bytesPerLine, format );
+ }
+}
+
+void QS60WindowSurface::unlockBitmapHeap()
+{
+ if (!QS60WindowSurfacePrivate::lockedSurface)
+ return;
+
+ QS60WindowSurfacePrivate::lockedSurface->d_ptr->bitmap->UnlockHeap();
+}
+
+void QS60WindowSurface::updatePaintDeviceOnBitmap()
+{
+ // This forces the actual device to be updated based on CFbsBitmap
+ beginPaint(QRegion());
+ endPaint(QRegion());
+}
+
+CFbsBitmap *QS60WindowSurface::symbianBitmap() const
+{
+ return d_ptr->bitmap;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qwindowsurface_s60_p.h
new file mode 100644
index 0000000..7b70fd5
--- /dev/null
+++ b/src/gui/painting/qwindowsurface_s60_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_EMBEDDED_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSURFACE_S60_P_H
+#define QWINDOWSURFACE_S60_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qglobal.h>
+#include "private/qwindowsurface_p.h"
+
+class CFbsBitmap;
+
+QT_BEGIN_NAMESPACE
+
+struct QS60WindowSurfacePrivate;
+
+class QS60WindowSurface : public QWindowSurface
+{
+public:
+ QS60WindowSurface(QWidget *widget);
+ ~QS60WindowSurface();
+
+ QPaintDevice *paintDevice();
+ void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
+ bool scroll(const QRegion &area, int dx, int dy);
+
+ void beginPaint(const QRegion &);
+ void endPaint(const QRegion &);
+
+ void setGeometry(const QRect &rect);
+
+ static void lockBitmapHeap();
+ static void unlockBitmapHeap();
+
+ CFbsBitmap *symbianBitmap() const;
+
+private:
+ void updatePaintDeviceOnBitmap();
+
+private:
+ QS60WindowSurfacePrivate* d_ptr;
+
+};
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWSURFACE_S60_P_H