| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** Contact: Qt Software Information ([email protected])
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
|---|
| 7 | **
|
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ** Commercial Usage
|
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ** a written agreement between you and Nokia.
|
|---|
| 14 | **
|
|---|
| 15 | ** GNU Lesser General Public License Usage
|
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ** packaging of this file. Please review the following information to
|
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | **
|
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ** package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please
|
|---|
| 37 | ** contact the sales department at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifdef QT_HAVE_IWMMXT
|
|---|
| 43 |
|
|---|
| 44 | #include <mmintrin.h>
|
|---|
| 45 | #if defined(Q_OS_WINCE)
|
|---|
| 46 | # include "qplatformdefs.h"
|
|---|
| 47 | #endif
|
|---|
| 48 | #if !defined(__IWMMXT__) && !defined(Q_OS_WINCE)
|
|---|
| 49 | # include <xmmintrin.h>
|
|---|
| 50 | #elif defined(Q_OS_WINCE_STD) && defined(_X86_)
|
|---|
| 51 | # pragma warning(disable: 4391)
|
|---|
| 52 | # include <xmmintrin.h>
|
|---|
| 53 | #endif
|
|---|
| 54 |
|
|---|
| 55 | #include <private/qdrawhelper_sse_p.h>
|
|---|
| 56 |
|
|---|
| 57 | QT_BEGIN_NAMESPACE
|
|---|
| 58 |
|
|---|
| 59 | #ifndef _MM_SHUFFLE
|
|---|
| 60 | #define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \
|
|---|
| 61 | (((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | (fp0))
|
|---|
| 62 | #endif
|
|---|
| 63 |
|
|---|
| 64 | struct QIWMMXTIntrinsics : public QMMXCommonIntrinsics
|
|---|
| 65 | {
|
|---|
| 66 | static inline m64 alpha(m64 x) {
|
|---|
| 67 | return _mm_shuffle_pi16 (x, _MM_SHUFFLE(3, 3, 3, 3));
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | static inline m64 _load_alpha(uint x, const m64 &mmx_0x0000) {
|
|---|
| 71 | m64 t = _mm_unpacklo_pi8(_mm_cvtsi32_si64(x), mmx_0x0000);
|
|---|
| 72 | return _mm_shuffle_pi16(t, _MM_SHUFFLE(0, 0, 0, 0));
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | static inline void end() {
|
|---|
| 76 | }
|
|---|
| 77 | };
|
|---|
| 78 |
|
|---|
| 79 | CompositionFunctionSolid qt_functionForModeSolid_IWMMXT[numCompositionFunctions] = {
|
|---|
| 80 | comp_func_solid_SourceOver<QIWMMXTIntrinsics>,
|
|---|
| 81 | comp_func_solid_DestinationOver<QIWMMXTIntrinsics>,
|
|---|
| 82 | comp_func_solid_Clear<QIWMMXTIntrinsics>,
|
|---|
| 83 | comp_func_solid_Source<QIWMMXTIntrinsics>,
|
|---|
| 84 | 0,
|
|---|
| 85 | comp_func_solid_SourceIn<QIWMMXTIntrinsics>,
|
|---|
| 86 | comp_func_solid_DestinationIn<QIWMMXTIntrinsics>,
|
|---|
| 87 | comp_func_solid_SourceOut<QIWMMXTIntrinsics>,
|
|---|
| 88 | comp_func_solid_DestinationOut<QIWMMXTIntrinsics>,
|
|---|
| 89 | comp_func_solid_SourceAtop<QIWMMXTIntrinsics>,
|
|---|
| 90 | comp_func_solid_DestinationAtop<QIWMMXTIntrinsics>,
|
|---|
| 91 | comp_func_solid_XOR<QIWMMXTIntrinsics>,
|
|---|
| 92 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // svg 1.2 modes
|
|---|
| 93 | rasterop_solid_SourceOrDestination<QIWMMXTIntrinsics>,
|
|---|
| 94 | rasterop_solid_SourceAndDestination<QIWMMXTIntrinsics>,
|
|---|
| 95 | rasterop_solid_SourceXorDestination<QIWMMXTIntrinsics>,
|
|---|
| 96 | rasterop_solid_NotSourceAndNotDestination<QIWMMXTIntrinsics>,
|
|---|
| 97 | rasterop_solid_NotSourceOrNotDestination<QIWMMXTIntrinsics>,
|
|---|
| 98 | rasterop_solid_NotSourceXorDestination<QIWMMXTIntrinsics>,
|
|---|
| 99 | rasterop_solid_NotSource<QIWMMXTIntrinsics>,
|
|---|
| 100 | rasterop_solid_NotSourceAndDestination<QIWMMXTIntrinsics>,
|
|---|
| 101 | rasterop_solid_SourceAndNotDestination<QIWMMXTIntrinsics>
|
|---|
| 102 | };
|
|---|
| 103 |
|
|---|
| 104 | CompositionFunction qt_functionForMode_IWMMXT[] = {
|
|---|
| 105 | comp_func_SourceOver<QIWMMXTIntrinsics>,
|
|---|
| 106 | comp_func_DestinationOver<QIWMMXTIntrinsics>,
|
|---|
| 107 | comp_func_Clear<QIWMMXTIntrinsics>,
|
|---|
| 108 | comp_func_Source<QIWMMXTIntrinsics>,
|
|---|
| 109 | 0,
|
|---|
| 110 | comp_func_SourceIn<QIWMMXTIntrinsics>,
|
|---|
| 111 | comp_func_DestinationIn<QIWMMXTIntrinsics>,
|
|---|
| 112 | comp_func_SourceOut<QIWMMXTIntrinsics>,
|
|---|
| 113 | comp_func_DestinationOut<QIWMMXTIntrinsics>,
|
|---|
| 114 | comp_func_SourceAtop<QIWMMXTIntrinsics>,
|
|---|
| 115 | comp_func_DestinationAtop<QIWMMXTIntrinsics>,
|
|---|
| 116 | comp_func_XOR<QIWMMXTIntrinsics>
|
|---|
| 117 | };
|
|---|
| 118 |
|
|---|
| 119 | void qt_blend_color_argb_iwmmxt(int count, const QSpan *spans, void *userData)
|
|---|
| 120 | {
|
|---|
| 121 | qt_blend_color_argb_x86<QIWMMXTIntrinsics>(count, spans, userData,
|
|---|
| 122 | (CompositionFunctionSolid*)qt_functionForModeSolid_IWMMXT);
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | #endif // QT_HAVE_IWMMXT
|
|---|
| 126 |
|
|---|
| 127 | QT_END_NAMESPACE
|
|---|