qmemrotate.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qmemrotate.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5static const int tileSize = 32;-
6template <class T>-
7static-
8inline void qt_memrotate90_cachedRead(const T *src, int w, int h, int sstride, T *dest,-
9 int dstride)-
10{-
11 const char *s = reinterpret_cast<const char*>(src);-
12 char *d = reinterpret_cast<char*>(dest);-
13 for (int y = 0; y < h
y < hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
14 for (int x = w - 1; x >= 0
x >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --x) {
0
15 T *destline = reinterpret_cast<T *>(d + (w - x - 1) * dstride);-
16 destline[y] = src[x];-
17 }
never executed: end of block
0
18 s += sstride;-
19 src = reinterpret_cast<const T*>(s);-
20 }
never executed: end of block
0
21}
never executed: end of block
0
22-
23template <class T>-
24static-
25inline void qt_memrotate270_cachedRead(const T *src, int w, int h, int sstride, T *dest,-
26 int dstride)-
27{-
28 const char *s = reinterpret_cast<const char*>(src);-
29 char *d = reinterpret_cast<char*>(dest);-
30 s += (h - 1) * sstride;-
31 for (int y = h - 1; y >= 0
y >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --y) {
0
32 src = reinterpret_cast<const T*>(s);-
33 for (int x = 0; x < w
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
34 T *destline = reinterpret_cast<T *>(d + x * dstride);-
35 destline[h - y - 1] = src[x];-
36 }
never executed: end of block
0
37 s -= sstride;-
38 }
never executed: end of block
0
39}
never executed: end of block
0
40template <class T>-
41static-
42inline void qt_memrotate90_tiled(const T *src, int w, int h, int sstride, T *dest, int dstride)-
43{-
44 sstride /= sizeof(T);-
45 dstride /= sizeof(T);-
46-
47 const int pack = sizeof(quint32) / sizeof(T);-
48 const int unaligned =-
49 qMin(uint((quintptr(dest) & (sizeof(quint32)-1)) / sizeof(T)), uint(h));-
50 const int restX = w % tileSize;-
51 const int restY = (h - unaligned) % tileSize;-
52 const int unoptimizedY = restY % pack;-
53 const int numTilesX = w / tileSize + (restX > 0);-
54 const int numTilesY = (h - unaligned) / tileSize + (restY >= pack);-
55-
56 for (int tx = 0; tx < numTilesX
tx < numTilesXDescription
TRUEnever evaluated
FALSEnever evaluated
; ++tx) {
0
57 const int startx = w - tx * tileSize - 1;-
58 const int stopx = qMax(startx - tileSize, 0);-
59-
60 if (unaligned
unalignedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
61 for (int x = startx; x >= stopx
x >= stopxDescription
TRUEnever evaluated
FALSEnever evaluated
; --x) {
0
62 T *d = dest + (w - x - 1) * dstride;-
63 for (int y = 0; y < unaligned
y < unalignedDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
64 *d++ = src[y * sstride + x];-
65 }
never executed: end of block
0
66 }
never executed: end of block
0
67 }
never executed: end of block
0
68-
69 for (int ty = 0; ty < numTilesY
ty < numTilesYDescription
TRUEnever evaluated
FALSEnever evaluated
; ++ty) {
0
70 const int starty = ty * tileSize + unaligned;-
71 const int stopy = qMin(starty + tileSize, h - unoptimizedY);-
72-
73 for (int x = startx; x >= stopx
x >= stopxDescription
TRUEnever evaluated
FALSEnever evaluated
; --x) {
0
74 quint32 *d = reinterpret_cast<quint32*>(dest + (w - x - 1) * dstride + starty);-
75 for (int y = starty; y < stopy
y < stopyDescription
TRUEnever evaluated
FALSEnever evaluated
; y += pack) {
0
76 quint32 c = src[y * sstride + x];-
77 for (int i = 1; i < pack
i < packDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
78 const int shift = (sizeof(int) * 8 / pack * i);-
79 const T color = src[(y + i) * sstride + x];-
80 c |= color << shift;-
81 }
never executed: end of block
0
82 *d++ = c;-
83 }
never executed: end of block
0
84 }
never executed: end of block
0
85 }
never executed: end of block
0
86-
87 if (unoptimizedY
unoptimizedYDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
88 const int starty = h - unoptimizedY;-
89 for (int x = startx; x >= stopx
x >= stopxDescription
TRUEnever evaluated
FALSEnever evaluated
; --x) {
0
90 T *d = dest + (w - x - 1) * dstride + starty;-
91 for (int y = starty; y < h
y < hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
92 *d++ = src[y * sstride + x];-
93 }
never executed: end of block
0
94 }
never executed: end of block
0
95 }
never executed: end of block
0
96 }
never executed: end of block
0
97}
never executed: end of block
0
98-
99template <class T>-
100static-
101inline void qt_memrotate90_tiled_unpacked(const T *src, int w, int h, int sstride, T *dest,-
102 int dstride)-
103{-
104 const int numTilesX = (w + tileSize - 1) / tileSize;-
105 const int numTilesY = (h + tileSize - 1) / tileSize;-
106-
107 for (int tx = 0; tx < numTilesX
tx < numTilesXDescription
TRUEnever evaluated
FALSEnever evaluated
; ++tx) {
0
108 const int startx = w - tx * tileSize - 1;-
109 const int stopx = qMax(startx - tileSize, 0);-
110-
111 for (int ty = 0; ty < numTilesY
ty < numTilesYDescription
TRUEnever evaluated
FALSEnever evaluated
; ++ty) {
0
112 const int starty = ty * tileSize;-
113 const int stopy = qMin(starty + tileSize, h);-
114-
115 for (int x = startx; x >= stopx
x >= stopxDescription
TRUEnever evaluated
FALSEnever evaluated
; --x) {
0
116 T *d = (T *)((char*)dest + (w - x - 1) * dstride) + starty;-
117 const char *s = (const char*)(src + x) + starty * sstride;-
118 for (int y = starty; y < stopy
y < stopyDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
119 *d++ = *(const T *)(s);-
120 s += sstride;-
121 }
never executed: end of block
0
122 }
never executed: end of block
0
123 }
never executed: end of block
0
124 }
never executed: end of block
0
125}
never executed: end of block
0
126-
127template <class T>-
128static-
129inline void qt_memrotate270_tiled(const T *src, int w, int h, int sstride, T *dest, int dstride)-
130{-
131 sstride /= sizeof(T);-
132 dstride /= sizeof(T);-
133-
134 const int pack = sizeof(quint32) / sizeof(T);-
135 const int unaligned =-
136 qMin(uint((long(dest) & (sizeof(quint32)-1)) / sizeof(T)), uint(h));-
137 const int restX = w % tileSize;-
138 const int restY = (h - unaligned) % tileSize;-
139 const int unoptimizedY = restY % pack;-
140 const int numTilesX = w / tileSize + (restX > 0);-
141 const int numTilesY = (h - unaligned) / tileSize + (restY >= pack);-
142-
143 for (int tx = 0; tx < numTilesX
tx < numTilesXDescription
TRUEnever evaluated
FALSEnever evaluated
; ++tx) {
0
144 const int startx = tx * tileSize;-
145 const int stopx = qMin(startx + tileSize, w);-
146-
147 if (unaligned
unalignedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
148 for (int x = startx; x < stopx
x < stopxDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
149 T *d = dest + x * dstride;-
150 for (int y = h - 1; y >= h - unaligned
y >= h - unalignedDescription
TRUEnever evaluated
FALSEnever evaluated
; --y) {
0
151 *d++ = src[y * sstride + x];-
152 }
never executed: end of block
0
153 }
never executed: end of block
0
154 }
never executed: end of block
0
155-
156 for (int ty = 0; ty < numTilesY
ty < numTilesYDescription
TRUEnever evaluated
FALSEnever evaluated
; ++ty) {
0
157 const int starty = h - 1 - unaligned - ty * tileSize;-
158 const int stopy = qMax(starty - tileSize, unoptimizedY);-
159-
160 for (int x = startx; x < stopx
x < stopxDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
161 quint32 *d = reinterpret_cast<quint32*>(dest + x * dstride-
162 + h - 1 - starty);-
163 for (int y = starty; y > stopy
y > stopyDescription
TRUEnever evaluated
FALSEnever evaluated
; y -= pack) {
0
164 quint32 c = src[y * sstride + x];-
165 for (int i = 1; i < pack
i < packDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
166 const int shift = (sizeof(int) * 8 / pack * i);-
167 const T color = src[(y - i) * sstride + x];-
168 c |= color << shift;-
169 }
never executed: end of block
0
170 *d++ = c;-
171 }
never executed: end of block
0
172 }
never executed: end of block
0
173 }
never executed: end of block
0
174 if (unoptimizedY
unoptimizedYDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
175 const int starty = unoptimizedY - 1;-
176 for (int x = startx; x < stopx
x < stopxDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
177 T *d = dest + x * dstride + h - 1 - starty;-
178 for (int y = starty; y >= 0
y >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --y) {
0
179 *d++ = src[y * sstride + x];-
180 }
never executed: end of block
0
181 }
never executed: end of block
0
182 }
never executed: end of block
0
183 }
never executed: end of block
0
184}
never executed: end of block
0
185-
186template <class T>-
187static-
188inline void qt_memrotate270_tiled_unpacked(const T *src, int w, int h, int sstride, T *dest,-
189 int dstride)-
190{-
191 const int numTilesX = (w + tileSize - 1) / tileSize;-
192 const int numTilesY = (h + tileSize - 1) / tileSize;-
193-
194 for (int tx = 0; tx < numTilesX
tx < numTilesXDescription
TRUEnever evaluated
FALSEnever evaluated
; ++tx) {
0
195 const int startx = tx * tileSize;-
196 const int stopx = qMin(startx + tileSize, w);-
197-
198 for (int ty = 0; ty < numTilesY
ty < numTilesYDescription
TRUEnever evaluated
FALSEnever evaluated
; ++ty) {
0
199 const int starty = h - 1 - ty * tileSize;-
200 const int stopy = qMax(starty - tileSize, 0);-
201-
202 for (int x = startx; x < stopx
x < stopxDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
203 T *d = (T*)((char*)dest + x * dstride) + h - 1 - starty;-
204 const char *s = (const char*)(src + x) + starty * sstride;-
205 for (int y = starty; y >= stopy
y >= stopyDescription
TRUEnever evaluated
FALSEnever evaluated
; --y) {
0
206 *d++ = *(const T*)s;-
207 s -= sstride;-
208 }
never executed: end of block
0
209 }
never executed: end of block
0
210 }
never executed: end of block
0
211 }
never executed: end of block
0
212}
never executed: end of block
0
213-
214-
215-
216template <class T>-
217static-
218inline void qt_memrotate90_template(const T *src, int srcWidth, int srcHeight, int srcStride,-
219 T *dest, int dstStride)-
220{-
221-
222-
223-
224-
225-
226-
227-
228 qt_memrotate90_tiled<T>(src, srcWidth, srcHeight, srcStride, dest, dstStride);-
229-
230}
never executed: end of block
0
231-
232template <class T>-
233static-
234inline void qt_memrotate180_template(const T *src, int w, int h, int sstride, T *dest, int dstride)-
235{-
236 const char *s = (const char*)(src) + (h - 1) * sstride;-
237 for (int y = h - 1; y >= 0
y >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --y) {
0
238 T *d = reinterpret_cast<T*>((char *)(dest) + (h - y - 1) * dstride);-
239 src = reinterpret_cast<const T*>(s);-
240 for (int x = w - 1; x >= 0
x >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --x) {
0
241 d[w - x - 1] = src[x];-
242 }
never executed: end of block
0
243 s -= sstride;-
244 }
never executed: end of block
0
245}
never executed: end of block
0
246-
247template <class T>-
248static-
249inline void qt_memrotate270_template(const T *src, int srcWidth, int srcHeight, int srcStride,-
250 T *dest, int dstStride)-
251{-
252-
253-
254-
255-
256-
257-
258-
259 qt_memrotate270_tiled_unpacked<T>(src, srcWidth, srcHeight, srcStride, dest, dstStride);-
260-
261}
never executed: end of block
0
262-
263template <>-
264inline void qt_memrotate90_template<quint24>(const quint24 *src, int srcWidth, int srcHeight,-
265 int srcStride, quint24 *dest, int dstStride)-
266{-
267 qt_memrotate90_tiled_unpacked<quint24>(src, srcWidth, srcHeight, srcStride, dest, dstStride);-
268-
269}
never executed: end of block
0
270__attribute__((visibility("default"))) void qt_memrotate90(const quint32 *src, int w, int h, int sstride, quint32 *dest, int dstride) { qt_memrotate90_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
__attribute__((visibility("default"))) void qt_memrotate180(const quint32 *src, int w, int h, int sstride, quint32 *dest, int dstride) { qt_memrotate180_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
__attribute__((visibility("default"))) void qt_memrotate270(const quint32 *src, int w, int h, int sstride, quint32 *dest, int dstride) { qt_memrotate270_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
0
271__attribute__((visibility("default"))) void qt_memrotate90(const quint16 *src, int w, int h, int sstride, quint16 *dest, int dstride) { qt_memrotate90_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
__attribute__((visibility("default"))) void qt_memrotate180(const quint16 *src, int w, int h, int sstride, quint16 *dest, int dstride) { qt_memrotate180_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
__attribute__((visibility("default"))) void qt_memrotate270(const quint16 *src, int w, int h, int sstride, quint16 *dest, int dstride) { qt_memrotate270_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
0
272__attribute__((visibility("default"))) void qt_memrotate90(const quint24 *src, int w, int h, int sstride, quint24 *dest, int dstride) { qt_memrotate90_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
__attribute__((visibility("default"))) void qt_memrotate180(const quint24 *src, int w, int h, int sstride, quint24 *dest, int dstride) { qt_memrotate180_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
__attribute__((visibility("default"))) void qt_memrotate270(const quint24 *src, int w, int h, int sstride, quint24 *dest, int dstride) { qt_memrotate270_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
0
273__attribute__((visibility("default"))) void qt_memrotate90(const quint8 *src, int w, int h, int sstride, quint8 *dest, int dstride) { qt_memrotate90_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
__attribute__((visibility("default"))) void qt_memrotate180(const quint8 *src, int w, int h, int sstride, quint8 *dest, int dstride) { qt_memrotate180_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
__attribute__((visibility("default"))) void qt_memrotate270(const quint8 *src, int w, int h, int sstride, quint8 *dest, int dstride) { qt_memrotate270_template(src, w, h, sstride, dest, dstride); }
never executed: end of block
0
274-
275void qt_memrotate90_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)-
276{-
277 qt_memrotate90(srcPixels, w, h, sbpl, destPixels, dbpl);-
278}
never executed: end of block
0
279-
280void qt_memrotate180_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)-
281{-
282 qt_memrotate180(srcPixels, w, h, sbpl, destPixels, dbpl);-
283}
never executed: end of block
0
284-
285void qt_memrotate270_8(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)-
286{-
287 qt_memrotate270(srcPixels, w, h, sbpl, destPixels, dbpl);-
288}
never executed: end of block
0
289-
290void qt_memrotate90_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)-
291{-
292 qt_memrotate90((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl);-
293}
never executed: end of block
0
294-
295void qt_memrotate180_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)-
296{-
297 qt_memrotate180((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl);-
298}
never executed: end of block
0
299-
300void qt_memrotate270_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)-
301{-
302 qt_memrotate270((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl);-
303}
never executed: end of block
0
304-
305void qt_memrotate90_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)-
306{-
307 qt_memrotate90((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl);-
308}
never executed: end of block
0
309-
310void qt_memrotate180_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)-
311{-
312 qt_memrotate180((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl);-
313}
never executed: end of block
0
314-
315void qt_memrotate270_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)-
316{-
317 qt_memrotate270((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl);-
318}
never executed: end of block
0
319-
320MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3] =-
321-
322{-
323 { 0, 0, 0 },-
324 { 0, 0, 0 },-
325 { 0, 0, 0 },-
326 { 0, 0, 0 },-
327 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
328 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
329 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
330 { qt_memrotate90_16, qt_memrotate180_16, qt_memrotate270_16 },-
331 { 0, 0, 0 },-
332 { 0, 0, 0 },-
333 { 0, 0, 0 },-
334 { 0, 0, 0 },-
335 { 0, 0, 0 },-
336 { 0, 0, 0 },-
337 { 0, 0, 0 },-
338 { 0, 0, 0 },-
339 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
340 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
341 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
342 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
343 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
344 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
345 { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },-
346 { qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 },-
347 { qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 },-
348};-
349-
350-
Switch to Source codePreprocessed file

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