OpenCoverage

qimage_sse2.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/image/qimage_sse2.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qimage.h"-
41#include <private/qimage_p.h>-
42#include <private/qsimd_p.h>-
43#include <private/qdrawhelper_p.h>-
44#include <private/qdrawingprimitive_sse2_p.h>-
45-
46#ifdef QT_COMPILER_SUPPORTS_SSE2-
47-
48QT_BEGIN_NAMESPACE-
49-
50bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags)-
51{-
52 Q_ASSERT(data->format == QImage::Format_ARGB32 || data->format == QImage::Format_RGBA8888);-
53-
54 // extra pixels on each line-
55 const int spare = data->width & 3;-
56 // width in pixels of the pad at the end of each line-
57 const int pad = (data->bytes_per_line >> 2) - data->width;-
58 const int iter = data->width >> 2;-
59 int height = data->height;-
60-
61 const __m128i alphaMask = _mm_set1_epi32(0xff000000);-
62 const __m128i nullVector = _mm_setzero_si128();-
63 const __m128i half = _mm_set1_epi16(0x80);-
64 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);-
65-
66 __m128i *d = reinterpret_cast<__m128i*>(data->data);-
67 while (height--) {
height--Description
TRUEnever evaluated
FALSEnever evaluated
0
68 const __m128i *end = d + iter;-
69-
70 for (; d != end; ++d) {
d != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
71 const __m128i srcVector = _mm_loadu_si128(d);-
72 const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask);-
73 if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) {
_mm_movemask_e...sk)) == 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
0
74 // opaque, data is unchanged-
75 } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) == 0xffff) {
never executed: end of block
_mm_movemask_e...or)) == 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
0
76 // fully transparent-
77 _mm_storeu_si128(d, nullVector);-
78 } else {
never executed: end of block
0
79 __m128i alphaChannel = _mm_srli_epi32(srcVector, 24);-
80 alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16));-
81-
82 __m128i result;-
83 BYTE_MUL_SSE2(result, srcVector, alphaChannel, colorMask, half);-
84 result = _mm_or_si128(_mm_andnot_si128(alphaMask, result), srcVectorAlpha);-
85 _mm_storeu_si128(d, result);-
86 }
never executed: end of block
0
87 }-
88-
89 QRgb *p = reinterpret_cast<QRgb*>(d);-
90 QRgb *pe = p+spare;-
91 for (; p != pe; ++p) {
p != peDescription
TRUEnever evaluated
FALSEnever evaluated
0
92 if (*p < 0x00ffffff)
*p < 0x00ffffffDescription
TRUEnever evaluated
FALSEnever evaluated
0
93 *p = 0;
never executed: *p = 0;
0
94 else if (*p < 0xff000000)
*p < 0xff000000Description
TRUEnever evaluated
FALSEnever evaluated
0
95 *p = qPremultiply(*p);
never executed: *p = qPremultiply(*p);
0
96 }
never executed: end of block
0
97-
98 d = reinterpret_cast<__m128i*>(p+pad);-
99 }
never executed: end of block
0
100-
101 if (data->format == QImage::Format_ARGB32)
data->format =...:Format_ARGB32Description
TRUEnever evaluated
FALSEnever evaluated
0
102 data->format = QImage::Format_ARGB32_Premultiplied;
never executed: data->format = QImage::Format_ARGB32_Premultiplied;
0
103 else-
104 data->format = QImage::Format_RGBA8888_Premultiplied;
never executed: data->format = QImage::Format_RGBA8888_Premultiplied;
0
105 return true;
never executed: return true;
0
106}-
107-
108QT_END_NAMESPACE-
109-
110#endif // QT_COMPILER_SUPPORTS_SSE2-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9