summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-04-17 12:58:41 +0200
committerLars Knoll <lars.knoll@nokia.com>2012-04-17 12:58:52 +0200
commit64255ef6502b1144f7b0aa4b2bf62803e0d4788b (patch)
tree29bf116bfda2ccf61057115690d14f85cc9b085b /src/gui
parent4a9fb41a7947d0bb7a47a9625603a436df288b24 (diff)
parent7e0beba891cb963a1d535bd45b0be78b43b8d07f (diff)
Merge remote-tracking branch 'origin/api_changes'
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.h4
-rw-r--r--src/gui/accessible/qaccessible2.h2
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp4
-rw-r--r--src/gui/gui.pro54
-rw-r--r--src/gui/image/qmovie.h2
-rw-r--r--src/gui/image/qpicture.cpp28
-rw-r--r--src/gui/image/qpicture.h1
-rw-r--r--src/gui/image/qpixmap.h4
-rw-r--r--src/gui/image/qpnghandler.cpp4
-rw-r--r--src/gui/kernel/qclipboard.h2
-rw-r--r--src/gui/kernel/qevent.cpp118
-rw-r--r--src/gui/kernel/qevent.h49
-rw-r--r--src/gui/kernel/qevent_p.h20
-rw-r--r--src/gui/kernel/qguiapplication.cpp55
-rw-r--r--src/gui/kernel/qguiapplication.h2
-rw-r--r--src/gui/kernel/qguiapplication_p.h3
-rw-r--r--src/gui/kernel/qguivariant.cpp49
-rw-r--r--src/gui/kernel/qkeysequence.cpp10
-rw-r--r--src/gui/kernel/qkeysequence.h4
-rw-r--r--src/gui/kernel/qopenglcontext.cpp13
-rw-r--r--src/gui/kernel/qopenglcontext.h4
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache_qpa.h2
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.h2
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp6
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h2
-rw-r--r--src/gui/kernel/qscreen.cpp12
-rw-r--r--src/gui/kernel/qscreen.h14
-rw-r--r--src/gui/kernel/qsurface.h2
-rw-r--r--src/gui/kernel/qsurfaceformat.h2
-rw-r--r--src/gui/kernel/qwindow.cpp36
-rw-r--r--src/gui/kernel/qwindow.h9
-rw-r--r--src/gui/kernel/qwindow_p.h5
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp22
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h6
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h24
-rw-r--r--src/gui/math3d/qgenericmatrix.h2
-rw-r--r--src/gui/math3d/qmatrix4x4.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.h2
-rw-r--r--src/gui/opengl/qopenglfunctions.h2
-rw-r--r--src/gui/opengl/qopenglpaintdevice.h2
-rw-r--r--src/gui/painting/painting.pri6
-rw-r--r--src/gui/painting/qbackingstore.cpp4
-rw-r--r--src/gui/painting/qbackingstore.h2
-rw-r--r--src/gui/painting/qdatabuffer_p.h12
-rw-r--r--src/gui/painting/qdrawhelper.cpp99
-rw-r--r--src/gui/painting/qdrawhelper_mmx.cpp155
-rw-r--r--src/gui/painting/qdrawhelper_mmx3dnow.cpp128
-rw-r--r--src/gui/painting/qdrawhelper_mmx_p.h892
-rw-r--r--src/gui/painting/qdrawhelper_sse.cpp168
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp4
-rw-r--r--src/gui/painting/qdrawhelper_sse3dnow.cpp143
-rw-r--r--src/gui/painting/qdrawhelper_x86_p.h52
-rw-r--r--src/gui/painting/qpaintbuffer.cpp54
-rw-r--r--src/gui/painting/qpaintbuffer_p.h35
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp48
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h7
-rw-r--r--src/gui/painting/qpaintengineex_p.h71
-rw-r--r--src/gui/painting/qpainter.cpp30
-rw-r--r--src/gui/painting/qpainter.h1
-rw-r--r--src/gui/painting/qpdfwriter.h4
-rw-r--r--src/gui/painting/qplatformbackingstore_qpa.h2
-rw-r--r--src/gui/painting/qpolygon.h10
-rw-r--r--src/gui/painting/qvectorpath_p.h11
-rw-r--r--src/gui/text/qfont.h4
-rw-r--r--src/gui/text/qfontengine_qpa.cpp2
-rw-r--r--src/gui/text/qfontengine_qpf.cpp2
-rw-r--r--src/gui/text/qfontenginedirectwrite.cpp4
-rw-r--r--src/gui/text/qfontmetrics.cpp14
-rw-r--r--src/gui/text/qglyphrun.cpp4
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qsyntaxhighlighter.h4
-rw-r--r--src/gui/text/qtextdocumentwriter.h2
-rw-r--r--src/gui/text/qtextengine.cpp2
-rw-r--r--src/gui/text/qtextimagehandler.cpp4
-rw-r--r--src/gui/text/qtextlayout.cpp2
-rw-r--r--src/gui/text/qtextodfwriter.cpp2
-rw-r--r--src/gui/text/qtextoption.h2
-rw-r--r--src/gui/util/qvalidator.h2
78 files changed, 331 insertions, 2245 deletions
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 91726f194b..180ab61ef9 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -51,6 +51,8 @@
#include <QtGui/qcolor.h>
#include <QtGui/qevent.h>
+#include <stdlib.h>
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -216,7 +218,7 @@ public:
// quint64 alertHigh : 1;
State() {
- qMemSet(this, 0, sizeof(State));
+ memset(this, 0, sizeof(State));
}
};
diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h
index 8497d35e2a..dcac22e5bb 100644
--- a/src/gui/accessible/qaccessible2.h
+++ b/src/gui/accessible/qaccessible2.h
@@ -109,7 +109,7 @@ public:
class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface
{
public:
- QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); //###
+ explicit QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); //###
void copyText(int startOffset, int endOffset) const;
void deleteText(int startOffset, int endOffset);
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index d3344c3a3a..db4ee242ff 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -78,10 +78,10 @@ QList<QByteArray> QAccessibleObjectPrivate::actionList() const
continue;
if (!qstrcmp(member.tag(), "QACCESSIBLE_SLOT")) {
- if (member.signature() == defaultAction)
+ if (member.methodSignature() == defaultAction)
actionList.prepend(defaultAction);
else
- actionList << member.signature();
+ actionList << member.methodSignature();
}
}
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 1fb3790254..93c087cf64 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -35,8 +35,6 @@ include(animation/animation.pri)
QMAKE_LIBS += $$QMAKE_LIBS_GUI
-DEFINES += Q_INTERNAL_QAPP_SRC
-
neon:*-g++* {
DEFINES += QT_HAVE_NEON
HEADERS += $$NEON_HEADERS
@@ -59,54 +57,6 @@ win32:!contains(QT_CONFIG, directwrite) {
}
win32-g++*|!win32:!win32-icc*:!macx-icc* {
- mmx {
- mmx_compiler.commands = $$QMAKE_CXX -c -Winline
- mmx_compiler.commands += -mmmx
- mmx_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
- mmx_compiler.dependency_type = TYPE_C
- mmx_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
- mmx_compiler.input = MMX_SOURCES
- mmx_compiler.variable_out = OBJECTS
- mmx_compiler.name = compiling[mmx] ${QMAKE_FILE_IN}
- silent:mmx_compiler.commands = @echo compiling[mmx] ${QMAKE_FILE_IN} && $$mmx_compiler.commands
- QMAKE_EXTRA_COMPILERS += mmx_compiler
- }
- 3dnow {
- mmx3dnow_compiler.commands = $$QMAKE_CXX -c -Winline
- mmx3dnow_compiler.commands += -m3dnow -mmmx
- mmx3dnow_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
- mmx3dnow_compiler.dependency_type = TYPE_C
- mmx3dnow_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
- mmx3dnow_compiler.input = MMX3DNOW_SOURCES
- mmx3dnow_compiler.variable_out = OBJECTS
- mmx3dnow_compiler.name = compiling[mmx3dnow] ${QMAKE_FILE_IN}
- silent:mmx3dnow_compiler.commands = @echo compiling[mmx3dnow] ${QMAKE_FILE_IN} && $$mmx3dnow_compiler.commands
- QMAKE_EXTRA_COMPILERS += mmx3dnow_compiler
- sse {
- sse3dnow_compiler.commands = $$QMAKE_CXX -c -Winline
- sse3dnow_compiler.commands += -m3dnow -msse
- sse3dnow_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
- sse3dnow_compiler.dependency_type = TYPE_C
- sse3dnow_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
- sse3dnow_compiler.input = SSE3DNOW_SOURCES
- sse3dnow_compiler.variable_out = OBJECTS
- sse3dnow_compiler.name = compiling[sse3dnow] ${QMAKE_FILE_IN}
- silent:sse3dnow_compiler.commands = @echo compiling[sse3dnow] ${QMAKE_FILE_IN} && $$sse3dnow_compiler.commands
- QMAKE_EXTRA_COMPILERS += sse3dnow_compiler
- }
- }
- sse {
- sse_compiler.commands = $$QMAKE_CXX -c -Winline
- sse_compiler.commands += -msse
- sse_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
- sse_compiler.dependency_type = TYPE_C
- sse_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
- sse_compiler.input = SSE_SOURCES
- sse_compiler.variable_out = OBJECTS
- sse_compiler.name = compiling[sse] ${QMAKE_FILE_IN}
- silent:sse_compiler.commands = @echo compiling[sse] ${QMAKE_FILE_IN} && $$sse_compiler.commands
- QMAKE_EXTRA_COMPILERS += sse_compiler
- }
sse2 {
sse2_compiler.commands = $$QMAKE_CXX -c -Winline
sse2_compiler.commands += -msse2
@@ -144,10 +94,6 @@ win32:!contains(QT_CONFIG, directwrite) {
QMAKE_EXTRA_COMPILERS += iwmmxt_compiler
}
} else {
- mmx: SOURCES += $$MMX_SOURCES
- 3dnow: SOURCES += $$MMX3DNOW_SOURCES
- 3dnow:sse: SOURCES += $$SSE3DNOW_SOURCES
- sse: SOURCES += $$SSE_SOURCES
sse2: SOURCES += $$SSE2_SOURCES
ssse3: SOURCES += $$SSSE3_SOURCES
iwmmxt: SOURCES += $$IWMMXT_SOURCES
diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h
index 9d4cb87b15..e11dea6ad3 100644
--- a/src/gui/image/qmovie.h
+++ b/src/gui/image/qmovie.h
@@ -83,7 +83,7 @@ public:
CacheAll
};
- QMovie(QObject *parent = 0);
+ explicit QMovie(QObject *parent = 0);
explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = 0);
explicit QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = 0);
~QMovie();
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index 089cc5011c..8bb9f211e8 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -828,26 +828,6 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
}
painter->setBrush(brush);
break;
-// #ifdef Q_Q3PAINTER
-// case QPicturePrivate::PdcSetTabStops:
-// s >> i_16;
-// painter->setTabStops(i_16);
-// break;
-// case QPicturePrivate::PdcSetTabArray:
-// s >> i_16;
-// if (i_16 == 0) {
-// painter->setTabArray(0);
-// } else {
-// int *ta = new int[i_16];
-// for (int i=0; i<i_16; i++) {
-// s >> i1_16;
-// ta[i] = i1_16;
-// }
-// painter->setTabArray(ta);
-// delete [] ta;
-// }
-// break;
-// #endif
case QPicturePrivate::PdcSetVXform:
s >> i_8;
painter->setViewTransformEnabled(i_8);
@@ -884,14 +864,6 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
// i_8 is always false due to updateXForm() in qpaintengine_pic.cpp
painter->setTransform(matrix * worldMatrix, i_8);
break;
-// #ifdef Q_Q3PAINTER
-// case QPicturePrivate::PdcSaveWMatrix:
-// painter->saveWorldMatrix();
-// break;
-// case QPicturePrivate::PdcRestoreWMatrix:
-// painter->restoreWorldMatrix();
-// break;
-// #endif
case QPicturePrivate::PdcSetClip:
s >> i_8;
painter->setClipping(i_8);
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index c3dbab25c5..b94171abf8 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -109,7 +109,6 @@ private:
QExplicitlySharedDataPointer<QPicturePrivate> d_ptr;
friend class QPicturePaintEngine;
- friend class Q3Picture;
friend class QAlphaPaintEngine;
friend class QPreviewPaintEngine;
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 3d78a43917..0b21be5c8e 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -67,10 +67,10 @@ public:
QPixmap();
explicit QPixmap(QPlatformPixmap *data);
QPixmap(int w, int h);
- QPixmap(const QSize &);
+ explicit QPixmap(const QSize &);
QPixmap(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
#ifndef QT_NO_IMAGEFORMAT_XPM
- QPixmap(const char * const xpm[]);
+ explicit QPixmap(const char * const xpm[]);
#endif
QPixmap(const QPixmap &);
~QPixmap();
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 7acad067b5..c3ae0a41da 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -184,7 +184,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz
if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && (in->size() - in->pos()) < 4 && length == 4) {
// Workaround for certain malformed PNGs that lack the final crc bytes
uchar endcrc[4] = { 0xae, 0x42, 0x60, 0x82 };
- qMemCopy(data, endcrc, 4);
+ memcpy(data, endcrc, 4);
in->seek(in->size());
return;
}
@@ -664,7 +664,7 @@ static void set_text(const QImage &image, png_structp png_ptr, png_infop info_pt
return;
png_textp text_ptr = new png_text[text.size()];
- qMemSet(text_ptr, 0, text.size() * sizeof(png_text));
+ memset(text_ptr, 0, text.size() * sizeof(png_text));
QMap<QString, QString>::ConstIterator it = text.constBegin();
int i = 0;
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index 5a251dd0ef..5c88764d88 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -59,7 +59,7 @@ class Q_GUI_EXPORT QClipboard : public QObject
{
Q_OBJECT
private:
- QClipboard(QObject *parent);
+ explicit QClipboard(QObject *parent);
~QClipboard();
public:
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 436ed56ea0..505e89b44d 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -717,11 +717,41 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
*/
QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text,
bool autorep, ushort count)
- : QInputEvent(type, modifiers), txt(text), k(key), c(count), autor(autorep)
+ : QInputEvent(type, modifiers), txt(text), k(key),
+ nScanCode(0), nVirtualKey(0), nModifiers(0),
+ c(count), autor(autorep)
{
}
/*!
+ Constructs a key event object.
+
+ The \a type parameter must be QEvent::KeyPress, QEvent::KeyRelease,
+ or QEvent::ShortcutOverride.
+
+ Int \a key is the code for the Qt::Key that the event loop should listen
+ for. If \a key is 0, the event is not a result of a known key; for
+ example, it may be the result of a compose sequence or keyboard macro.
+ The \a modifiers holds the keyboard modifiers, and the given \a text
+ is the Unicode text that the key generated. If \a autorep is true,
+ isAutoRepeat() will be true. \a count is the number of keys involved
+ in the event.
+
+ In addition to the normal key event data, also contains \a nativeScanCode,
+ \a nativeVirtualKey and \a nativeModifiers. This extra data is used by the
+ shortcut system, to determine which shortcuts to trigger.
+*/
+QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
+ quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
+ const QString &text, bool autorep, ushort count)
+ : QInputEvent(type, modifiers), txt(text), k(key),
+ nScanCode(nativeScanCode), nVirtualKey(nativeVirtualKey), nModifiers(nativeModifiers),
+ c(count), autor(autorep)
+{
+}
+
+
+/*!
\internal
*/
QKeyEvent::~QKeyEvent()
@@ -729,16 +759,9 @@ QKeyEvent::~QKeyEvent()
}
/*!
+ \fn QKeyEvent *QKeyEvent::createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text, bool autorep, ushort count)
\internal
*/
-QKeyEvent *QKeyEvent::createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
- quint32 nativeScanCode, quint32 nativeVirtualKey,
- quint32 nativeModifiers,
- const QString& text, bool autorep, ushort count)
-{
- return new QKeyEventEx(type, key, modifiers, text, autorep, count,
- nativeScanCode, nativeVirtualKey, nativeModifiers);
-}
/*!
\fn bool QKeyEvent::hasExtendedInfo() const
@@ -746,6 +769,7 @@ QKeyEvent *QKeyEvent::createExtendedKeyEvent(Type type, int key, Qt::KeyboardMod
*/
/*!
+ \fn quint32 QKeyEvent::nativeScanCode() const
\since 4.2
Returns the native scan code of the key event. If the key event
@@ -758,13 +782,9 @@ QKeyEvent *QKeyEvent::createExtendedKeyEvent(Type type, int key, Qt::KeyboardMod
way to get the scan code from Carbon or Cocoa. The function always
returns 1 (or 0 in the case explained above).
*/
-quint32 QKeyEvent::nativeScanCode() const
-{
- return (reinterpret_cast<const QKeyEvent*>(d) != this
- ? 0 : reinterpret_cast<const QKeyEventEx*>(this)->nScanCode);
-}
/*!
+ \fn quint32 QKeyEvent::nativeVirtualKey() const
\since 4.2
Returns the native virtual key, or key sym of the key event.
@@ -772,13 +792,9 @@ quint32 QKeyEvent::nativeScanCode() const
Note: The native virtual key may be 0, even if the key event contains extended information.
*/
-quint32 QKeyEvent::nativeVirtualKey() const
-{
- return (reinterpret_cast<const QKeyEvent*>(d) != this
- ? 0 : reinterpret_cast<const QKeyEventEx*>(this)->nVirtualKey);
-}
/*!
+ \fn quint32 QKeyEvent::nativeModifiers() const
\since 4.2
Returns the native modifiers of a key event.
@@ -786,44 +802,6 @@ quint32 QKeyEvent::nativeVirtualKey() const
Note: The native modifiers may be 0, even if the key event contains extended information.
*/
-quint32 QKeyEvent::nativeModifiers() const
-{
- return (reinterpret_cast<const QKeyEvent*>(d) != this
- ? 0 : reinterpret_cast<const QKeyEventEx*>(this)->nModifiers);
-}
-
-/*!
- \internal
- Creates an extended key event object, which in addition to the normal key event data, also
- contains the native scan code, virtual key and modifiers. This extra data is used by the
- shortcut system, to determine which shortcuts to trigger.
-*/
-QKeyEventEx::QKeyEventEx(Type type, int key, Qt::KeyboardModifiers modifiers,
- const QString &text, bool autorep, ushort count,
- quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers)
- : QKeyEvent(type, key, modifiers, text, autorep, count),
- nScanCode(nativeScanCode), nVirtualKey(nativeVirtualKey), nModifiers(nativeModifiers)
-{
- d = reinterpret_cast<QEventPrivate*>(this);
-}
-
-/*!
- \internal
- Creates a copy of an other extended key event.
-*/
-QKeyEventEx::QKeyEventEx(const QKeyEventEx &other)
- : QKeyEvent(QEvent::Type(other.t), other.k, other.modState, other.txt, other.autor, other.c),
- nScanCode(other.nScanCode), nVirtualKey(other.nVirtualKey), nModifiers(other.nModifiers)
-{
- d = reinterpret_cast<QEventPrivate*>(this);
-}
-
-/*!
- \internal
-*/
-QKeyEventEx::~QKeyEventEx()
-{
-}
/*!
\fn int QKeyEvent::key() const
@@ -3627,7 +3605,7 @@ QTouchEvent::TouchPoint::TouchPoint(const QTouchEvent::TouchPoint &other)
*/
QTouchEvent::TouchPoint::~TouchPoint()
{
- if (!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
}
@@ -3869,10 +3847,11 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
}
/*!
+ \since 5.0
Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates.
To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().
- \note Returns an empty list if the touch device's capabilities do not include QTouchDevice::RawPositions.
+ \note Returns an empty vector if the touch device's capabilities do not include QTouchDevice::RawPositions.
\note Native screen coordinates refer to the native orientation of the screen which, in case of
mobile devices, is typically portrait. This means that on systems capable of screen orientation
@@ -3881,7 +3860,7 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
\sa QTouchDevice::capabilities(), device(), window()
*/
-QList<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
+QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
{
return d->rawScreenPositions;
}
@@ -4039,7 +4018,7 @@ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
}
/*! \internal */
-void QTouchEvent::TouchPoint::setRawScreenPositions(const QList<QPointF> &positions)
+void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions)
{
if (d->ref.load() != 1)
d = d->detach();
@@ -4054,16 +4033,15 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
d->flags = flags;
}
-/*! \internal */
-QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
-{
- other.d->ref.ref();
- if (!d->ref.deref())
- delete d;
- d = other.d;
- return *this;
-}
+/*!
+ \fn QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
+ \internal
+ */
+/*!
+ \fn void QTouchEvent::TouchPoint::swap(TouchPoint &other);
+ \internal
+*/
/*!
\class QScrollPrepareEvent
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index a042922f61..7761bab944 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -243,6 +243,9 @@ class Q_GUI_EXPORT QKeyEvent : public QInputEvent
public:
QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
bool autorep = false, ushort count = 1);
+ QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
+ quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
+ const QString &text = QString(), bool autorep = false, ushort count = 1);
~QKeyEvent();
int key() const { return k; }
@@ -254,22 +257,35 @@ public:
inline bool isAutoRepeat() const { return autor; }
inline int count() const { return int(c); }
+ inline quint32 nativeScanCode() const { return nScanCode; }
+ inline quint32 nativeVirtualKey() const { return nVirtualKey; }
+ inline quint32 nativeModifiers() const { return nModifiers; }
+
// Functions for the extended key event information
- static QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
+#if QT_DEPRECATED_SINCE(5, 0)
+ static inline QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
quint32 nativeScanCode, quint32 nativeVirtualKey,
quint32 nativeModifiers,
const QString& text = QString(), bool autorep = false,
- ushort count = 1);
- inline bool hasExtendedInfo() const { return reinterpret_cast<const QKeyEvent*>(d) == this; }
- quint32 nativeScanCode() const;
- quint32 nativeVirtualKey() const;
- quint32 nativeModifiers() const;
+ ushort count = 1)
+ {
+ return new QKeyEvent(type, key, modifiers,
+ nativeScanCode, nativeVirtualKey, nativeModifiers,
+ text, autorep, count);
+ }
+
+ inline bool hasExtendedInfo() const { return true; }
+#endif
protected:
QString txt;
int k;
+ quint32 nScanCode;
+ quint32 nVirtualKey;
+ quint32 nModifiers;
ushort c;
- uint autor:1;
+ ushort autor:1;
+ // ushort reserved:15;
};
@@ -713,9 +729,19 @@ public:
Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
explicit TouchPoint(int id = -1);
- TouchPoint(const QTouchEvent::TouchPoint &other);
+ TouchPoint(const TouchPoint &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ TouchPoint(TouchPoint &&other) : d(other.d) { other.d = 0; }
+ TouchPoint &operator=(TouchPoint &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
~TouchPoint();
+ TouchPoint &operator=(const TouchPoint &other)
+ { if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; }
+
+ void swap(TouchPoint &other) { qSwap(d, other.d); }
+
int id() const;
Qt::TouchPointState state() const;
@@ -743,7 +769,7 @@ public:
qreal pressure() const;
QVector2D velocity() const;
InfoFlags flags() const;
- QList<QPointF> rawScreenPositions() const;
+ QVector<QPointF> rawScreenPositions() const;
// internal
void setId(int id);
@@ -766,8 +792,7 @@ public:
void setPressure(qreal pressure);
void setVelocity(const QVector2D &v);
void setFlags(InfoFlags flags);
- void setRawScreenPositions(const QList<QPointF> &positions);
- QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other);
+ void setRawScreenPositions(const QVector<QPointF> &positions);
private:
QTouchEventTouchPointPrivate *d;
@@ -819,7 +844,7 @@ protected:
friend class QApplication;
friend class QApplicationPrivate;
};
-
+Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE);
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags)
class QScrollPrepareEventPrivate;
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 3f354c14e4..18a13b73f5 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -60,24 +60,6 @@ QT_BEGIN_NAMESPACE
// We mean it.
//
-// ### Qt 5: remove
-class QKeyEventEx : public QKeyEvent
-{
-public:
- QKeyEventEx(Type type, int key, Qt::KeyboardModifiers modifiers,
- const QString &text, bool autorep, ushort count,
- quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers);
- QKeyEventEx(const QKeyEventEx &other);
-
- ~QKeyEventEx();
-
-protected:
- quint32 nScanCode;
- quint32 nVirtualKey;
- quint32 nModifiers;
- friend class QKeyEvent;
-};
-
class QTouchEventTouchPointPrivate
{
public:
@@ -107,7 +89,7 @@ public:
qreal pressure;
QVector2D velocity;
QTouchEvent::TouchPoint::InfoFlags flags;
- QList<QPointF> rawScreenPositions;
+ QVector<QPointF> rawScreenPositions;
};
class QFileOpenEventPrivate
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 2c2d833209..f7675f5267 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -148,7 +148,6 @@ bool QGuiApplicationPrivate::obey_desktop_settings = true;
static qreal fontSmoothingGamma = 1.7;
extern void qRegisterGuiVariant();
-extern void qUnregisterGuiVariant();
extern void qInitDrawhelperAsm();
extern void qInitImageConversions();
@@ -363,8 +362,6 @@ QGuiApplication::~QGuiApplication()
clearPalette();
- qUnregisterGuiVariant();
-
#ifndef QT_NO_CURSOR
d->cursor_list.clear();
#endif
@@ -1127,12 +1124,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
QGuiApplicationPrivate::processThemeChanged(
static_cast<QWindowSystemInterfacePrivate::ThemeChangeEvent *>(e));
break;
- case QWindowSystemInterfacePrivate::Map:
- QGuiApplicationPrivate::processMapEvent(static_cast<QWindowSystemInterfacePrivate::MapEvent *>(e));
- break;
- case QWindowSystemInterfacePrivate::Unmap:
- QGuiApplicationPrivate::processUnmapEvent(static_cast<QWindowSystemInterfacePrivate::UnmapEvent *>(e));
- break;
case QWindowSystemInterfacePrivate::Expose:
QGuiApplicationPrivate::processExposeEvent(static_cast<QWindowSystemInterfacePrivate::ExposeEvent *>(e));
break;
@@ -1295,8 +1286,9 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
return;
}
- QKeyEventEx ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount,
- e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers);
+ QKeyEvent ev(e->keyType, e->key, e->modifiers,
+ e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
+ e->unicode, e->repeat, e->repeatCount);
ev.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &ev);
}
@@ -1788,30 +1780,28 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
}
-void QGuiApplicationPrivate::processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e)
+void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
{
- if (!e->mapped)
+ if (!e->exposed)
return;
- QEvent event(QEvent::Map);
- QCoreApplication::sendSpontaneousEvent(e->mapped.data(), &event);
-}
+ QWindow *window = e->exposed.data();
+ QWindowPrivate *p = qt_window_private(window);
-void QGuiApplicationPrivate::processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e)
-{
- if (!e->unmapped)
- return;
+ if (!p->receivedExpose) {
+ if (p->resizeEventPending) {
+ // as a convenience for plugins, send a resize event before the first expose event if they haven't done so
+ QSize size = p->geometry.size();
+ QResizeEvent e(size, size);
+ QGuiApplication::sendSpontaneousEvent(window, &e);
- QEvent event(QEvent::Unmap);
- QCoreApplication::sendSpontaneousEvent(e->unmapped.data(), &event);
-}
+ p->resizeEventPending = false;
+ }
-void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
-{
- if (!e->exposed)
- return;
+ p->receivedExpose = true;
+ }
- QWindow *window = e->exposed.data();
+ p->exposed = e->isExposed;
QExposeEvent exposeEvent(e->region);
QCoreApplication::sendSpontaneousEvent(window, &exposeEvent);
@@ -2160,12 +2150,11 @@ void QGuiApplication::restoreOverrideCursor()
\sa QStyleHints
*/
-QStyleHints *QGuiApplication::styleHints() const
+QStyleHints *QGuiApplication::styleHints()
{
- Q_D(const QGuiApplication);
- if (!d->styleHints)
- const_cast<QGuiApplicationPrivate *>(d)->styleHints = new QStyleHints();
- return d->styleHints;
+ if (!qGuiApp->d_func()->styleHints)
+ qGuiApp->d_func()->styleHints = new QStyleHints();
+ return qGuiApp->d_func()->styleHints;
}
/*!
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 8ae0e6dfc5..75a0f6cd4b 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -126,7 +126,7 @@ public:
static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
- QStyleHints *styleHints() const;
+ static QStyleHints *styleHints();
static void setDesktopSettingsAware(bool on);
static bool desktopSettingsAware();
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 35bf8570ea..78641de55b 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -119,9 +119,6 @@ public:
static void reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e);
static void processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce);
- static void processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e);
- static void processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e);
-
static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
static QPlatformDragQtResponse processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 50d3f0b7d1..436688a295 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -98,52 +98,13 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler();
namespace {
-template<typename T>
-struct TypeDefinition {
- static const bool IsAvailable = true;
-};
-// Ignore these types, as incomplete
-#ifdef QT_NO_GEOM_VARIANT
-template<> struct TypeDefinition<QRect> { static const bool IsAvailable = false; };
-template<> struct TypeDefinition<QRectF> { static const bool IsAvailable = false; };
-template<> struct TypeDefinition<QSize> { static const bool IsAvailable = false; };
-template<> struct TypeDefinition<QSizeF> { static const bool IsAvailable = false; };
-template<> struct TypeDefinition<QLine> { static const bool IsAvailable = false; };
-template<> struct TypeDefinition<QLineF> { static const bool IsAvailable = false; };
-template<> struct TypeDefinition<QPoint> { static const bool IsAvailable = false; };
-template<> struct TypeDefinition<QPointF> { static const bool IsAvailable = false; };
-#endif
-#ifdef QT_NO_SHORTCUT
-template<> struct TypeDefinition<QKeySequence> { static const bool IsAvailable = false; };
-#endif
-#ifdef QT_NO_CURSOR
-template<> struct TypeDefinition<QCursor> { static const bool IsAvailable = false; };
-#endif
-#ifdef QT_NO_MATRIX4X4
-template<> struct TypeDefinition<QMatrix4x4> { static const bool IsAvailable = false; };
-#endif
-#ifdef QT_NO_VECTOR2D
-template<> struct TypeDefinition<QVector2D> { static const bool IsAvailable = false; };
-#endif
-#ifdef QT_NO_VECTOR3D
-template<> struct TypeDefinition<QVector3D> { static const bool IsAvailable = false; };
-#endif
-#ifdef QT_NO_VECTOR4D
-template<> struct TypeDefinition<QVector4D> { static const bool IsAvailable = false; };
-#endif
-#ifdef QT_NO_QUATERNION
-template<> struct TypeDefinition<QQuaternion> { static const bool IsAvailable = false; };
-#endif
-
struct GuiTypesFilter {
template<typename T>
struct Acceptor {
- static const bool IsAccepted = QTypeModuleInfo<T>::IsGui && TypeDefinition<T>::IsAvailable;
+ static const bool IsAccepted = QTypeModuleInfo<T>::IsGui && QtMetaTypePrivate::TypeDefinition<T>::IsAvailable;
};
};
-} // namespace used to hide TypeDefinition
-namespace {
static void construct(QVariant::Private *x, const void *copy)
{
const int type = x->type;
@@ -389,12 +350,4 @@ void qRegisterGuiVariant()
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiVariant)
-void qUnregisterGuiVariant()
-{
- QVariantPrivate::unregisterHandler(QModulesPrivate::Gui);
- qMetaTypeGuiHelper = 0;
-}
-Q_DESTRUCTOR_FUNCTION(qUnregisterGuiVariant)
-
-
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 6b1f3534ba..c616681b64 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -934,16 +934,6 @@ QKeySequence::QKeySequence()
Note the "File|Open" translator comment. It is by no means
necessary, but it provides some context for the human translator.
*/
-QKeySequence::QKeySequence(const QString &key)
-{
- d = new QKeySequencePrivate();
- assign(key);
-}
-
-/*!
- \since 4.7
- Creates a key sequence from the \a key string based on \a format.
-*/
QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format)
{
d = new QKeySequencePrivate();
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index d1e7d06653..c926e8de1a 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -146,8 +146,7 @@ public:
};
QKeySequence();
- QKeySequence(const QString &key);
- QKeySequence(const QString &key, SequenceFormat format);
+ QKeySequence(const QString &key, SequenceFormat format = NativeText);
QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
QKeySequence(const QKeySequence &ks);
QKeySequence(StandardKey key);
@@ -204,7 +203,6 @@ private:
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QKeySequence &ks);
- friend class Q3AccelManager;
friend class QShortcutMap;
friend class QShortcut;
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index eaff417f15..4668f9e750 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -49,6 +49,7 @@
#include <QtCore/QThread>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qwindow_p.h>
#include <QtGui/QScreen>
#include <private/qopenglextensions_p.h>
@@ -502,7 +503,13 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
if (surface->surfaceType() != QSurface::OpenGLSurface) {
qWarning() << "QOpenGLContext::swapBuffers() called with non-opengl surface";
return;
- }
+ }
+
+ if (surface->surfaceClass() == QSurface::Window
+ && !qt_window_private(static_cast<QWindow *>(surface))->receivedExpose)
+ {
+ qWarning() << "QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined";
+ }
QPlatformSurface *surfaceHandle = surface->surfaceHandle();
if (!surfaceHandle)
@@ -534,9 +541,9 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
Returns 0 if no such function can be found.
*/
-QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName)
+QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName) const
{
- Q_D(QOpenGLContext);
+ Q_D(const QOpenGLContext);
if (!d->platformGLContext)
return 0;
return d->platformGLContext->getProcAddress(procName);
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 2dc4357b00..b9a47a54b8 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -96,7 +96,7 @@ class Q_GUI_EXPORT QOpenGLContext : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QOpenGLContext)
public:
- QOpenGLContext(QObject *parent = 0);
+ explicit QOpenGLContext(QObject *parent = 0);
~QOpenGLContext();
void setFormat(const QSurfaceFormat &format);
@@ -117,7 +117,7 @@ public:
void doneCurrent();
void swapBuffers(QSurface *surface);
- QFunctionPointer getProcAddress(const QByteArray &procName);
+ QFunctionPointer getProcAddress(const QByteArray &procName) const;
QSurface *surface() const;
diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
index b8de1c4ef5..679b8ab7de 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
+++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
@@ -76,7 +76,7 @@ public:
OpenGLTexture
};
- QPlatformSharedGraphicsCache(QObject *parent = 0) : QObject(parent) {}
+ explicit QPlatformSharedGraphicsCache(QObject *parent = 0) : QObject(parent) {}
Q_INVOKABLE virtual void ensureCacheInitialized(const QByteArray &cacheId, BufferType bufferType,
PixelFormat pixelFormat) = 0;
diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface_qpa.h
index e629f1183f..f64a697fc5 100644
--- a/src/gui/kernel/qplatformsurface_qpa.h
+++ b/src/gui/kernel/qplatformsurface_qpa.h
@@ -71,7 +71,7 @@ public:
QSurface::SurfaceClass surfaceClass() const;
private:
- QPlatformSurface(QSurface::SurfaceClass type);
+ explicit QPlatformSurface(QSurface::SurfaceClass type);
QSurface::SurfaceClass m_type;
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index e07ed78615..4aa46722de 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -142,11 +142,13 @@ QMargins QPlatformWindow::frameMargins() const
/*!
Reimplemented in subclasses to show the surface
if \a visible is \c true, and hide it if \a visible is \c false.
+
+ The default implementation sends a synchronous expose event.
*/
void QPlatformWindow::setVisible(bool visible)
{
- Q_UNUSED(visible);
- QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRect(QPoint(), geometry().size()));
+ QRect rect(QPoint(), geometry().size());
+ QWindowSystemInterface::handleSynchronousExposeEvent(window(), rect);
}
/*!
Requests setting the window flags of this surface
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index aa4d7f5054..729f35e025 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -74,7 +74,7 @@ class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface
{
Q_DECLARE_PRIVATE(QPlatformWindow)
public:
- QPlatformWindow(QWindow *window);
+ explicit QPlatformWindow(QWindow *window);
virtual ~QPlatformWindow();
QWindow *window() const;
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index ce26b9dd93..3546ce01dd 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -401,7 +401,7 @@ static int log2(uint i)
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
*/
-int QScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
+int QScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const
{
if (a == Qt::PrimaryOrientation)
a = primaryOrientation();
@@ -436,7 +436,7 @@ int QScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
*/
-QTransform QScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target)
+QTransform QScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const
{
if (a == Qt::PrimaryOrientation)
a = primaryOrientation();
@@ -477,7 +477,7 @@ QTransform QScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientat
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
*/
-QRect QScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect)
+QRect QScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const
{
if (a == Qt::PrimaryOrientation)
a = primaryOrientation();
@@ -503,7 +503,7 @@ QRect QScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, cons
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
*/
-bool QScreen::isPortrait(Qt::ScreenOrientation o)
+bool QScreen::isPortrait(Qt::ScreenOrientation o) const
{
return o == Qt::PortraitOrientation || o == Qt::InvertedPortraitOrientation
|| (o == Qt::PrimaryOrientation && primaryOrientation() == Qt::PortraitOrientation);
@@ -515,7 +515,7 @@ bool QScreen::isPortrait(Qt::ScreenOrientation o)
Qt::PrimaryOrientation is interpreted as the screen's primaryOrientation().
*/
-bool QScreen::isLandscape(Qt::ScreenOrientation o)
+bool QScreen::isLandscape(Qt::ScreenOrientation o) const
{
return o == Qt::LandscapeOrientation || o == Qt::InvertedLandscapeOrientation
|| (o == Qt::PrimaryOrientation && primaryOrientation() == Qt::LandscapeOrientation);
@@ -580,7 +580,7 @@ void QScreenPrivate::updatePrimaryOrientation()
safe. This depends on the underlying window system.
*/
-QPixmap QScreen::grabWindow(WId window, int x, int y, int w, int h) const
+QPixmap QScreen::grabWindow(WId window, int x, int y, int w, int h)
{
const QPlatformScreen *platformScreen = handle();
if (!platformScreen) {
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 111e10d340..f69e04a595 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -118,14 +118,14 @@ public:
Qt::ScreenOrientation primaryOrientation() const;
Qt::ScreenOrientation orientation() const;
- int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
- QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target);
- QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);
+ int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const;
+ QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const;
+ QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const;
- bool isPortrait(Qt::ScreenOrientation orientation);
- bool isLandscape(Qt::ScreenOrientation orientation);
+ bool isPortrait(Qt::ScreenOrientation orientation) const;
+ bool isLandscape(Qt::ScreenOrientation orientation) const;
- QPixmap grabWindow(WId window, int x, int y, int w, int h) const;
+ QPixmap grabWindow(WId window, int x, int y, int w, int h);
Q_SIGNALS:
void sizeChanged(const QSize &size);
@@ -142,7 +142,7 @@ Q_SIGNALS:
void orientationChanged(Qt::ScreenOrientation orientation);
private:
- QScreen(QPlatformScreen *screen);
+ explicit QScreen(QPlatformScreen *screen);
Q_DISABLE_COPY(QScreen)
friend class QGuiApplicationPrivate;
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index a8900fde33..befb771129 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -80,7 +80,7 @@ public:
virtual QSize size() const = 0;
protected:
- QSurface(SurfaceClass type);
+ explicit QSurface(SurfaceClass type);
SurfaceClass m_type;
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index 6daa08095e..a4224bbedd 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -75,7 +75,7 @@ public:
};
QSurfaceFormat();
- QSurfaceFormat(FormatOptions options);
+ /*implicit*/ QSurfaceFormat(FormatOptions options);
QSurfaceFormat(const QSurfaceFormat &other);
QSurfaceFormat &operator=(const QSurfaceFormat &other);
~QSurfaceFormat();
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 856dcd8426..b042283071 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -109,6 +109,18 @@ QT_BEGIN_NAMESPACE
called whenever the windows exposure in the windowing system changes. On
windowing systems that do not make this information visible to the
application, isExposed() will simply return the same value as isVisible().
+
+ \section1 Rendering
+
+ There are two Qt APIs that can be used to render content into a window,
+ QBackingStore for rendering with a QPainter and flushing the contents
+ to a window with type QSurface::RasterSurface, and QOpenGLContext for
+ rendering with OpenGL to a window with type QSurface::OpenGLSurface.
+
+ The application can start rendering as soon as isExposed() returns true,
+ and can keep rendering until it isExposed() returns false. To find out when
+ isExposed() changes, reimplement exposeEvent(). The window will always get
+ a resize event before the first expose event.
*/
/*!
@@ -593,9 +605,7 @@ void QWindow::requestActivateWindow()
bool QWindow::isExposed() const
{
Q_D(const QWindow);
- if (d->platformWindow)
- return d->platformWindow->isExposed();
- return false;
+ return d->exposed;
}
/*!
@@ -1084,6 +1094,9 @@ void QWindow::destroy()
}
setVisible(false);
delete d->platformWindow;
+ d->resizeEventPending = true;
+ d->receivedExpose = false;
+ d->exposed = false;
d->platformWindow = 0;
}
@@ -1343,12 +1356,19 @@ bool QWindow::close()
The expose event is sent by the window system whenever the window's
exposure on screen changes.
+ The application can start rendering into the window with QBackingStore
+ and QOpenGLContext as soon as it gets an exposeEvent() such that
+ isExposed() is true.
+
If the window is moved off screen, is made totally obscured by another
window, iconified or similar, this function might be called and the
value of isExposed() might change to false. When this happens,
an application should stop its rendering as it is no longer visible
to the user.
+ A resize event will always be sent before the expose event the first time
+ a window is shown.
+
\sa isExposed()
*/
void QWindow::exposeEvent(QExposeEvent *ev)
@@ -1379,7 +1399,10 @@ void QWindow::resizeEvent(QResizeEvent *ev)
/*!
Override this to handle show events.
- This function is called when the window becomes visible in the windowing system.
+ The function is called when the window has requested becoming visible.
+
+ If the window is successfully shown by the windowing system, this will
+ be followed by a resize and an expose event.
*/
void QWindow::showEvent(QShowEvent *ev)
{
@@ -1387,9 +1410,10 @@ void QWindow::showEvent(QShowEvent *ev)
}
/*!
- Override this to handle hide events.
+ Override this to handle hide evens.
- This function is called when the window becomes hidden in the windowing system.
+ The function is called when the window has requested being hidden in the
+ windowing system.
*/
void QWindow::hideEvent(QHideEvent *ev)
{
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 71ae9686b3..118e3ec25f 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -95,8 +95,8 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
public:
- QWindow(QScreen *screen = 0);
- QWindow(QWindow *parent);
+ explicit QWindow(QScreen *screen = 0);
+ explicit QWindow(QWindow *parent);
virtual ~QWindow();
void setSurfaceType(SurfaceType surfaceType);
@@ -183,11 +183,6 @@ public:
inline QSize size() const { return geometry().size(); }
inline QPoint pos() const { return geometry().topLeft(); }
-#ifdef QT_DEPRECATED
- QT_DEPRECATED inline void move(const QPoint &pt) { setPos(pt); }
- QT_DEPRECATED inline void move(int posx, int posy) { setPos(posx, posy); }
-#endif
-
inline void setPos(const QPoint &pt) { setGeometry(QRect(pt, size())); }
inline void setPos(int posx, int posy) { setPos(QPoint(posx, posy)); }
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index b665298ce0..375bd1e729 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -72,8 +72,10 @@ public:
, parentWindow(0)
, platformWindow(0)
, visible(false)
+ , exposed(false)
, windowState(Qt::WindowNoState)
, resizeEventPending(true)
+ , receivedExpose(false)
, positionPolicy(WindowFrameExclusive)
, contentOrientation(Qt::PrimaryOrientation)
, windowOrientation(Qt::PrimaryOrientation)
@@ -100,17 +102,18 @@ public:
return offset;
}
-
QWindow::SurfaceType surfaceType;
Qt::WindowFlags windowFlags;
QWindow *parentWindow;
QPlatformWindow *platformWindow;
bool visible;
+ bool exposed;
QSurfaceFormat requestedFormat;
QString windowTitle;
QRect geometry;
Qt::WindowState windowState;
bool resizeEventPending;
+ bool receivedExpose;
PositionPolicy positionPolicy;
Qt::ScreenOrientation contentOrientation;
Qt::ScreenOrientation windowOrientation;
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 0aa9251642..a0b77b8208 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include "qwindowsysteminterface_qpa.h"
+#include "qplatformwindow_qpa.h"
#include "qwindowsysteminterface_qpa_p.h"
#include "private/qguiapplication_p.h"
#include "private/qevent_p.h"
@@ -179,7 +180,7 @@ bool QWindowSystemInterface::tryHandleSynchronousExtendedShortcutEvent(QWindow *
{
QGuiApplicationPrivate::modifier_buttons = mods;
- QKeyEventEx qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count, nativeScanCode, nativeVirtualKey, nativeModifiers);
+ QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
qevent.setTimestamp(timestamp);
return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(w, &qevent);
}
@@ -278,6 +279,15 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
+
+QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *exposed, const QRegion &region)
+ : WindowSystemEvent(Expose)
+ , exposed(exposed)
+ , isExposed(exposed && exposed->handle() ? exposed->handle()->isExposed() : false)
+ , region(region)
+{
+}
+
int QWindowSystemInterfacePrivate::windowSystemEventsQueued()
{
queueMutex.lock();
@@ -430,15 +440,9 @@ void QWindowSystemInterface::handleThemeChange(QWindow *tlw)
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleMapEvent(QWindow *tlw)
-{
- QWindowSystemInterfacePrivate::MapEvent *e = new QWindowSystemInterfacePrivate::MapEvent(tlw);
- QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
-}
-
-void QWindowSystemInterface::handleUnmapEvent(QWindow *tlw)
+void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion &region)
{
- QWindowSystemInterfacePrivate::UnmapEvent *e = new QWindowSystemInterfacePrivate::UnmapEvent(tlw);
+ QWindowSystemInterfacePrivate::ExposeEvent *e = new QWindowSystemInterfacePrivate::ExposeEvent(tlw, region);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 4cdd33b49f..1fbf430bf9 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -110,7 +110,7 @@ public:
Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
QVector2D velocity; // in screen coordinate system, pixels / seconds
QTouchEvent::TouchPoint::InfoFlags flags;
- QList<QPointF> rawPositions; // in screen coordinates
+ QVector<QPointF> rawPositions; // in screen coordinates
};
static void registerTouchDevice(QTouchDevice *device);
@@ -130,9 +130,7 @@ public:
static void handleWindowActivated(QWindow *w);
static void handleWindowStateChanged(QWindow *w, Qt::WindowState newState);
- static void handleMapEvent(QWindow *w);
- static void handleUnmapEvent(QWindow *w);
-
+ static void handleExposeEvent(QWindow *tlw, const QRegion &region);
static void handleSynchronousExposeEvent(QWindow *tlw, const QRegion &region);
// Drag and drop. These events are sent immediately.
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index fe97b486ad..d7be7699e9 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -42,6 +42,7 @@
#define QWINDOWSYSTEMINTERFACE_QPA_P_H
#include "qwindowsysteminterface_qpa.h"
+
#include <QElapsedTimer>
QT_BEGIN_HEADER
@@ -66,8 +67,6 @@ public:
ScreenAvailableGeometry,
ScreenLogicalDotsPerInch,
ThemeChange,
- Map,
- Unmap,
Expose
};
@@ -241,28 +240,11 @@ public:
QWeakPointer<QWindow> window;
};
- class MapEvent : public WindowSystemEvent {
- public:
- MapEvent(QWindow *mapped)
- : WindowSystemEvent(Map), mapped(mapped)
- { }
- QWeakPointer<QWindow> mapped;
- };
-
- class UnmapEvent : public WindowSystemEvent {
- public:
- UnmapEvent(QWindow *unmapped)
- : WindowSystemEvent(Unmap), unmapped(unmapped)
- { }
- QWeakPointer<QWindow> unmapped;
- };
-
class ExposeEvent : public WindowSystemEvent {
public:
- ExposeEvent(QWindow *exposed, const QRegion &region)
- : WindowSystemEvent(Expose), exposed(exposed), region(region)
- { }
+ ExposeEvent(QWindow *exposed, const QRegion &region);
QWeakPointer<QWindow> exposed;
+ bool isExposed;
QRegion region;
};
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index 0a2446587a..b987ab2334 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -102,7 +102,7 @@ private:
#endif
T m[N][M]; // Column-major order to match OpenGL.
- QGenericMatrix(int) {} // Construct without initializing identity matrix.
+ explicit QGenericMatrix(int) {} // Construct without initializing identity matrix.
#if !defined(Q_NO_TEMPLATE_FRIENDS)
template <int NN, int MM, typename TT>
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index b80fc86f45..8353adfab1 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -201,7 +201,7 @@ private:
};
// Construct without initializing identity matrix.
- QMatrix4x4(int) { }
+ explicit QMatrix4x4(int) { }
QMatrix4x4 orthonormalInverse() const;
diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h
index 63260f1940..9e69cecc58 100644
--- a/src/gui/opengl/qopenglframebufferobject.h
+++ b/src/gui/opengl/qopenglframebufferobject.h
@@ -67,7 +67,7 @@ public:
Depth
};
- QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D);
+ explicit QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D);
QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D);
#if !defined(QT_OPENGL_ES) || defined(Q_QDOC)
QOpenGLFramebufferObject(const QSize &size, Attachment attachment,
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index be366a79c8..87029849e3 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -200,7 +200,7 @@ class Q_GUI_EXPORT QOpenGLFunctions
{
public:
QOpenGLFunctions();
- QOpenGLFunctions(QOpenGLContext *context);
+ explicit QOpenGLFunctions(QOpenGLContext *context);
~QOpenGLFunctions() {}
enum OpenGLFeature
diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
index ce3e7cf278..7d4b901fe7 100644
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ b/src/gui/opengl/qopenglpaintdevice.h
@@ -71,7 +71,7 @@ class Q_GUI_EXPORT QOpenGLPaintDevice : public QPaintDevice
{
Q_DECLARE_PRIVATE(QOpenGLPaintDevice)
public:
- QOpenGLPaintDevice(const QSize &size);
+ explicit QOpenGLPaintDevice(const QSize &size);
QOpenGLPaintDevice(int width, int height);
virtual ~QOpenGLPaintDevice();
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index a79c247e16..a8f6a5bf8f 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -93,13 +93,7 @@ SOURCES += \
if(mmx|3dnow|sse|sse2|iwmmxt) {
HEADERS += painting/qdrawhelper_x86_p.h \
- painting/qdrawhelper_mmx_p.h \
- painting/qdrawhelper_sse_p.h \
painting/qdrawingprimitive_sse2_p.h
- MMX_SOURCES += painting/qdrawhelper_mmx.cpp
- MMX3DNOW_SOURCES += painting/qdrawhelper_mmx3dnow.cpp
- SSE3DNOW_SOURCES += painting/qdrawhelper_sse3dnow.cpp
- SSE_SOURCES += painting/qdrawhelper_sse.cpp
SSE2_SOURCES += painting/qdrawhelper_sse2.cpp
SSSE3_SOURCES += painting/qdrawhelper_ssse3.cpp
IWMMXT_SOURCES += painting/qdrawhelper_iwmmxt.cpp
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 03c2fc8d6a..63f7ba594f 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -82,6 +82,10 @@ void QBackingStore::flush(const QRegion &region, QWindow *win, const QPoint &off
{
if (!win)
win = window();
+
+ if (win && !qt_window_private(win)->receivedExpose)
+ qWarning("QBackingStore::flush() called with non-exposed window, behavior is undefined");
+
d_ptr->platformBackingStore->flush(win, region, offset);
}
diff --git a/src/gui/painting/qbackingstore.h b/src/gui/painting/qbackingstore.h
index db6884f58d..ead15e7ea6 100644
--- a/src/gui/painting/qbackingstore.h
+++ b/src/gui/painting/qbackingstore.h
@@ -62,7 +62,7 @@ class QPlatformBackingStore;
class Q_GUI_EXPORT QBackingStore
{
public:
- QBackingStore(QWindow *window);
+ explicit QBackingStore(QWindow *window);
~QBackingStore();
QWindow *window() const;
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index e2855c80d0..0eea4c641f 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -55,6 +55,8 @@
#include "QtCore/qbytearray.h"
+#include <stdlib.h>
+
QT_BEGIN_NAMESPACE
template <typename Type> class QDataBuffer
@@ -64,7 +66,7 @@ public:
{
capacity = res;
if (res)
- buffer = (Type*) qMalloc(capacity * sizeof(Type));
+ buffer = (Type*) malloc(capacity * sizeof(Type));
else
buffer = 0;
siz = 0;
@@ -73,7 +75,7 @@ public:
~QDataBuffer()
{
if (buffer)
- qFree(buffer);
+ free(buffer);
}
inline void reset() { siz = 0; }
@@ -112,16 +114,16 @@ public:
capacity = 1;
while (capacity < size)
capacity *= 2;
- buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
+ buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
}
}
inline void shrink(int size) {
capacity = size;
if (size)
- buffer = (Type*) qRealloc(buffer, capacity * sizeof(Type));
+ buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
else {
- qFree(buffer);
+ free(buffer);
buffer = 0;
}
}
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 43c4781197..919a19eb9b 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5827,66 +5827,7 @@ void qInitDrawhelperAsm()
qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2;
qScaleFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2;
#endif
-#ifdef QT_HAVE_SSE
- } else if (features & SSE) {
-// qt_memfill32 = qt_memfill32_sse;
- qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse;
-#ifdef QT_HAVE_3DNOW
- if (features & MMX3DNOW) {
- qt_memfill32 = qt_memfill32_sse3dnow;
- qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse3dnow;
- }
-#endif
-#endif // SSE
- }
-#ifdef QT_HAVE_MMX
- if (features & MMX) {
- functionForModeAsm = qt_functionForMode_MMX;
-
- functionForModeSolidAsm = qt_functionForModeSolid_MMX;
- qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_mmx;
-#ifdef QT_HAVE_3DNOW
- if (features & MMX3DNOW) {
- functionForModeAsm = qt_functionForMode_MMX3DNOW;
- functionForModeSolidAsm = qt_functionForModeSolid_MMX3DNOW;
- qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_mmx3dnow;
- }
-#endif // 3DNOW
-
- extern void qt_blend_rgb32_on_rgb32_mmx(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
- extern void qt_blend_argb32_on_argb32_mmx(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
-
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mmx;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mmx;
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_mmx;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_mmx;
-
- }
-#endif // MMX
-
-#ifdef QT_HAVE_SSE
- if (features & SSE) {
- extern void qt_blend_rgb32_on_rgb32_sse(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
- extern void qt_blend_argb32_on_argb32_sse(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
-
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse;
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse;
- }
-#endif // SSE
+ }
#ifdef QT_HAVE_SSE2
if (features & SSE2) {
@@ -5924,44 +5865,12 @@ void qInitDrawhelperAsm()
#endif // SSE2
-#ifdef QT_HAVE_SSE
- if (features & SSE) {
- functionForModeAsm = qt_functionForMode_SSE;
- functionForModeSolidAsm = qt_functionForModeSolid_SSE;
- qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_sse;
-#ifdef QT_HAVE_3DNOW
- if (features & MMX3DNOW) {
- functionForModeAsm = qt_functionForMode_SSE3DNOW;
- functionForModeSolidAsm = qt_functionForModeSolid_SSE3DNOW;
- qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_sse3dnow;
- }
-#endif // 3DNOW
-
-
#ifdef QT_HAVE_SSE2
- if (features & SSE2) {
- extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels,
- const uint *srcPixels,
- int length,
- uint const_alpha);
- extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
- extern void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha);
- extern void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha);
-
- functionForModeAsm[0] = comp_func_SourceOver_sse2;
- functionForModeAsm[QPainter::CompositionMode_Source] = comp_func_Source_sse2;
- functionForModeAsm[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
- functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2;
- }
-#endif
- }
-#elif defined(QT_HAVE_SSE2)
- // this is the special case when SSE2 is usable but MMX/SSE is not usable (e.g.: Windows x64 + visual studio)
if (features & SSE2) {
- functionForModeAsm = qt_functionForMode_onlySSE2;
- functionForModeSolidAsm = qt_functionForModeSolid_onlySSE2;
+ functionForModeAsm = qt_functionForMode_SSE2;
+ functionForModeSolidAsm = qt_functionForModeSolid_SSE2;
}
-#endif
+#endif // SSE2
#ifdef QT_HAVE_IWMMXT
if (features & IWMMXT) {
diff --git a/src/gui/painting/qdrawhelper_mmx.cpp b/src/gui/painting/qdrawhelper_mmx.cpp
deleted file mode 100644
index 520ce6efd0..0000000000
--- a/src/gui/painting/qdrawhelper_mmx.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.1, 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qdrawhelper_p.h>
-
-#if defined(QT_HAVE_MMX)
-
-#include <private/qdrawhelper_mmx_p.h>
-
-QT_BEGIN_NAMESPACE
-
-CompositionFunctionSolid qt_functionForModeSolid_MMX[numCompositionFunctions] = {
- comp_func_solid_SourceOver<QMMXIntrinsics>,
- comp_func_solid_DestinationOver<QMMXIntrinsics>,
- comp_func_solid_Clear<QMMXIntrinsics>,
- comp_func_solid_Source<QMMXIntrinsics>,
- 0,
- comp_func_solid_SourceIn<QMMXIntrinsics>,
- comp_func_solid_DestinationIn<QMMXIntrinsics>,
- comp_func_solid_SourceOut<QMMXIntrinsics>,
- comp_func_solid_DestinationOut<QMMXIntrinsics>,
- comp_func_solid_SourceAtop<QMMXIntrinsics>,
- comp_func_solid_DestinationAtop<QMMXIntrinsics>,
- comp_func_solid_XOR<QMMXIntrinsics>,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // svg 1.2 modes
- rasterop_solid_SourceOrDestination<QMMXIntrinsics>,
- rasterop_solid_SourceAndDestination<QMMXIntrinsics>,
- rasterop_solid_SourceXorDestination<QMMXIntrinsics>,
- rasterop_solid_NotSourceAndNotDestination<QMMXIntrinsics>,
- rasterop_solid_NotSourceOrNotDestination<QMMXIntrinsics>,
- rasterop_solid_NotSourceXorDestination<QMMXIntrinsics>,
- rasterop_solid_NotSource<QMMXIntrinsics>,
- rasterop_solid_NotSourceAndDestination<QMMXIntrinsics>,
- rasterop_solid_SourceAndNotDestination<QMMXIntrinsics>
-};
-
-CompositionFunction qt_functionForMode_MMX[numCompositionFunctions] = {
- comp_func_SourceOver<QMMXIntrinsics>,
- comp_func_DestinationOver<QMMXIntrinsics>,
- comp_func_Clear<QMMXIntrinsics>,
- comp_func_Source<QMMXIntrinsics>,
- comp_func_Destination,
- comp_func_SourceIn<QMMXIntrinsics>,
- comp_func_DestinationIn<QMMXIntrinsics>,
- comp_func_SourceOut<QMMXIntrinsics>,
- comp_func_DestinationOut<QMMXIntrinsics>,
- comp_func_SourceAtop<QMMXIntrinsics>,
- comp_func_DestinationAtop<QMMXIntrinsics>,
- comp_func_XOR<QMMXIntrinsics>,
- 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
-};
-
-void qt_blend_color_argb_mmx(int count, const QSpan *spans, void *userData)
-{
- qt_blend_color_argb_x86<QMMXIntrinsics>(count, spans, userData,
- (CompositionFunctionSolid*)qt_functionForModeSolid_MMX);
-}
-
-
-void qt_blend_argb32_on_argb32_mmx(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha)
-{
- const uint *src = (const uint *) srcPixels;
- uint *dst = (uint *) destPixels;
-
- uint ca = const_alpha - 1;
-
- for (int y=0; y<h; ++y) {
- comp_func_SourceOver<QMMXIntrinsics>(dst, src, w, ca);
- dst = (quint32 *)(((uchar *) dst) + dbpl);
- src = (const quint32 *)(((const uchar *) src) + sbpl);
- }
-}
-
-void qt_blend_rgb32_on_rgb32_mmx(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha)
-{
- const uint *src = (const uint *) srcPixels;
- uint *dst = (uint *) destPixels;
-
- uint ca = const_alpha - 1;
-
- for (int y=0; y<h; ++y) {
- comp_func_Source<QMMXIntrinsics>(dst, src, w, ca);
- dst = (quint32 *)(((uchar *) dst) + dbpl);
- src = (const quint32 *)(((const uchar *) src) + sbpl);
- }
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_HAVE_MMX
-
diff --git a/src/gui/painting/qdrawhelper_mmx3dnow.cpp b/src/gui/painting/qdrawhelper_mmx3dnow.cpp
deleted file mode 100644
index 71469b65c0..0000000000
--- a/src/gui/painting/qdrawhelper_mmx3dnow.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.1, 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qdrawhelper_x86_p.h>
-
-#ifdef QT_HAVE_3DNOW
-
-#include <private/qdrawhelper_mmx_p.h>
-#include <mm3dnow.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QMMX3DNOWIntrinsics : public QMMXCommonIntrinsics
-{
- static inline void end() {
- _m_femms();
- }
-};
-
-CompositionFunctionSolid qt_functionForModeSolid_MMX3DNOW[numCompositionFunctions] = {
- comp_func_solid_SourceOver<QMMX3DNOWIntrinsics>,
- comp_func_solid_DestinationOver<QMMX3DNOWIntrinsics>,
- comp_func_solid_Clear<QMMX3DNOWIntrinsics>,
- comp_func_solid_Source<QMMX3DNOWIntrinsics>,
- 0,
- comp_func_solid_SourceIn<QMMX3DNOWIntrinsics>,
- comp_func_solid_DestinationIn<QMMX3DNOWIntrinsics>,
- comp_func_solid_SourceOut<QMMX3DNOWIntrinsics>,
- comp_func_solid_DestinationOut<QMMX3DNOWIntrinsics>,
- comp_func_solid_SourceAtop<QMMX3DNOWIntrinsics>,
- comp_func_solid_DestinationAtop<QMMX3DNOWIntrinsics>,
- comp_func_solid_XOR<QMMX3DNOWIntrinsics>,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // svg 1.2 modes
- rasterop_solid_SourceOrDestination<QMMX3DNOWIntrinsics>,
- rasterop_solid_SourceAndDestination<QMMX3DNOWIntrinsics>,
- rasterop_solid_SourceXorDestination<QMMX3DNOWIntrinsics>,
- rasterop_solid_NotSourceAndNotDestination<QMMX3DNOWIntrinsics>,
- rasterop_solid_NotSourceOrNotDestination<QMMX3DNOWIntrinsics>,
- rasterop_solid_NotSourceXorDestination<QMMX3DNOWIntrinsics>,
- rasterop_solid_NotSource<QMMX3DNOWIntrinsics>,
- rasterop_solid_NotSourceAndDestination<QMMX3DNOWIntrinsics>,
- rasterop_solid_SourceAndNotDestination<QMMX3DNOWIntrinsics>
-};
-
-CompositionFunction qt_functionForMode_MMX3DNOW[numCompositionFunctions] = {
- comp_func_SourceOver<QMMX3DNOWIntrinsics>,
- comp_func_DestinationOver<QMMX3DNOWIntrinsics>,
- comp_func_Clear<QMMX3DNOWIntrinsics>,
- comp_func_Source<QMMX3DNOWIntrinsics>,
- comp_func_Destination,
- comp_func_SourceIn<QMMX3DNOWIntrinsics>,
- comp_func_DestinationIn<QMMX3DNOWIntrinsics>,
- comp_func_SourceOut<QMMX3DNOWIntrinsics>,
- comp_func_DestinationOut<QMMX3DNOWIntrinsics>,
- comp_func_SourceAtop<QMMX3DNOWIntrinsics>,
- comp_func_DestinationAtop<QMMX3DNOWIntrinsics>,
- comp_func_XOR<QMMX3DNOWIntrinsics>,
- 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
-};
-
-void qt_blend_color_argb_mmx3dnow(int count, const QSpan *spans, void *userData)
-{
- qt_blend_color_argb_x86<QMMX3DNOWIntrinsics>(count, spans, userData,
- (CompositionFunctionSolid*)qt_functionForModeSolid_MMX3DNOW);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_HAVE_3DNOW
-
diff --git a/src/gui/painting/qdrawhelper_mmx_p.h b/src/gui/painting/qdrawhelper_mmx_p.h
deleted file mode 100644
index 5038292029..0000000000
--- a/src/gui/painting/qdrawhelper_mmx_p.h
+++ /dev/null
@@ -1,892 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.1, 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDRAWHELPER_MMX_P_H
-#define QDRAWHELPER_MMX_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>
-#include <private/qdrawhelper_x86_p.h>
-#include <private/qpaintengine_raster_p.h>
-
-#ifdef QT_HAVE_MMX
-#include <mmintrin.h>
-#endif
-
-#define C_FF const m64 mmx_0x00ff = _mm_set1_pi16(0xff)
-#define C_80 const m64 mmx_0x0080 = _mm_set1_pi16(0x80)
-#define C_00 const m64 mmx_0x0000 = _mm_setzero_si64()
-
-#ifdef Q_CC_MSVC
-# pragma warning(disable: 4799) // No EMMS at end of function
-#endif
-
-typedef __m64 m64;
-
-QT_BEGIN_NAMESPACE
-
-struct QMMXCommonIntrinsics
-{
- static inline m64 alpha(m64 x) {
- x = _mm_unpackhi_pi16(x, x);
- x = _mm_unpackhi_pi16(x, x);
- return x;
- }
-
- static inline m64 _negate(const m64 &x, const m64 &mmx_0x00ff) {
- return _mm_xor_si64(x, mmx_0x00ff);
- }
-
- static inline m64 add(const m64 &a, const m64 &b) {
- return _mm_adds_pu16 (a, b);
- }
-
- static inline m64 _byte_mul(const m64 &a, const m64 &b,
- const m64 &mmx_0x0080)
- {
- m64 res = _mm_mullo_pi16(a, b);
- res = _mm_adds_pu16(res, mmx_0x0080);
- res = _mm_adds_pu16(res, _mm_srli_pi16 (res, 8));
- return _mm_srli_pi16(res, 8);
- }
-
- static inline m64 interpolate_pixel_256(const m64 &x, const m64 &a,
- const m64 &y, const m64 &b)
- {
- m64 res = _mm_adds_pu16(_mm_mullo_pi16(x, a), _mm_mullo_pi16(y, b));
- return _mm_srli_pi16(res, 8);
- }
-
- static inline m64 _interpolate_pixel_255(const m64 &x, const m64 &a,
- const m64 &y, const m64 &b,
- const m64 &mmx_0x0080)
- {
- m64 res = _mm_adds_pu16(_mm_mullo_pi16(x, a), _mm_mullo_pi16(y, b));
- res = _mm_adds_pu16(res, mmx_0x0080);
- res = _mm_adds_pu16(res, _mm_srli_pi16 (res, 8));
- return _mm_srli_pi16(res, 8);
- }
-
- static inline m64 _premul(m64 x, const m64 &mmx_0x0080) {
- m64 a = alpha(x);
- return _byte_mul(x, a, mmx_0x0080);
- }
-
- static inline m64 _load(uint x, const m64 &mmx_0x0000) {
- return _mm_unpacklo_pi8(_mm_cvtsi32_si64(x), mmx_0x0000);
- }
-
- static inline m64 _load_alpha(uint x, const m64 &) {
- x |= (x << 16);
- return _mm_set1_pi32(x);
- }
-
- static inline uint _store(const m64 &x, const m64 &mmx_0x0000) {
- return _mm_cvtsi64_si32(_mm_packs_pu16(x, mmx_0x0000));
- }
-};
-
-#define negate(x) _negate(x, mmx_0x00ff)
-#define byte_mul(a, b) _byte_mul(a, b, mmx_0x0080)
-#define interpolate_pixel_255(x, a, y, b) _interpolate_pixel_255(x, a, y, b, mmx_0x0080)
-#define premul(x) _premul(x, mmx_0x0080)
-#define load(x) _load(x, mmx_0x0000)
-#define load_alpha(x) _load_alpha(x, mmx_0x0000)
-#define store(x) _store(x, mmx_0x0000)
-
-/*
- result = 0
- d = d * cia
-*/
-#define comp_func_Clear_impl(dest, length, const_alpha)\
-{\
- if (const_alpha == 255) {\
- qt_memfill(static_cast<quint32*>(dest), quint32(0), length);\
- } else {\
- C_FF; C_80; C_00;\
- m64 ia = MM::negate(MM::load_alpha(const_alpha));\
- for (int i = 0; i < length; ++i) {\
- dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), ia));\
- }\
- MM::end();\
- }\
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha)
-{
- comp_func_Clear_impl(dest, length, const_alpha);
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha)
-{
- comp_func_Clear_impl(dest, length, const_alpha);
-}
-
-/*
- result = s
- dest = s * ca + d * cia
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint src, uint const_alpha)
-{
- if (const_alpha == 255) {
- qt_memfill(static_cast<quint32*>(dest), quint32(src), length);
- } else {
- C_FF; C_80; C_00;
- const m64 a = MM::load_alpha(const_alpha);
- const m64 ia = MM::negate(a);
- const m64 s = MM::byte_mul(MM::load(src), a);
- for (int i = 0; i < length; ++i) {
- dest[i] = MM::store(MM::add(s, MM::byte_mul(MM::load(dest[i]), ia)));
- }
- MM::end();
- }
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha)
-{
- if (const_alpha == 255) {
- ::memcpy(dest, src, length * sizeof(uint));
- } else {
- C_FF; C_80; C_00;
- const m64 a = MM::load_alpha(const_alpha);
- const m64 ia = MM::negate(a);
- for (int i = 0; i < length; ++i)
- dest[i] = MM::store(MM::interpolate_pixel_255(MM::load(src[i]), a,
- MM::load(dest[i]), ia));
- }
- MM::end();
-}
-
-/*
- result = s + d * sia
- dest = (s + d * sia) * ca + d * cia
- = s * ca + d * (sia * ca + cia)
- = s * ca + d * (1 - sa*ca)
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint src, uint const_alpha)
-{
- if ((const_alpha & qAlpha(src)) == 255) {
- qt_memfill(static_cast<quint32*>(dest), quint32(src), length);
- } else {
- C_FF; C_80; C_00;
- m64 s = MM::load(src);
- if (const_alpha != 255) {
- m64 ca = MM::load_alpha(const_alpha);
- s = MM::byte_mul(s, ca);
- }
- m64 a = MM::negate(MM::alpha(s));
- for (int i = 0; i < length; ++i)
- dest[i] = MM::store(MM::add(s, MM::byte_mul(MM::load(dest[i]), a)));
- MM::end();
- }
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha)
-{
- C_FF; C_80; C_00;
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- const uint alphaMaskedSource = 0xff000000 & src[i];
- if (alphaMaskedSource == 0)
- continue;
- if (alphaMaskedSource == 0xff000000) {
- dest[i] = src[i];
- } else {
- m64 s = MM::load(src[i]);
- m64 ia = MM::negate(MM::alpha(s));
- dest[i] = MM::store(MM::add(s, MM::byte_mul(MM::load(dest[i]), ia)));
- }
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- for (int i = 0; i < length; ++i) {
- if ((0xff000000 & src[i]) == 0)
- continue;
- m64 s = MM::byte_mul(MM::load(src[i]), ca);
- m64 ia = MM::negate(MM::alpha(s));
- dest[i] = MM::store(MM::add(s, MM::byte_mul(MM::load(dest[i]), ia)));
- }
- }
- MM::end();
-}
-
-/*
- result = d + s * dia
- dest = (d + s * dia) * ca + d * cia
- = d + s * dia * ca
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint src, uint const_alpha)
-{
- C_FF; C_80; C_00;
- m64 s = MM::load(src);
- if (const_alpha != 255)
- s = MM::byte_mul(s, MM::load_alpha(const_alpha));
-
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- m64 dia = MM::negate(MM::alpha(d));
- dest[i] = MM::store(MM::add(d, MM::byte_mul(s, dia)));
- }
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha)
-{
- C_FF; C_80; C_00;
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- m64 ia = MM::negate(MM::alpha(d));
- dest[i] = MM::store(MM::add(d, MM::byte_mul(MM::load(src[i]), ia)));
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- m64 dia = MM::negate(MM::alpha(d));
- dia = MM::byte_mul(dia, ca);
- dest[i] = MM::store(MM::add(d, MM::byte_mul(MM::load(src[i]), dia)));
- }
- }
- MM::end();
-}
-
-/*
- result = s * da
- dest = s * da * ca + d * cia
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint src, uint const_alpha)
-{
- C_80; C_00;
- if (const_alpha == 255) {
- m64 s = MM::load(src);
- for (int i = 0; i < length; ++i) {
- m64 da = MM::alpha(MM::load(dest[i]));
- dest[i] = MM::store(MM::byte_mul(s, da));
- }
- } else {
- C_FF;
- m64 s = MM::load(src);
- m64 ca = MM::load_alpha(const_alpha);
- s = MM::byte_mul(s, ca);
- m64 cia = MM::negate(ca);
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::alpha(d), d, cia));
- }
- }
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha)
-{
- C_FF; C_80; C_00;
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- m64 a = MM::alpha(MM::load(dest[i]));
- dest[i] = MM::store(MM::byte_mul(MM::load(src[i]), a));
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- m64 cia = MM::negate(ca);
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- m64 da = MM::byte_mul(MM::alpha(d), ca);
- dest[i] = MM::store(MM::interpolate_pixel_255(
- MM::load(src[i]), da, d, cia));
- }
- }
- MM::end();
-}
-
-/*
- result = d * sa
- dest = d * sa * ca + d * cia
- = d * (sa * ca + cia)
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint src, uint const_alpha)
-{
- C_80; C_00;
- m64 a = MM::alpha(MM::load(src));
- if (const_alpha != 255) {
- C_FF;
- m64 ca = MM::load_alpha(const_alpha);
- m64 cia = MM::negate(ca);
- a = MM::byte_mul(a, ca);
- a = MM::add(a, cia);
- }
- for (int i = 0; i < length; ++i)
- dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), a));
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha)
-{
- C_FF; C_80; C_00;
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- m64 a = MM::alpha(MM::load(src[i]));
- dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), a));
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- m64 cia = MM::negate(ca);
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- m64 a = MM::alpha(MM::load(src[i]));
- a = MM::byte_mul(a, ca);
- a = MM::add(a, cia);
- dest[i] = MM::store(MM::byte_mul(d, a));
- }
- }
- MM::end();
-}
-
-/*
- result = s * dia
- dest = s * dia * ca + d * cia
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint src, uint const_alpha)
-{
- C_FF; C_80; C_00;
- m64 s = MM::load(src);
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- m64 dia = MM::negate(MM::alpha(MM::load(dest[i])));
- dest[i] = MM::store(MM::byte_mul(s, dia));
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- m64 cia = MM::negate(ca);
- s = MM::byte_mul(s, ca);
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::negate(MM::alpha(d)), d, cia));
- }
- }
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha)
-{
- C_FF; C_80; C_00;
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- m64 ia = MM::negate(MM::alpha(MM::load(dest[i])));
- dest[i] = MM::store(MM::byte_mul(MM::load(src[i]), ia));
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- m64 cia = MM::negate(ca);
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- m64 dia = MM::byte_mul(MM::negate(MM::alpha(d)), ca);
- dest[i] = MM::store(MM::interpolate_pixel_255(MM::load(src[i]), dia, d, cia));
- }
- }
- MM::end();
-}
-
-/*
- result = d * sia
- dest = d * sia * ca + d * cia
- = d * (sia * ca + cia)
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint src, uint const_alpha)
-{
- C_FF; C_80; C_00;
- m64 a = MM::negate(MM::alpha(MM::load(src)));
- if (const_alpha != 255) {
- m64 ca = MM::load_alpha(const_alpha);
- a = MM::byte_mul(a, ca);
- a = MM::add(a, MM::negate(ca));
- }
- for (int i = 0; i < length; ++i)
- dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), a));
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha)
-{
- C_FF; C_80; C_00;
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- m64 a = MM::negate(MM::alpha(MM::load(src[i])));
- dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), a));
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- m64 cia = MM::negate(ca);
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- m64 a = MM::negate(MM::alpha(MM::load(src[i])));
- a = MM::byte_mul(a, ca);
- a = MM::add(a, cia);
- dest[i] = MM::store(MM::byte_mul(d, a));
- }
- }
- MM::end();
-}
-
-/*
- result = s*da + d*sia
- dest = s*da*ca + d*sia*ca + d *cia
- = s*ca * da + d * (sia*ca + cia)
- = s*ca * da + d * (1 - sa*ca)
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint src, uint const_alpha)
-{
- C_FF; C_80; C_00;
- m64 s = MM::load(src);
- if (const_alpha != 255) {
- m64 ca = MM::load_alpha(const_alpha);
- s = MM::byte_mul(s, ca);
- }
- m64 a = MM::negate(MM::alpha(s));
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::alpha(d), d, a));
- }
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha)
-{
- C_FF; C_80; C_00;
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- m64 s = MM::load(src[i]);
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::alpha(d), d,
- MM::negate(MM::alpha(s))));
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- for (int i = 0; i < length; ++i) {
- m64 s = MM::load(src[i]);
- s = MM::byte_mul(s, ca);
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::alpha(d), d,
- MM::negate(MM::alpha(s))));
- }
- }
- MM::end();
-}
-
-/*
- result = d*sa + s*dia
- dest = d*sa*ca + s*dia*ca + d *cia
- = s*ca * dia + d * (sa*ca + cia)
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint src, uint const_alpha)
-{
- C_FF; C_80; C_00;
- m64 s = MM::load(src);
- m64 a = MM::alpha(s);
- if (const_alpha != 255) {
- m64 ca = MM::load_alpha(const_alpha);
- s = MM::byte_mul(s, ca);
- a = MM::alpha(s);
- a = MM::add(a, MM::negate(ca));
- }
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::negate(MM::alpha(d)), d, a));
- }
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha)
-{
- C_FF; C_80; C_00;
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- m64 s = MM::load(src[i]);
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(d, MM::alpha(s), s,
- MM::negate(MM::alpha(d))));
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- for (int i = 0; i < length; ++i) {
- m64 s = MM::load(src[i]);
- s = MM::byte_mul(s, ca);
- m64 d = MM::load(dest[i]);
- m64 a = MM::alpha(s);
- a = MM::add(a, MM::negate(ca));
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::negate(MM::alpha(d)),
- d, a));
- }
- }
- MM::end();
-}
-
-/*
- result = d*sia + s*dia
- dest = d*sia*ca + s*dia*ca + d *cia
- = s*ca * dia + d * (sia*ca + cia)
- = s*ca * dia + d * (1 - sa*ca)
-*/
-template <class MM>
-static void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint src, uint const_alpha)
-{
- C_FF; C_80; C_00;
- m64 s = MM::load(src);
- if (const_alpha != 255) {
- m64 ca = MM::load_alpha(const_alpha);
- s = MM::byte_mul(s, ca);
- }
- m64 a = MM::negate(MM::alpha(s));
- for (int i = 0; i < length; ++i) {
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::negate(MM::alpha(d)),
- d, a));
- }
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha)
-{
- C_FF; C_80; C_00;
- if (const_alpha == 255) {
- for (int i = 0; i < length; ++i) {
- m64 s = MM::load(src[i]);
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::negate(MM::alpha(d)),
- d, MM::negate(MM::alpha(s))));
- }
- } else {
- m64 ca = MM::load_alpha(const_alpha);
- for (int i = 0; i < length; ++i) {
- m64 s = MM::load(src[i]);
- s = MM::byte_mul(s, ca);
- m64 d = MM::load(dest[i]);
- dest[i] = MM::store(MM::interpolate_pixel_255(s, MM::negate(MM::alpha(d)),
- d, MM::negate(MM::alpha(s))));
- }
- }
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
-{
- Q_UNUSED(const_alpha);
-
- if ((quintptr)(dest) & 0x7) {
- *dest++ |= color;
- --length;
- }
-
- const int length64 = length / 2;
- if (length64) {
- __m64 *dst64 = reinterpret_cast<__m64*>(dest);
- const __m64 color64 = _mm_set_pi32(color, color);
-
- int n = (length64 + 3) / 4;
- switch (length64 & 0x3) {
- case 0: do { *dst64 = _mm_or_si64(*dst64, color64); ++dst64;
- case 3: *dst64 = _mm_or_si64(*dst64, color64); ++dst64;
- case 2: *dst64 = _mm_or_si64(*dst64, color64); ++dst64;
- case 1: *dst64 = _mm_or_si64(*dst64, color64); ++dst64;
- } while (--n > 0);
- }
- }
-
- if (length & 0x1) {
- dest[length - 1] |= color;
- }
-
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
-{
- Q_UNUSED(const_alpha);
-
- color |= 0xff000000;
-
- if ((quintptr)(dest) & 0x7) { // align
- *dest++ &= color;
- --length;
- }
-
- const int length64 = length / 2;
- if (length64) {
- __m64 *dst64 = reinterpret_cast<__m64*>(dest);
- const __m64 color64 = _mm_set_pi32(color, color);
-
- int n = (length64 + 3) / 4;
- switch (length64 & 0x3) {
- case 0: do { *dst64 = _mm_and_si64(*dst64, color64); ++dst64;
- case 3: *dst64 = _mm_and_si64(*dst64, color64); ++dst64;
- case 2: *dst64 = _mm_and_si64(*dst64, color64); ++dst64;
- case 1: *dst64 = _mm_and_si64(*dst64, color64); ++dst64;
- } while (--n > 0);
- }
- }
-
- if (length & 0x1) {
- dest[length - 1] &= color;
- }
-
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
-{
- Q_UNUSED(const_alpha);
-
- color &= 0x00ffffff;
-
- if ((quintptr)(dest) & 0x7) {
- *dest++ ^= color;
- --length;
- }
-
- const int length64 = length / 2;
- if (length64) {
- __m64 *dst64 = reinterpret_cast<__m64*>(dest);
- const __m64 color64 = _mm_set_pi32(color, color);
-
- int n = (length64 + 3) / 4;
- switch (length64 & 0x3) {
- case 0: do { *dst64 = _mm_xor_si64(*dst64, color64); ++dst64;
- case 3: *dst64 = _mm_xor_si64(*dst64, color64); ++dst64;
- case 2: *dst64 = _mm_xor_si64(*dst64, color64); ++dst64;
- case 1: *dst64 = _mm_xor_si64(*dst64, color64); ++dst64;
- } while (--n > 0);
- }
- }
-
- if (length & 0x1) {
- dest[length - 1] ^= color;
- }
-
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
-{
-
- Q_UNUSED(const_alpha);
-
- if ((quintptr)(dest) & 0x7) {
- *dest = (color & ~(*dest)) | 0xff000000;
- ++dest;
- --length;
- }
-
- const int length64 = length / 2;
- if (length64) {
- __m64 *dst64 = reinterpret_cast<__m64*>(dest);
- const __m64 color64 = _mm_set_pi32(color, color);
- const m64 mmx_0xff000000 = _mm_set1_pi32(0xff000000);
- __m64 tmp1, tmp2, tmp3, tmp4;
-
- int n = (length64 + 3) / 4;
- switch (length64 & 0x3) {
- case 0: do { tmp1 = _mm_andnot_si64(*dst64, color64);
- *dst64++ = _mm_or_si64(tmp1, mmx_0xff000000);
- case 3: tmp2 = _mm_andnot_si64(*dst64, color64);
- *dst64++ = _mm_or_si64(tmp2, mmx_0xff000000);
- case 2: tmp3 = _mm_andnot_si64(*dst64, color64);
- *dst64++ = _mm_or_si64(tmp3, mmx_0xff000000);
- case 1: tmp4 = _mm_andnot_si64(*dst64, color64);
- *dst64++ = _mm_or_si64(tmp4, mmx_0xff000000);
- } while (--n > 0);
- }
- }
-
- if (length & 0x1) {
- dest[length - 1] = (color & ~(dest[length - 1])) | 0xff000000;
- }
-
- MM::end();
-}
-
-template <class MM>
-static void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
-{
- rasterop_solid_SourceAndNotDestination<MM>(dest, length,
- ~color, const_alpha);
-}
-
-template <class MM>
-static void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- color = ~color | 0xff000000;
- while (length--) {
- *dest = color | ~(*dest);
- ++dest;
- }
-}
-
-template <class MM>
-static void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
-{
- rasterop_solid_SourceXorDestination<MM>(dest, length, ~color, const_alpha);
-}
-
-template <class MM>
-static void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length,
- uint color, uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- qt_memfill((quint32*)dest, ~color | 0xff000000, length);
-}
-
-template <class MM>
-static void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
-{
- rasterop_solid_SourceAndDestination<MM>(dest, length,
- ~color, const_alpha);
-}
-
-template <class MM>
-static inline void qt_blend_color_argb_x86(int count, const QSpan *spans,
- void *userData,
- CompositionFunctionSolid *solidFunc)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- if (data->rasterBuffer->compositionMode == QPainter::CompositionMode_Source
- || (data->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver
- && qAlpha(data->solid.color) == 255)) {
- // inline for performance
- C_FF; C_80; C_00;
- while (count--) {
- uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x;
- if (spans->coverage == 255) {
- qt_memfill(static_cast<quint32*>(target), quint32(data->solid.color), spans->len);
- } else {
- // dest = s * ca + d * (1 - sa*ca) --> dest = s * ca + d * (1-ca)
- m64 ca = MM::load_alpha(spans->coverage);
- m64 s = MM::byte_mul(MM::load(data->solid.color), ca);
- m64 ica = MM::negate(ca);
- for (int i = 0; i < spans->len; ++i)
- target[i] = MM::store(MM::add(s, MM::byte_mul(MM::load(target[i]), ica)));
- }
- ++spans;
- }
- MM::end();
- return;
- }
- CompositionFunctionSolid func = solidFunc[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;
- }
-}
-
-#ifdef QT_HAVE_MMX
-struct QMMXIntrinsics : public QMMXCommonIntrinsics
-{
- static inline void end() {
-#if !defined(Q_OS_WINCE) || defined(_X86_)
- _mm_empty();
-#endif
- }
-};
-#endif // QT_HAVE_MMX
-
-QT_END_NAMESPACE
-
-#endif // QDRAWHELPER_MMX_P_H
diff --git a/src/gui/painting/qdrawhelper_sse.cpp b/src/gui/painting/qdrawhelper_sse.cpp
deleted file mode 100644
index dd83098fe5..0000000000
--- a/src/gui/painting/qdrawhelper_sse.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.1, 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qdrawhelper_p.h>
-
-#ifdef QT_HAVE_SSE
-
-#include <private/qdrawhelper_sse_p.h>
-
-QT_BEGIN_NAMESPACE
-
-CompositionFunctionSolid qt_functionForModeSolid_SSE[numCompositionFunctions] = {
- comp_func_solid_SourceOver<QSSEIntrinsics>,
- comp_func_solid_DestinationOver<QSSEIntrinsics>,
- comp_func_solid_Clear<QSSEIntrinsics>,
- comp_func_solid_Source<QSSEIntrinsics>,
- 0,
- comp_func_solid_SourceIn<QSSEIntrinsics>,
- comp_func_solid_DestinationIn<QSSEIntrinsics>,
- comp_func_solid_SourceOut<QSSEIntrinsics>,
- comp_func_solid_DestinationOut<QSSEIntrinsics>,
- comp_func_solid_SourceAtop<QSSEIntrinsics>,
- comp_func_solid_DestinationAtop<QSSEIntrinsics>,
- comp_func_solid_XOR<QSSEIntrinsics>,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // svg 1.2 modes
- rasterop_solid_SourceOrDestination<QMMXIntrinsics>,
- rasterop_solid_SourceAndDestination<QMMXIntrinsics>,
- rasterop_solid_SourceXorDestination<QMMXIntrinsics>,
- rasterop_solid_NotSourceAndNotDestination<QMMXIntrinsics>,
- rasterop_solid_NotSourceOrNotDestination<QMMXIntrinsics>,
- rasterop_solid_NotSourceXorDestination<QMMXIntrinsics>,
- rasterop_solid_NotSource<QMMXIntrinsics>,
- rasterop_solid_NotSourceAndDestination<QMMXIntrinsics>,
- rasterop_solid_SourceAndNotDestination<QMMXIntrinsics>
-};
-
-CompositionFunction qt_functionForMode_SSE[numCompositionFunctions] = {
- comp_func_SourceOver<QSSEIntrinsics>,
- comp_func_DestinationOver<QSSEIntrinsics>,
- comp_func_Clear<QSSEIntrinsics>,
- comp_func_Source<QSSEIntrinsics>,
- comp_func_Destination,
- comp_func_SourceIn<QSSEIntrinsics>,
- comp_func_DestinationIn<QSSEIntrinsics>,
- comp_func_SourceOut<QSSEIntrinsics>,
- comp_func_DestinationOut<QSSEIntrinsics>,
- comp_func_SourceAtop<QSSEIntrinsics>,
- comp_func_DestinationAtop<QSSEIntrinsics>,
- comp_func_XOR<QSSEIntrinsics>,
- 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
-};
-
-void qt_blend_color_argb_sse(int count, const QSpan *spans, void *userData)
-{
- qt_blend_color_argb_x86<QSSEIntrinsics>(count, spans, userData,
- (CompositionFunctionSolid*)qt_functionForModeSolid_SSE);
-}
-
-void qt_memfill32_sse(quint32 *dest, quint32 value, int count)
-{
- return qt_memfill32_sse_template<QSSEIntrinsics>(dest, value, count);
-}
-
-void qt_bitmapblit16_sse(QRasterBuffer *rasterBuffer, int x, int y,
- quint32 color,
- const uchar *src,
- int width, int height, int stride)
-{
- return qt_bitmapblit16_sse_template<QSSEIntrinsics>(rasterBuffer, x,y,
- color, src, width,
- height, stride);
-}
-
-void qt_blend_argb32_on_argb32_sse(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha)
-{
- const uint *src = (const uint *) srcPixels;
- uint *dst = (uint *) destPixels;
-
- uint ca = const_alpha - 1;
-
- for (int y=0; y<h; ++y) {
- comp_func_SourceOver<QSSEIntrinsics>(dst, src, w, ca);
- dst = (quint32 *)(((uchar *) dst) + dbpl);
- src = (const quint32 *)(((const uchar *) src) + sbpl);
- }
-}
-
-void qt_blend_rgb32_on_rgb32_sse(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha)
-{
- const uint *src = (const uint *) srcPixels;
- uint *dst = (uint *) destPixels;
-
- uint ca = const_alpha - 1;
-
- for (int y=0; y<h; ++y) {
- comp_func_Source<QSSEIntrinsics>(dst, src, w, ca);
- dst = (quint32 *)(((uchar *) dst) + dbpl);
- src = (const quint32 *)(((const uchar *) src) + sbpl);
- }
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_HAVE_SSE
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 7b57d5c5e2..2c87aabe93 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -310,7 +310,7 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u
}
}
-CompositionFunctionSolid qt_functionForModeSolid_onlySSE2[numCompositionFunctions] = {
+CompositionFunctionSolid qt_functionForModeSolid_SSE2[numCompositionFunctions] = {
comp_func_solid_SourceOver_sse2,
comp_func_solid_DestinationOver,
comp_func_solid_Clear,
@@ -346,7 +346,7 @@ CompositionFunctionSolid qt_functionForModeSolid_onlySSE2[numCompositionFunction
rasterop_solid_SourceAndNotDestination
};
-CompositionFunction qt_functionForMode_onlySSE2[numCompositionFunctions] = {
+CompositionFunction qt_functionForMode_SSE2[numCompositionFunctions] = {
comp_func_SourceOver_sse2,
comp_func_DestinationOver,
comp_func_Clear,
diff --git a/src/gui/painting/qdrawhelper_sse3dnow.cpp b/src/gui/painting/qdrawhelper_sse3dnow.cpp
deleted file mode 100644
index 1cca6b6c1d..0000000000
--- a/src/gui/painting/qdrawhelper_sse3dnow.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.1, 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qdrawhelper_x86_p.h>
-
-#if defined(QT_HAVE_3DNOW) && defined(QT_HAVE_SSE)
-
-#include <private/qdrawhelper_sse_p.h>
-#include <mm3dnow.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QSSE3DNOWIntrinsics : public QSSEIntrinsics
-{
- static inline void end() {
- _m_femms();
- }
-};
-
-CompositionFunctionSolid qt_functionForModeSolid_SSE3DNOW[numCompositionFunctions] = {
- comp_func_solid_SourceOver<QSSE3DNOWIntrinsics>,
- comp_func_solid_DestinationOver<QSSE3DNOWIntrinsics>,
- comp_func_solid_Clear<QSSE3DNOWIntrinsics>,
- comp_func_solid_Source<QSSE3DNOWIntrinsics>,
- 0,
- comp_func_solid_SourceIn<QSSE3DNOWIntrinsics>,
- comp_func_solid_DestinationIn<QSSE3DNOWIntrinsics>,
- comp_func_solid_SourceOut<QSSE3DNOWIntrinsics>,
- comp_func_solid_DestinationOut<QSSE3DNOWIntrinsics>,
- comp_func_solid_SourceAtop<QSSE3DNOWIntrinsics>,
- comp_func_solid_DestinationAtop<QSSE3DNOWIntrinsics>,
- comp_func_solid_XOR<QSSE3DNOWIntrinsics>,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // svg 1.2 modes
- rasterop_solid_SourceOrDestination<QSSE3DNOWIntrinsics>,
- rasterop_solid_SourceAndDestination<QSSE3DNOWIntrinsics>,
- rasterop_solid_SourceXorDestination<QSSE3DNOWIntrinsics>,
- rasterop_solid_NotSourceAndNotDestination<QSSE3DNOWIntrinsics>,
- rasterop_solid_NotSourceOrNotDestination<QSSE3DNOWIntrinsics>,
- rasterop_solid_NotSourceXorDestination<QSSE3DNOWIntrinsics>,
- rasterop_solid_NotSource<QSSE3DNOWIntrinsics>,
- rasterop_solid_NotSourceAndDestination<QSSE3DNOWIntrinsics>,
- rasterop_solid_SourceAndNotDestination<QSSE3DNOWIntrinsics>
-};
-
-CompositionFunction qt_functionForMode_SSE3DNOW[numCompositionFunctions] = {
- comp_func_SourceOver<QSSE3DNOWIntrinsics>,
- comp_func_DestinationOver<QSSE3DNOWIntrinsics>,
- comp_func_Clear<QSSE3DNOWIntrinsics>,
- comp_func_Source<QSSE3DNOWIntrinsics>,
- comp_func_Destination,
- comp_func_SourceIn<QSSE3DNOWIntrinsics>,
- comp_func_DestinationIn<QSSE3DNOWIntrinsics>,
- comp_func_SourceOut<QSSE3DNOWIntrinsics>,
- comp_func_DestinationOut<QSSE3DNOWIntrinsics>,
- comp_func_SourceAtop<QSSE3DNOWIntrinsics>,
- comp_func_DestinationAtop<QSSE3DNOWIntrinsics>,
- comp_func_XOR<QSSE3DNOWIntrinsics>,
- 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
-};
-
-void qt_blend_color_argb_sse3dnow(int count, const QSpan *spans, void *userData)
-{
- qt_blend_color_argb_x86<QSSE3DNOWIntrinsics>(count, spans, userData,
- (CompositionFunctionSolid*)qt_functionForModeSolid_SSE3DNOW);
-}
-
-void qt_memfill32_sse3dnow(quint32 *dest, quint32 value, int count)
-{
- return qt_memfill32_sse_template<QSSE3DNOWIntrinsics>(dest, value, count);
-}
-
-
-void qt_bitmapblit16_sse3dnow(QRasterBuffer *rasterBuffer, int x, int y,
- quint32 color,
- const uchar *src,
- int width, int height, int stride)
-{
- return qt_bitmapblit16_sse_template<QSSE3DNOWIntrinsics>(rasterBuffer, x,y,
- color, src, width,
- height, stride);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_HAVE_3DNOW && QT_HAVE_SSE
diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h
index ada0bec0e3..93abaf4fff 100644
--- a/src/gui/painting/qdrawhelper_x86_p.h
+++ b/src/gui/painting/qdrawhelper_x86_p.h
@@ -57,54 +57,6 @@
QT_BEGIN_NAMESPACE
-#ifdef QT_HAVE_MMX
-extern CompositionFunction qt_functionForMode_MMX[];
-extern CompositionFunctionSolid qt_functionForModeSolid_MMX[];
-void qt_blend_color_argb_mmx(int count, const QSpan *spans, void *userData);
-#endif
-
-#ifdef QT_HAVE_MMXEXT
-void qt_memfill32_mmxext(quint32 *dest, quint32 value, int count);
-void qt_bitmapblit16_mmxext(QRasterBuffer *rasterBuffer, int x, int y,
- quint32 color, const uchar *src,
- int width, int height, int stride);
-#endif
-
-#ifdef QT_HAVE_3DNOW
-#if defined(QT_HAVE_MMX) || !defined(QT_HAVE_SSE)
-extern CompositionFunction qt_functionForMode_MMX3DNOW[];
-extern CompositionFunctionSolid qt_functionForModeSolid_MMX3DNOW[];
-
-void qt_blend_color_argb_mmx3dnow(int count, const QSpan *spans,
- void *userData);
-#endif // MMX
-
-#ifdef QT_HAVE_SSE
-extern CompositionFunction qt_functionForMode_SSE3DNOW[];
-extern CompositionFunctionSolid qt_functionForModeSolid_SSE3DNOW[];
-
-void qt_memfill32_sse3dnow(quint32 *dest, quint32 value, int count);
-void qt_bitmapblit16_sse3dnow(QRasterBuffer *rasterBuffer, int x, int y,
- quint32 color,
- const uchar *src, int width, int height,
- int stride);
-void qt_blend_color_argb_sse3dnow(int count, const QSpan *spans,
- void *userData);
-#endif // SSE
-#endif // QT_HAVE_3DNOW
-
-#ifdef QT_HAVE_SSE
-void qt_memfill32_sse(quint32 *dest, quint32 value, int count);
-void qt_bitmapblit16_sse(QRasterBuffer *rasterBuffer, int x, int y,
- quint32 color,
- const uchar *src, int width, int height, int stride);
-
-void qt_blend_color_argb_sse(int count, const QSpan *spans, void *userData);
-
-extern CompositionFunction qt_functionForMode_SSE[];
-extern CompositionFunctionSolid qt_functionForModeSolid_SSE[];
-#endif // QT_HAVE_SSE
-
#ifdef QT_HAVE_SSE2
void qt_memfill32_sse2(quint32 *dest, quint32 value, int count);
void qt_memfill16_sse2(quint16 *dest, quint16 value, int count);
@@ -123,8 +75,8 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
int w, int h,
int const_alpha);
-extern CompositionFunction qt_functionForMode_onlySSE2[];
-extern CompositionFunctionSolid qt_functionForModeSolid_onlySSE2[];
+extern CompositionFunction qt_functionForMode_SSE2[];
+extern CompositionFunctionSolid qt_functionForModeSolid_SSE2[];
#endif // QT_HAVE_SSE2
#ifdef QT_HAVE_IWMMXT
diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp
index 9a57404169..309b619082 100644
--- a/src/gui/painting/qpaintbuffer.cpp
+++ b/src/gui/painting/qpaintbuffer.cpp
@@ -98,19 +98,6 @@ QTextItemIntCopy::~QTextItemIntCopy()
/************************************************************************
*
- * QPaintBufferSignalProxy
- *
- ************************************************************************/
-
-Q_GLOBAL_STATIC(QPaintBufferSignalProxy, theSignalProxy)
-
-QPaintBufferSignalProxy *QPaintBufferSignalProxy::instance()
-{
- return theSignalProxy();
-}
-
-/************************************************************************
- *
* QPaintBufferPrivate
*
************************************************************************/
@@ -124,8 +111,6 @@ QPaintBufferPrivate::QPaintBufferPrivate()
QPaintBufferPrivate::~QPaintBufferPrivate()
{
- QPaintBufferSignalProxy::instance()->emitAboutToDestroy(this);
-
for (int i = 0; i < commands.size(); ++i) {
const QPaintBufferCommand &cmd = commands.at(i);
if (cmd.id == QPaintBufferPrivate::Cmd_DrawTextItem)
@@ -2058,45 +2043,6 @@ void QPaintEngineExReplayer::process(const QPaintBufferCommand &cmd)
}
}
-QPaintBufferResource::QPaintBufferResource(FreeFunc f, QObject *parent) : QObject(parent), free(f)
-{
- connect(QPaintBufferSignalProxy::instance(), SIGNAL(aboutToDestroy(const QPaintBufferPrivate*)), this, SLOT(remove(const QPaintBufferPrivate*)));
-}
-
-QPaintBufferResource::~QPaintBufferResource()
-{
- for (Cache::iterator it = m_cache.begin(); it != m_cache.end(); ++it)
- free(it.value());
-}
-
-void QPaintBufferResource::insert(const QPaintBufferPrivate *key, void *value)
-{
- Cache::iterator it = m_cache.find(key);
- if (it != m_cache.end()) {
- free(it.value());
- it.value() = value;
- } else {
- m_cache.insert(key, value);
- }
-}
-
-void *QPaintBufferResource::value(const QPaintBufferPrivate *key)
-{
- Cache::iterator it = m_cache.find(key);
- if (it != m_cache.end())
- return it.value();
- return 0;
-}
-
-void QPaintBufferResource::remove(const QPaintBufferPrivate *key)
-{
- Cache::iterator it = m_cache.find(key);
- if (it != m_cache.end()) {
- free(it.value());
- m_cache.erase(it);
- }
-}
-
QDataStream &operator<<(QDataStream &stream, const QPaintBufferCommand &command)
{
quint32 id = command.id;
diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h
index 0a049fa06e..24886076f5 100644
--- a/src/gui/painting/qpaintbuffer_p.h
+++ b/src/gui/painting/qpaintbuffer_p.h
@@ -421,41 +421,6 @@ public:
mutable QPainterState *m_created_state;
};
-class Q_GUI_EXPORT QPaintBufferSignalProxy : public QObject
-{
- Q_OBJECT
-public:
- QPaintBufferSignalProxy() : QObject() {}
- void emitAboutToDestroy(const QPaintBufferPrivate *buffer) {
- emit aboutToDestroy(buffer);
- }
- static QPaintBufferSignalProxy *instance();
-Q_SIGNALS:
- void aboutToDestroy(const QPaintBufferPrivate *buffer);
-};
-
-// One resource per paint buffer and vice versa.
-class Q_GUI_EXPORT QPaintBufferResource : public QObject
-{
- Q_OBJECT
-public:
- typedef void (*FreeFunc)(void *);
-
- QPaintBufferResource(FreeFunc f, QObject *parent = 0);
- ~QPaintBufferResource();
- // Set resource 'value' for 'key'.
- void insert(const QPaintBufferPrivate *key, void *value);
- // Return resource for 'key'.
- void *value(const QPaintBufferPrivate *key);
-public slots:
- // Remove entry 'key' from cache and delete resource.
- void remove(const QPaintBufferPrivate *key);
-private:
- typedef QHash<const QPaintBufferPrivate *, void *> Cache;
- Cache m_cache;
- FreeFunc free;
-};
-
QT_END_NAMESPACE
#endif // QPAINTBUFFER_P_H
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 15f344bf81..e73fb5eb74 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -84,6 +84,54 @@
QT_BEGIN_NAMESPACE
+class QRectVectorPath : public QVectorPath {
+public:
+ inline void set(const QRect &r) {
+ qreal left = r.x();
+ qreal right = r.x() + r.width();
+ qreal top = r.y();
+ qreal bottom = r.y() + r.height();
+ pts[0] = left;
+ pts[1] = top;
+ pts[2] = right;
+ pts[3] = top;
+ pts[4] = right;
+ pts[5] = bottom;
+ pts[6] = left;
+ pts[7] = bottom;
+ }
+
+ inline void set(const QRectF &r) {
+ qreal left = r.x();
+ qreal right = r.x() + r.width();
+ qreal top = r.y();
+ qreal bottom = r.y() + r.height();
+ pts[0] = left;
+ pts[1] = top;
+ pts[2] = right;
+ pts[3] = top;
+ pts[4] = right;
+ pts[5] = bottom;
+ pts[6] = left;
+ pts[7] = bottom;
+ }
+ inline QRectVectorPath(const QRect &r)
+ : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
+ {
+ set(r);
+ }
+ inline QRectVectorPath(const QRectF &r)
+ : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
+ {
+ set(r);
+ }
+ inline QRectVectorPath()
+ : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
+ { }
+
+ qreal pts[8];
+};
+
Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
#define qreal_to_fixed_26_6(f) (int(f * 64))
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index f1310a5dca..45c8f01de2 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -207,13 +207,6 @@ public:
ClipType clipType() const;
QRect clipBoundingRect() const;
-#ifdef Q_NO_USING_KEYWORD
- inline void drawEllipse(const QRect &rect) { QPaintEngineEx::drawEllipse(rect); }
-#else
- using QPaintEngineEx::drawPolygon;
- using QPaintEngineEx::drawEllipse;
-#endif
-
void releaseBuffer();
QSize size() const;
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index eaa3b3b1cf..dd2f507653 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -71,67 +71,6 @@ class QPaintEngineExPrivate;
class QStaticTextItem;
struct StrokeHandler;
-struct QIntRect {
- int x1, y1, x2, y2;
- inline void set(const QRect &r) {
- x1 = r.x();
- y1 = r.y();
- x2 = r.right() + 1;
- y2 = r.bottom() + 1;
- // We will assume normalized for later...
- Q_ASSERT(x2 >= x1);
- Q_ASSERT(y2 >= y1);
- }
-};
-
-class QRectVectorPath : public QVectorPath {
-public:
- inline void set(const QRect &r) {
- qreal left = r.x();
- qreal right = r.x() + r.width();
- qreal top = r.y();
- qreal bottom = r.y() + r.height();
- pts[0] = left;
- pts[1] = top;
- pts[2] = right;
- pts[3] = top;
- pts[4] = right;
- pts[5] = bottom;
- pts[6] = left;
- pts[7] = bottom;
- }
-
- inline void set(const QRectF &r) {
- qreal left = r.x();
- qreal right = r.x() + r.width();
- qreal top = r.y();
- qreal bottom = r.y() + r.height();
- pts[0] = left;
- pts[1] = top;
- pts[2] = right;
- pts[3] = top;
- pts[4] = right;
- pts[5] = bottom;
- pts[6] = left;
- pts[7] = bottom;
- }
- inline QRectVectorPath(const QRect &r)
- : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
- {
- set(r);
- }
- inline QRectVectorPath(const QRectF &r)
- : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
- {
- set(r);
- }
- inline QRectVectorPath()
- : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose)
- { }
-
- qreal pts[8];
-};
-
#ifndef QT_NO_DEBUG_STREAM
QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path);
#endif
@@ -251,16 +190,6 @@ public:
QRect exDeviceRect;
};
-inline uint QVectorPath::polygonFlags(QPaintEngine::PolygonDrawMode mode) {
- switch (mode) {
- case QPaintEngine::ConvexMode: return ConvexPolygonHint | ImplicitClose;
- case QPaintEngine::OddEvenMode: return PolygonHint | OddEvenFill | ImplicitClose;
- case QPaintEngine::WindingMode: return PolygonHint | WindingFill | ImplicitClose;
- case QPaintEngine::PolylineMode: return PolygonHint;
- default: return 0;
- }
-}
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 8912d191f0..97b0f91c26 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -970,10 +970,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
\warning When the paintdevice is a widget, QPainter can only be
used inside a paintEvent() function or in a function called by
- paintEvent(); that is unless the Qt::WA_PaintOutsidePaintEvent
- widget attribute is set. On Mac OS X and Windows, you can only
- paint in a paintEvent() function regardless of this attribute's
- setting.
+ paintEvent().
\tableofcontents
@@ -1760,25 +1757,6 @@ bool QPainter::begin(QPaintDevice *pd)
d->engine->state = d->state;
switch (pd->devType()) {
-#if 0
- // is this needed any more??
- case QInternal::Widget:
- {
- const QWidget *widget = static_cast<const QWidget *>(pd);
- Q_ASSERT(widget);
-
- const bool paintOutsidePaintEvent = widget->testAttribute(Qt::WA_PaintOutsidePaintEvent);
- const bool inPaintEvent = widget->testAttribute(Qt::WA_WState_InPaintEvent);
-
- // Adjust offset for alien widgets painting outside the paint event.
- if (!inPaintEvent && paintOutsidePaintEvent && !widget->internalWinId()
- && widget->testAttribute(Qt::WA_WState_Created)) {
- const QPoint offset = widget->mapTo(widget->nativeParentWidget(), QPoint());
- d->state->redirectionMatrix.translate(offset.x(), offset.y());
- }
- break;
- }
-#endif
case QInternal::Pixmap:
{
QPixmap *pm = static_cast<QPixmap *>(pd);
@@ -5616,9 +5594,9 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio
QVarLengthArray<QFixed, 128> advances(glyphCount);
QVarLengthArray<QGlyphJustification, 128> glyphJustifications(glyphCount);
QVarLengthArray<HB_GlyphAttributes, 128> glyphAttributes(glyphCount);
- qMemSet(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes));
- qMemSet(advances.data(), 0, advances.size() * sizeof(QFixed));
- qMemSet(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification));
+ memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes));
+ memset(advances.data(), 0, advances.size() * sizeof(QFixed));
+ memset(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification));
textItem.glyphs.numGlyphs = glyphCount;
textItem.glyphs.glyphs = reinterpret_cast<HB_Glyph *>(const_cast<quint32 *>(glyphArray));
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index 97c10a2764..5ea38682b8 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -465,7 +465,6 @@ public:
private:
Q_DISABLE_COPY(QPainter)
- friend class Q3Painter;
QScopedPointer<QPainterPrivate> d_ptr;
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index 7b0547ad45..c617521369 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -57,8 +57,8 @@ class Q_GUI_EXPORT QPdfWriter : public QObject, public QPagedPaintDevice
{
Q_OBJECT
public:
- QPdfWriter(const QString &filename);
- QPdfWriter(QIODevice *device);
+ explicit QPdfWriter(const QString &filename);
+ explicit QPdfWriter(QIODevice *device);
~QPdfWriter();
QString title() const;
diff --git a/src/gui/painting/qplatformbackingstore_qpa.h b/src/gui/painting/qplatformbackingstore_qpa.h
index acf184b8e9..a4df63f4d4 100644
--- a/src/gui/painting/qplatformbackingstore_qpa.h
+++ b/src/gui/painting/qplatformbackingstore_qpa.h
@@ -73,7 +73,7 @@ class QPlatformWindow;
class Q_GUI_EXPORT QPlatformBackingStore
{
public:
- QPlatformBackingStore(QWindow *window);
+ explicit QPlatformBackingStore(QWindow *window);
virtual ~QPlatformBackingStore();
QWindow *window() const;
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h
index 0a089d3cf3..726ed434ed 100644
--- a/src/gui/painting/qpolygon.h
+++ b/src/gui/painting/qpolygon.h
@@ -61,9 +61,9 @@ class Q_GUI_EXPORT QPolygon : public QVector<QPoint>
public:
inline QPolygon() {}
inline ~QPolygon() {}
- inline QPolygon(int size);
+ inline explicit QPolygon(int size);
inline QPolygon(const QPolygon &a) : QVector<QPoint>(a) {}
- inline QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {}
+ inline /*implicit*/ QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {}
QPolygon(const QRect &r, bool closed=false);
QPolygon(int nPoints, const int *points);
inline void swap(QPolygon &other) { QVector<QPoint>::swap(other); } // prevent QVector<QPoint><->QPolygon swaps
@@ -135,11 +135,11 @@ class Q_GUI_EXPORT QPolygonF : public QVector<QPointF>
public:
inline QPolygonF() {}
inline ~QPolygonF() {}
- inline QPolygonF(int size);
+ inline explicit QPolygonF(int size);
inline QPolygonF(const QPolygonF &a) : QVector<QPointF>(a) {}
- inline QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {}
+ inline /*implicit*/ QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {}
QPolygonF(const QRectF &r);
- QPolygonF(const QPolygon &a);
+ /*implicit*/ QPolygonF(const QPolygon &a);
inline void swap(QPolygonF &other) { QVector<QPointF>::swap(other); } // prevent QVector<QPointF><->QPolygonF swaps
inline void translate(qreal dx, qreal dy);
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index 2ee7d86b97..fc2661fb68 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -139,7 +139,16 @@ public:
inline int elementCount() const { return m_count; }
inline const QPainterPath convertToPainterPath() const;
- static inline uint polygonFlags(QPaintEngine::PolygonDrawMode mode);
+ static inline uint polygonFlags(QPaintEngine::PolygonDrawMode mode)
+ {
+ switch (mode) {
+ case QPaintEngine::ConvexMode: return ConvexPolygonHint | ImplicitClose;
+ case QPaintEngine::OddEvenMode: return PolygonHint | OddEvenFill | ImplicitClose;
+ case QPaintEngine::WindingMode: return PolygonHint | WindingFill | ImplicitClose;
+ case QPaintEngine::PolylineMode: return PolygonHint;
+ default: return 0;
+ }
+ }
struct CacheEntry {
QPaintEngineEx *engine;
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 9cc61198a5..a3019e560c 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -55,7 +55,6 @@ QT_BEGIN_NAMESPACE
class QFontPrivate; /* don't touch */
class QStringList;
class QVariant;
-class Q3TextFormatCollection;
class Q_GUI_EXPORT QFont
{
@@ -272,7 +271,7 @@ public:
inline void resolve(uint mask) { resolve_mask = mask; }
private:
- QFont(QFontPrivate *);
+ explicit QFont(QFontPrivate *);
void detach();
@@ -288,7 +287,6 @@ private:
friend class QApplication;
friend class QWidget;
friend class QWidgetPrivate;
- friend class Q3TextFormatCollection;
friend class QTextLayout;
friend class QTextEngine;
friend class QStackTextEngine;
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp
index d12e2d651c..bf0cfd1404 100644
--- a/src/gui/text/qfontengine_qpa.cpp
+++ b/src/gui/text/qfontengine_qpa.cpp
@@ -612,7 +612,7 @@ void QPAGenerator::writeGMap()
const int numBytes = glyphCount * sizeof(quint32);
qint64 pos = buffer.size();
buffer.resize(pos + numBytes);
- qMemSet(buffer.data() + pos, 0xff, numBytes);
+ memset(buffer.data() + pos, 0xff, numBytes);
dev->seek(pos + numBytes);
}
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 64596ebaf5..23f263b0bd 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -1120,7 +1120,7 @@ void QPFGenerator::writeGMap()
const int numBytes = glyphCount * sizeof(quint32);
qint64 pos = buffer.size();
buffer.resize(pos + numBytes);
- qMemSet(buffer.data() + pos, 0xff, numBytes);
+ memset(buffer.data() + pos, 0xff, numBytes);
dev->seek(pos + numBytes);
}
diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp
index 0f21ae8a1e..4843d7f12e 100644
--- a/src/gui/text/qfontenginedirectwrite.cpp
+++ b/src/gui/text/qfontenginedirectwrite.cpp
@@ -247,7 +247,7 @@ bool QFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, uint *len
return false;
}
- qMemCopy(buffer, tableData, tableSize);
+ memcpy(buffer, tableData, tableSize);
m_directWriteFontFace->ReleaseFontTable(tableContext);
return true;
@@ -597,7 +597,7 @@ QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t,
int size = width * height * 3;
if (size > 0) {
BYTE *alphaValues = new BYTE[size];
- qMemSet(alphaValues, size, 0);
+ memset(alphaValues, size, 0);
hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1,
&rect,
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 7209fbdfc3..fe9e1d16c7 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -535,7 +535,7 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
return qRound(width);
}
- QStackTextEngine layout(text, d.data());
+ QStackTextEngine layout(text, QFont(d.data()));
layout.ignoreBidi = true;
return qRound(layout.width(0, len));
}
@@ -611,7 +611,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
int from = qMax(0, pos - 8);
int to = qMin(text.length(), pos + 8);
QString cstr = QString::fromRawData(text.unicode() + from, to - from);
- QStackTextEngine layout(cstr, d.data());
+ QStackTextEngine layout(cstr, QFont(d.data()));
layout.ignoreBidi = true;
layout.itemize();
width = qRound(layout.width(pos-from, 1));
@@ -660,7 +660,7 @@ QRect QFontMetrics::boundingRect(const QString &text) const
if (text.length() == 0)
return QRect();
- QStackTextEngine layout(text, d.data());
+ QStackTextEngine layout(text, QFont(d.data()));
layout.ignoreBidi = true;
layout.itemize();
glyph_metrics_t gm = layout.boundingBox(0, text.length());
@@ -830,7 +830,7 @@ QRect QFontMetrics::tightBoundingRect(const QString &text) const
if (text.length() == 0)
return QRect();
- QStackTextEngine layout(text, d.data());
+ QStackTextEngine layout(text, QFont(d.data()));
layout.ignoreBidi = true;
layout.itemize();
glyph_metrics_t gm = layout.tightBoundingBox(0, text.length());
@@ -1364,7 +1364,7 @@ qreal QFontMetricsF::width(const QString &text) const
int pos = text.indexOf(QLatin1Char('\x9c'));
int len = (pos != -1) ? pos : text.length();
- QStackTextEngine layout(text, d.data());
+ QStackTextEngine layout(text, QFont(d.data()));
layout.ignoreBidi = true;
layout.itemize();
return layout.width(0, len).toReal();
@@ -1441,7 +1441,7 @@ QRectF QFontMetricsF::boundingRect(const QString &text) const
if (len == 0)
return QRectF();
- QStackTextEngine layout(text, d.data());
+ QStackTextEngine layout(text, QFont(d.data()));
layout.ignoreBidi = true;
layout.itemize();
glyph_metrics_t gm = layout.boundingBox(0, len);
@@ -1614,7 +1614,7 @@ QRectF QFontMetricsF::tightBoundingRect(const QString &text) const
if (text.length() == 0)
return QRect();
- QStackTextEngine layout(text, d.data());
+ QStackTextEngine layout(text, QFont(d.data()));
layout.ignoreBidi = true;
layout.itemize();
glyph_metrics_t gm = layout.tightBoundingBox(0, text.length());
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index 813e0a804a..673dd8f03b 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -221,7 +221,7 @@ QVector<quint32> QGlyphRun::glyphIndexes() const
return d->glyphIndexes;
} else {
QVector<quint32> indexes(d->glyphIndexDataSize);
- qMemCopy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32));
+ memcpy(indexes.data(), d->glyphIndexData, d->glyphIndexDataSize * sizeof(quint32));
return indexes;
}
}
@@ -247,7 +247,7 @@ QVector<QPointF> QGlyphRun::positions() const
return d->glyphPositions;
} else {
QVector<QPointF> glyphPositions(d->glyphPositionDataSize);
- qMemCopy(glyphPositions.data(), d->glyphPositionData,
+ memcpy(glyphPositions.data(), d->glyphPositionData,
d->glyphPositionDataSize * sizeof(QPointF));
return glyphPositions;
}
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 5cdd563a33..3bd4d88872 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -504,7 +504,7 @@ QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyph
int numGlyphs = glyphIndexes.size();
QVarLengthGlyphLayoutArray glyphs(numGlyphs);
- qMemCopy(glyphs.glyphs, glyphIndexes.data(), numGlyphs * sizeof(quint32));
+ memcpy(glyphs.glyphs, glyphIndexes.data(), numGlyphs * sizeof(quint32));
d->fontEngine->recalcAdvances(&glyphs, 0);
diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h
index 244f40b7ed..7107238a95 100644
--- a/src/gui/text/qsyntaxhighlighter.h
+++ b/src/gui/text/qsyntaxhighlighter.h
@@ -66,8 +66,8 @@ class Q_GUI_EXPORT QSyntaxHighlighter : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QSyntaxHighlighter)
public:
- QSyntaxHighlighter(QObject *parent);
- QSyntaxHighlighter(QTextDocument *parent);
+ explicit QSyntaxHighlighter(QObject *parent);
+ explicit QSyntaxHighlighter(QTextDocument *parent);
virtual ~QSyntaxHighlighter();
void setDocument(QTextDocument *doc);
diff --git a/src/gui/text/qtextdocumentwriter.h b/src/gui/text/qtextdocumentwriter.h
index c0dea06f8f..b7743b1ff7 100644
--- a/src/gui/text/qtextdocumentwriter.h
+++ b/src/gui/text/qtextdocumentwriter.h
@@ -59,7 +59,7 @@ class Q_GUI_EXPORT QTextDocumentWriter
public:
QTextDocumentWriter();
QTextDocumentWriter(QIODevice *device, const QByteArray &format);
- QTextDocumentWriter(const QString &fileName, const QByteArray &format = QByteArray());
+ explicit QTextDocumentWriter(const QString &fileName, const QByteArray &format = QByteArray());
~QTextDocumentWriter();
void setFormat (const QByteArray &format);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index e36104370c..793ea4aa9e 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1000,7 +1000,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
kerningEnabled = this->font(si).d->kerning;
HB_ShaperItem entire_shaper_item;
- qMemSet(&entire_shaper_item, 0, sizeof(entire_shaper_item));
+ memset(&entire_shaper_item, 0, sizeof(entire_shaper_item));
entire_shaper_item.string = reinterpret_cast<const HB_UChar16 *>(layoutData->string.constData());
entire_shaper_item.stringLength = layoutData->string.length();
entire_shaper_item.item.script = (HB_Script)si.analysis.script;
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index 5d1e516db7..4f699ee45f 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -59,7 +59,7 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format)
QString name = format.name();
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
name.prepend(QLatin1String("qrc"));
- QUrl url = QUrl::fromEncoded(name.toUtf8());
+ QUrl url = QUrl(name);
const QVariant data = doc->resource(QTextDocument::ImageResource, url);
if (data.type() == QVariant::Pixmap || data.type() == QVariant::Image) {
pm = qvariant_cast<QPixmap>(data);
@@ -134,7 +134,7 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format)
QString name = format.name();
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
name.prepend(QLatin1String("qrc"));
- QUrl url = QUrl::fromEncoded(name.toUtf8());
+ QUrl url = QUrl(name);
const QVariant data = doc->resource(QTextDocument::ImageResource, url);
if (data.type() == QVariant::Image) {
image = qvariant_cast<QImage>(data);
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index dddb802c27..bec574bb83 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -340,7 +340,7 @@ QTextLayout::QTextLayout(const QString& text, const QFont &font, QPaintDevice *p
QFont f(font);
if (paintdevice)
f = QFont(font, paintdevice);
- d = new QTextEngine((text.isNull() ? (const QString&)QString::fromLatin1("") : text), f.d.data());
+ d = new QTextEngine((text.isNull() ? (const QString&)QString::fromLatin1("") : text), f);
}
/*!
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index 80adeb602c..c03805b95f 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -366,7 +366,7 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF
QString name = imageFormat.name();
if (name.startsWith(QLatin1String(":/"))) // auto-detect resources
name.prepend(QLatin1String("qrc"));
- QUrl url = QUrl::fromEncoded(name.toUtf8());
+ QUrl url = QUrl(name);
const QVariant data = m_document->resource(QTextDocument::ImageResource, url);
if (data.type() == QVariant::Image) {
image = qvariant_cast<QImage>(data);
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index f2a9f52a26..44dc79e255 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -86,7 +86,7 @@ public:
};
QTextOption();
- QTextOption(Qt::Alignment alignment);
+ /*implicit*/ QTextOption(Qt::Alignment alignment);
~QTextOption();
QTextOption(const QTextOption &o);
diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h
index f3191d2b1b..7aa8ad4091 100644
--- a/src/gui/util/qvalidator.h
+++ b/src/gui/util/qvalidator.h
@@ -176,7 +176,7 @@ class Q_GUI_EXPORT QRegExpValidator : public QValidator
public:
explicit QRegExpValidator(QObject *parent = 0);
- QRegExpValidator(const QRegExp& rx, QObject *parent = 0);
+ explicit QRegExpValidator(const QRegExp& rx, QObject *parent = 0);
~QRegExpValidator();
virtual QValidator::State validate(QString& input, int& pos) const;