From b8112c8526a6e261c6e00bdb4fe6ceef3876d01f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 6 Mar 2012 22:41:26 +0100 Subject: QtGui: make some constructors explicit This is a semi-automatic search, so I'm reasonably sure that all the exported ones have been caught. Change-Id: I5b122db2498dbb2aee50c7ad95c67e708aade45b Reviewed-by: Gunnar Sletta --- src/gui/painting/qbackingstore.h | 2 +- src/gui/painting/qpdfwriter.h | 4 ++-- src/gui/painting/qplatformbackingstore_qpa.h | 2 +- src/gui/painting/qpolygon.h | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/gui/painting') 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/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 8049c64c25..042913292f 100644 --- a/src/gui/painting/qplatformbackingstore_qpa.h +++ b/src/gui/painting/qplatformbackingstore_qpa.h @@ -62,7 +62,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 public: inline QPolygon() {} inline ~QPolygon() {} - inline QPolygon(int size); + inline explicit QPolygon(int size); inline QPolygon(const QPolygon &a) : QVector(a) {} - inline QPolygon(const QVector &v) : QVector(v) {} + inline /*implicit*/ QPolygon(const QVector &v) : QVector(v) {} QPolygon(const QRect &r, bool closed=false); QPolygon(int nPoints, const int *points); inline void swap(QPolygon &other) { QVector::swap(other); } // prevent QVector<->QPolygon swaps @@ -135,11 +135,11 @@ class Q_GUI_EXPORT QPolygonF : public QVector public: inline QPolygonF() {} inline ~QPolygonF() {} - inline QPolygonF(int size); + inline explicit QPolygonF(int size); inline QPolygonF(const QPolygonF &a) : QVector(a) {} - inline QPolygonF(const QVector &v) : QVector(v) {} + inline /*implicit*/ QPolygonF(const QVector &v) : QVector(v) {} QPolygonF(const QRectF &r); - QPolygonF(const QPolygon &a); + /*implicit*/ QPolygonF(const QPolygon &a); inline void swap(QPolygonF &other) { QVector::swap(other); } // prevent QVector<->QPolygonF swaps inline void translate(qreal dx, qreal dy); -- cgit v1.2.3 From 55fa3c189f88933d390177ad5606d3de9deacf93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 14 Mar 2012 17:55:43 +0100 Subject: Got rid of Map / Unmap events in favor of Expose event. Since change 2e4d8f67a871f2033 the need for Map and Unmap events has gone away, as now the Expose event is used to notify the application about when it can start rendering. The Map and Unmap events weren't really used except by QWidget to set the WA_Mapped flag, which we now set based on the expose / unexpose. Also guarantee that a Resize event is always sent before the first Expose, by re-introducing an asynchronous expose event handler. Since an expose is required before rendering to a QWindow, show a warning if QOpenGLContext::swapBuffers() or QBackingStore::flush() if called on a window that has not received its first expose. Change-Id: Ia6b609aa275d5b463b5011a96f2fd9bbe52e9bc4 Reviewed-by: Friedemann Kleint --- src/gui/painting/qbackingstore.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gui/painting') 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 ®ion, 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); } -- cgit v1.2.3 From f31e614245e796c7f82ec33eed708902d4d01521 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Sat, 17 Mar 2012 21:37:17 -0700 Subject: Cleanup Q3* items Cleanup Q3* items from QtCore and QtGui modules. Change-Id: Id214a077a50e99d820c84e96e34866492a0130d8 Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/gui/painting/qpainter.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/gui/painting') 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 d_ptr; -- cgit v1.2.3 From d2b1c2ef1f1fea3200d8dee5c58fe79649fd13bb Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Fri, 23 Mar 2012 18:19:27 -0700 Subject: Remove WA_PaintOutsidePaintEvent WA_PaintOutsidePaintEvent is only suggested to be used when porting Qt3 code to Qt 4 under X11 platform. and it has been broken now. Change-Id: Ie4297b2a449f1055ca10ada9efb930e6018b1efb Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/gui/painting/qpainter.cpp | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index eafbe87b31..2752fbd573 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(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(pd); -- cgit v1.2.3 From d43fe0b672a665fc366f7d4a91a522959801165d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 29 Dec 2011 18:09:46 -0200 Subject: Remove the old code using MMX registers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are only 8 MMX registers, each 64-bit wide, and they alias the x87 registers. The access to the MMX register cannot use the new VEX-prefix instructions either. All of the functions being replaced are either present in the qdrawhelper_sse2.cpp and qdrawhelper_ssse3.cpp files, or the plain C++ function in qdrawhelper.cpp is vectorised when compiled with -ftree-vectorize (enabled in -O3), if SSE2 support is enabled. All x86-64 processors have SSE2, so this is a net improvement for 64-bit builds. For 32-bit builds, without further support this will cause the code to use non-vector or x87 instructions, which aren't the best. The solution will come in another commit. Change-Id: I4a22d8a2516b79172867510202d0fd627db54807 Reviewed-by: Samuel Rødal --- src/gui/painting/painting.pri | 6 - src/gui/painting/qdrawhelper.cpp | 99 +--- src/gui/painting/qdrawhelper_mmx.cpp | 155 ------ src/gui/painting/qdrawhelper_mmx3dnow.cpp | 128 ----- src/gui/painting/qdrawhelper_mmx_p.h | 892 ------------------------------ src/gui/painting/qdrawhelper_sse.cpp | 168 ------ src/gui/painting/qdrawhelper_sse2.cpp | 4 +- src/gui/painting/qdrawhelper_sse3dnow.cpp | 143 ----- src/gui/painting/qdrawhelper_x86_p.h | 52 +- 9 files changed, 8 insertions(+), 1639 deletions(-) delete mode 100644 src/gui/painting/qdrawhelper_mmx.cpp delete mode 100644 src/gui/painting/qdrawhelper_mmx3dnow.cpp delete mode 100644 src/gui/painting/qdrawhelper_mmx_p.h delete mode 100644 src/gui/painting/qdrawhelper_sse.cpp delete mode 100644 src/gui/painting/qdrawhelper_sse3dnow.cpp (limited to 'src/gui/painting') diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 3ce2e5b258..0792343ce1 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/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 7571d81a36..3aea7945af 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5862,66 +5862,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) { @@ -5959,44 +5900,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 - -#if defined(QT_HAVE_MMX) - -#include - -QT_BEGIN_NAMESPACE - -CompositionFunctionSolid qt_functionForModeSolid_MMX[numCompositionFunctions] = { - comp_func_solid_SourceOver, - comp_func_solid_DestinationOver, - comp_func_solid_Clear, - comp_func_solid_Source, - 0, - comp_func_solid_SourceIn, - comp_func_solid_DestinationIn, - comp_func_solid_SourceOut, - comp_func_solid_DestinationOut, - comp_func_solid_SourceAtop, - comp_func_solid_DestinationAtop, - comp_func_solid_XOR, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // svg 1.2 modes - rasterop_solid_SourceOrDestination, - rasterop_solid_SourceAndDestination, - rasterop_solid_SourceXorDestination, - rasterop_solid_NotSourceAndNotDestination, - rasterop_solid_NotSourceOrNotDestination, - rasterop_solid_NotSourceXorDestination, - rasterop_solid_NotSource, - rasterop_solid_NotSourceAndDestination, - rasterop_solid_SourceAndNotDestination -}; - -CompositionFunction qt_functionForMode_MMX[numCompositionFunctions] = { - comp_func_SourceOver, - comp_func_DestinationOver, - comp_func_Clear, - comp_func_Source, - comp_func_Destination, - comp_func_SourceIn, - comp_func_DestinationIn, - comp_func_SourceOut, - comp_func_DestinationOut, - comp_func_SourceAtop, - comp_func_DestinationAtop, - comp_func_XOR, - comp_func_Plus, - comp_func_Multiply, - comp_func_Screen, - comp_func_Overlay, - comp_func_Darken, - comp_func_Lighten, - comp_func_ColorDodge, - comp_func_ColorBurn, - comp_func_HardLight, - comp_func_SoftLight, - comp_func_Difference, - comp_func_Exclusion, - rasterop_SourceOrDestination, - rasterop_SourceAndDestination, - rasterop_SourceXorDestination, - rasterop_NotSourceAndNotDestination, - rasterop_NotSourceOrNotDestination, - rasterop_NotSourceXorDestination, - rasterop_NotSource, - rasterop_NotSourceAndDestination, - rasterop_SourceAndNotDestination -}; - -void qt_blend_color_argb_mmx(int count, const QSpan *spans, void *userData) -{ - qt_blend_color_argb_x86(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(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(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 - -#ifdef QT_HAVE_3DNOW - -#include -#include - -QT_BEGIN_NAMESPACE - -struct QMMX3DNOWIntrinsics : public QMMXCommonIntrinsics -{ - static inline void end() { - _m_femms(); - } -}; - -CompositionFunctionSolid qt_functionForModeSolid_MMX3DNOW[numCompositionFunctions] = { - comp_func_solid_SourceOver, - comp_func_solid_DestinationOver, - comp_func_solid_Clear, - comp_func_solid_Source, - 0, - comp_func_solid_SourceIn, - comp_func_solid_DestinationIn, - comp_func_solid_SourceOut, - comp_func_solid_DestinationOut, - comp_func_solid_SourceAtop, - comp_func_solid_DestinationAtop, - comp_func_solid_XOR, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // svg 1.2 modes - rasterop_solid_SourceOrDestination, - rasterop_solid_SourceAndDestination, - rasterop_solid_SourceXorDestination, - rasterop_solid_NotSourceAndNotDestination, - rasterop_solid_NotSourceOrNotDestination, - rasterop_solid_NotSourceXorDestination, - rasterop_solid_NotSource, - rasterop_solid_NotSourceAndDestination, - rasterop_solid_SourceAndNotDestination -}; - -CompositionFunction qt_functionForMode_MMX3DNOW[numCompositionFunctions] = { - comp_func_SourceOver, - comp_func_DestinationOver, - comp_func_Clear, - comp_func_Source, - comp_func_Destination, - comp_func_SourceIn, - comp_func_DestinationIn, - comp_func_SourceOut, - comp_func_DestinationOut, - comp_func_SourceAtop, - comp_func_DestinationAtop, - comp_func_XOR, - comp_func_Plus, - comp_func_Multiply, - comp_func_Screen, - comp_func_Overlay, - comp_func_Darken, - comp_func_Lighten, - comp_func_ColorDodge, - comp_func_ColorBurn, - comp_func_HardLight, - comp_func_SoftLight, - comp_func_Difference, - comp_func_Exclusion, - rasterop_SourceOrDestination, - rasterop_SourceAndDestination, - rasterop_SourceXorDestination, - rasterop_NotSourceAndNotDestination, - rasterop_NotSourceOrNotDestination, - rasterop_NotSourceXorDestination, - rasterop_NotSource, - rasterop_NotSourceAndDestination, - rasterop_SourceAndNotDestination -}; - -void qt_blend_color_argb_mmx3dnow(int count, const QSpan *spans, void *userData) -{ - qt_blend_color_argb_x86(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 -#include -#include - -#ifdef QT_HAVE_MMX -#include -#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(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 -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 -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 -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(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 -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 -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(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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -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 -static void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest, - int length, - uint color, - uint const_alpha) -{ - rasterop_solid_SourceAndNotDestination(dest, length, - ~color, const_alpha); -} - -template -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 -static void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest, - int length, - uint color, - uint const_alpha) -{ - rasterop_solid_SourceXorDestination(dest, length, ~color, const_alpha); -} - -template -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 -static void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest, - int length, - uint color, - uint const_alpha) -{ - rasterop_solid_SourceAndDestination(dest, length, - ~color, const_alpha); -} - -template -static inline void qt_blend_color_argb_x86(int count, const QSpan *spans, - void *userData, - CompositionFunctionSolid *solidFunc) -{ - QSpanData *data = reinterpret_cast(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(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 - -#ifdef QT_HAVE_SSE - -#include - -QT_BEGIN_NAMESPACE - -CompositionFunctionSolid qt_functionForModeSolid_SSE[numCompositionFunctions] = { - comp_func_solid_SourceOver, - comp_func_solid_DestinationOver, - comp_func_solid_Clear, - comp_func_solid_Source, - 0, - comp_func_solid_SourceIn, - comp_func_solid_DestinationIn, - comp_func_solid_SourceOut, - comp_func_solid_DestinationOut, - comp_func_solid_SourceAtop, - comp_func_solid_DestinationAtop, - comp_func_solid_XOR, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // svg 1.2 modes - rasterop_solid_SourceOrDestination, - rasterop_solid_SourceAndDestination, - rasterop_solid_SourceXorDestination, - rasterop_solid_NotSourceAndNotDestination, - rasterop_solid_NotSourceOrNotDestination, - rasterop_solid_NotSourceXorDestination, - rasterop_solid_NotSource, - rasterop_solid_NotSourceAndDestination, - rasterop_solid_SourceAndNotDestination -}; - -CompositionFunction qt_functionForMode_SSE[numCompositionFunctions] = { - comp_func_SourceOver, - comp_func_DestinationOver, - comp_func_Clear, - comp_func_Source, - comp_func_Destination, - comp_func_SourceIn, - comp_func_DestinationIn, - comp_func_SourceOut, - comp_func_DestinationOut, - comp_func_SourceAtop, - comp_func_DestinationAtop, - comp_func_XOR, - comp_func_Plus, - comp_func_Multiply, - comp_func_Screen, - comp_func_Overlay, - comp_func_Darken, - comp_func_Lighten, - comp_func_ColorDodge, - comp_func_ColorBurn, - comp_func_HardLight, - comp_func_SoftLight, - comp_func_Difference, - comp_func_Exclusion, - rasterop_SourceOrDestination, - rasterop_SourceAndDestination, - rasterop_SourceXorDestination, - rasterop_NotSourceAndNotDestination, - rasterop_NotSourceOrNotDestination, - rasterop_NotSourceXorDestination, - rasterop_NotSource, - rasterop_NotSourceAndDestination, - rasterop_SourceAndNotDestination -}; - -void qt_blend_color_argb_sse(int count, const QSpan *spans, void *userData) -{ - qt_blend_color_argb_x86(count, spans, userData, - (CompositionFunctionSolid*)qt_functionForModeSolid_SSE); -} - -void qt_memfill32_sse(quint32 *dest, quint32 value, int count) -{ - return qt_memfill32_sse_template(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(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(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(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 - -#if defined(QT_HAVE_3DNOW) && defined(QT_HAVE_SSE) - -#include -#include - -QT_BEGIN_NAMESPACE - -struct QSSE3DNOWIntrinsics : public QSSEIntrinsics -{ - static inline void end() { - _m_femms(); - } -}; - -CompositionFunctionSolid qt_functionForModeSolid_SSE3DNOW[numCompositionFunctions] = { - comp_func_solid_SourceOver, - comp_func_solid_DestinationOver, - comp_func_solid_Clear, - comp_func_solid_Source, - 0, - comp_func_solid_SourceIn, - comp_func_solid_DestinationIn, - comp_func_solid_SourceOut, - comp_func_solid_DestinationOut, - comp_func_solid_SourceAtop, - comp_func_solid_DestinationAtop, - comp_func_solid_XOR, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // svg 1.2 modes - rasterop_solid_SourceOrDestination, - rasterop_solid_SourceAndDestination, - rasterop_solid_SourceXorDestination, - rasterop_solid_NotSourceAndNotDestination, - rasterop_solid_NotSourceOrNotDestination, - rasterop_solid_NotSourceXorDestination, - rasterop_solid_NotSource, - rasterop_solid_NotSourceAndDestination, - rasterop_solid_SourceAndNotDestination -}; - -CompositionFunction qt_functionForMode_SSE3DNOW[numCompositionFunctions] = { - comp_func_SourceOver, - comp_func_DestinationOver, - comp_func_Clear, - comp_func_Source, - comp_func_Destination, - comp_func_SourceIn, - comp_func_DestinationIn, - comp_func_SourceOut, - comp_func_DestinationOut, - comp_func_SourceAtop, - comp_func_DestinationAtop, - comp_func_XOR, - comp_func_Plus, - comp_func_Multiply, - comp_func_Screen, - comp_func_Overlay, - comp_func_Darken, - comp_func_Lighten, - comp_func_ColorDodge, - comp_func_ColorBurn, - comp_func_HardLight, - comp_func_SoftLight, - comp_func_Difference, - comp_func_Exclusion, - rasterop_SourceOrDestination, - rasterop_SourceAndDestination, - rasterop_SourceXorDestination, - rasterop_NotSourceAndNotDestination, - rasterop_NotSourceOrNotDestination, - rasterop_NotSourceXorDestination, - rasterop_NotSource, - rasterop_NotSourceAndDestination, - rasterop_SourceAndNotDestination -}; - -void qt_blend_color_argb_sse3dnow(int count, const QSpan *spans, void *userData) -{ - qt_blend_color_argb_x86(count, spans, userData, - (CompositionFunctionSolid*)qt_functionForModeSolid_SSE3DNOW); -} - -void qt_memfill32_sse3dnow(quint32 *dest, quint32 value, int count) -{ - return qt_memfill32_sse_template(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(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 -- cgit v1.2.3 From 47728445a5e7317ed2123a8824c54a012eeee142 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 22 Mar 2012 21:44:13 +0100 Subject: Remove all calls to, and deprecate qMalloc, qRealloc and qFree. Callers should just call the standard allocation functions directly. Adding an extra function call onto all basic memory management for the sake of making it instrumentable in rare cases isn't really fair to everyone else. What's more, this wasn't completely reliable, as not everything was using them in a number of places. Memory management can still be overridden using tricks like LD_PRELOAD if needed. Their aligned equivilents cannot be deprecated, as no standard equivilents exist, although investigation into posix_memalign(3) is a possibility for the future. Change-Id: Ic5f74b14be33f8bc188fe7236c55e15c36a23fc7 Reviewed-by: Lars Knoll --- src/gui/painting/qdatabuffer_p.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gui/painting') 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 + QT_BEGIN_NAMESPACE template 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; } } -- cgit v1.2.3 From 7be255156feb7636a5cca5c4fe78f42879ffe69b Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 6 Apr 2012 16:34:19 +0200 Subject: Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents. Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these functions just to avoid an include, except to pay for it with worse runtime performance. On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15% faster(!) than adding an additional call to qMemSet. The advantage on sizes above that is unmeasurable. For qMemCopy, the benefits are a little more modest: 16-7%. Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3 Reviewed-by: Giuseppe D'Angelo Reviewed-by: John Brooks Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/gui/painting/qpainter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 849955100b..97b0f91c26 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5594,9 +5594,9 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio QVarLengthArray advances(glyphCount); QVarLengthArray glyphJustifications(glyphCount); QVarLengthArray 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(const_cast(glyphArray)); -- cgit v1.2.3 From 517240096b7ed5943040c4aea622e562f1e920ac Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 11 Apr 2012 10:26:50 +0200 Subject: Move QRectVectorPath into the .cpp of the only file actually using it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2778b5142ee574f44a9f9489a2752265c6a6c170 Reviewed-by: Samuel Rødal --- src/gui/painting/qpaintengine_raster.cpp | 48 ++++++++++++++++++++++++++++++++ src/gui/painting/qpaintengineex_p.h | 48 -------------------------------- 2 files changed, 48 insertions(+), 48 deletions(-) (limited to 'src/gui/painting') 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/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index bc944b2297..8a65e6cf0b 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -84,54 +84,6 @@ struct QIntRect { } }; -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 -- cgit v1.2.3 From 7e74236477e674b19de25016f4aaef0f86f1a0d6 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 11 Apr 2012 10:09:26 +0200 Subject: Move QVectorPath::polygonFlags to its own class. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Who can say why it was put in QPaintEngineEx's header, but it certainly doesn't belong there. Change-Id: Ieb3b977affcf4b240f621d13b72bdc0e8f8138b9 Reviewed-by: Samuel Rødal --- src/gui/painting/qpaintengineex_p.h | 10 ---------- src/gui/painting/qvectorpath_p.h | 11 ++++++++++- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 8a65e6cf0b..71a2ec344f 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -204,16 +204,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/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; -- cgit v1.2.3 From 2573e9c81dbde707eae8311ae157052bb64e3d02 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 11 Apr 2012 10:21:05 +0200 Subject: Remove unused QIntRect. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I can't find any uses of this anywhere, in either Qt 4 or Qt 5. Change-Id: Ibf747b57b4afdd81e11631e87a80dcab5ac12f69 Reviewed-by: Samuel Rødal --- src/gui/painting/qpaintengineex_p.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 71a2ec344f..31c6b30ec4 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -71,19 +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); - } -}; - #ifndef QT_NO_DEBUG_STREAM QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path); #endif -- cgit v1.2.3 From 6b39f614d18597d4b5364dbd8b56ce8125e88e45 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 12 Apr 2012 09:06:16 +0200 Subject: Remove 'using' of QPaintEngineEx methods from QRasterPaintEngine. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drawEllipse() and the drawPolygon() overloads are all reimplemented, so there is no point having this here. Change-Id: I343cea0dd0fff2ed6a27be2a19459056e929f9d8 Reviewed-by: Samuel Rødal --- src/gui/painting/qpaintengine_raster_p.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/gui/painting') 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; -- cgit v1.2.3 From 5aa8e5a81cfa1b7a45f5b1642d4706962ee821ed Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 12 Apr 2012 13:37:43 +0200 Subject: Remove QPaintBufferSignalProxy and QPaintBufferResource. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nothing seems to use these... Change-Id: I58b3e5f8536e43b3076da0a86d9093a6e11b947a Reviewed-by: Samuel Rødal --- src/gui/painting/qpaintbuffer.cpp | 54 --------------------------------------- src/gui/painting/qpaintbuffer_p.h | 35 ------------------------- 2 files changed, 89 deletions(-) (limited to 'src/gui/painting') 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 @@ -96,19 +96,6 @@ QTextItemIntCopy::~QTextItemIntCopy() delete m_item.fontEngine; } -/************************************************************************ - * - * 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 Cache; - Cache m_cache; - FreeFunc free; -}; - QT_END_NAMESPACE #endif // QPAINTBUFFER_P_H -- cgit v1.2.3