Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qimagescale.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | namespace QImageScale { | - | ||||||||||||||||||||||||
5 | const unsigned int** qimageCalcYPoints(const unsigned int *src, int sw, int sh, int dh); | - | ||||||||||||||||||||||||
6 | int* qimageCalcXPoints(int sw, int dw); | - | ||||||||||||||||||||||||
7 | int* qimageCalcApoints(int s, int d, int up); | - | ||||||||||||||||||||||||
8 | QImageScaleInfo* qimageFreeScaleInfo(QImageScaleInfo *isi); | - | ||||||||||||||||||||||||
9 | QImageScaleInfo *qimageCalcScaleInfo(const QImage &img, int sw, int sh, | - | ||||||||||||||||||||||||
10 | int dw, int dh, char aa); | - | ||||||||||||||||||||||||
11 | } | - | ||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||
13 | using namespace QImageScale; | - | ||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||
19 | const unsigned int** QImageScale::qimageCalcYPoints(const unsigned int *src, | - | ||||||||||||||||||||||||
20 | int sw, int sh, int dh) | - | ||||||||||||||||||||||||
21 | { | - | ||||||||||||||||||||||||
22 | const unsigned int **p; | - | ||||||||||||||||||||||||
23 | int j = 0, rv = 0; | - | ||||||||||||||||||||||||
24 | qint64 val, inc; | - | ||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||
26 | if (dh < 0
| 0 | ||||||||||||||||||||||||
27 | dh = -dh; | - | ||||||||||||||||||||||||
28 | rv = 1; | - | ||||||||||||||||||||||||
29 | } never executed: end of block | 0 | ||||||||||||||||||||||||
30 | p = new const unsigned int* [dh+1]; | - | ||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||
32 | int up = qAbs(dh) >= sh; | - | ||||||||||||||||||||||||
33 | val = up
| 0 | ||||||||||||||||||||||||
34 | inc = (((qint64)sh) << 16) / dh; | - | ||||||||||||||||||||||||
35 | for (int i = 0; i < dh
| 0 | ||||||||||||||||||||||||
36 | p[j++] = src + qMax(0LL, val >> 16) * sw; | - | ||||||||||||||||||||||||
37 | val += inc; | - | ||||||||||||||||||||||||
38 | } never executed: end of block | 0 | ||||||||||||||||||||||||
39 | if (rv
| 0 | ||||||||||||||||||||||||
40 | for (int i = dh / 2; --
| 0 | ||||||||||||||||||||||||
41 | const unsigned int *tmp = p[i]; | - | ||||||||||||||||||||||||
42 | p[i] = p[dh - i - 1]; | - | ||||||||||||||||||||||||
43 | p[dh - i - 1] = tmp; | - | ||||||||||||||||||||||||
44 | } never executed: end of block | 0 | ||||||||||||||||||||||||
45 | } never executed: end of block | 0 | ||||||||||||||||||||||||
46 | return never executed: (p);return(p); never executed: return(p); | 0 | ||||||||||||||||||||||||
47 | } | - | ||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||
49 | int* QImageScale::qimageCalcXPoints(int sw, int dw) | - | ||||||||||||||||||||||||
50 | { | - | ||||||||||||||||||||||||
51 | int *p, j = 0, rv = 0; | - | ||||||||||||||||||||||||
52 | qint64 val, inc; | - | ||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||
54 | if (dw < 0
| 0 | ||||||||||||||||||||||||
55 | dw = -dw; | - | ||||||||||||||||||||||||
56 | rv = 1; | - | ||||||||||||||||||||||||
57 | } never executed: end of block | 0 | ||||||||||||||||||||||||
58 | p = new int[dw+1]; | - | ||||||||||||||||||||||||
59 | - | |||||||||||||||||||||||||
60 | int up = qAbs(dw) >= sw; | - | ||||||||||||||||||||||||
61 | val = up
| 0 | ||||||||||||||||||||||||
62 | inc = (((qint64)sw) << 16) / dw; | - | ||||||||||||||||||||||||
63 | for (int i = 0; i < dw
| 0 | ||||||||||||||||||||||||
64 | p[j++] = qMax(0LL, val >> 16); | - | ||||||||||||||||||||||||
65 | val += inc; | - | ||||||||||||||||||||||||
66 | } never executed: end of block | 0 | ||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||
68 | if (rv
| 0 | ||||||||||||||||||||||||
69 | for (int i = dw / 2; --
| 0 | ||||||||||||||||||||||||
70 | int tmp = p[i]; | - | ||||||||||||||||||||||||
71 | p[i] = p[dw - i - 1]; | - | ||||||||||||||||||||||||
72 | p[dw - i - 1] = tmp; | - | ||||||||||||||||||||||||
73 | } never executed: end of block | 0 | ||||||||||||||||||||||||
74 | } never executed: end of block | 0 | ||||||||||||||||||||||||
75 | return never executed: p;return p; never executed: return p; | 0 | ||||||||||||||||||||||||
76 | } | - | ||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||
78 | int* QImageScale::qimageCalcApoints(int s, int d, int up) | - | ||||||||||||||||||||||||
79 | { | - | ||||||||||||||||||||||||
80 | int *p, j = 0, rv = 0; | - | ||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | if (d < 0
| 0 | ||||||||||||||||||||||||
83 | rv = 1; | - | ||||||||||||||||||||||||
84 | d = -d; | - | ||||||||||||||||||||||||
85 | } never executed: end of block | 0 | ||||||||||||||||||||||||
86 | p = new int[d]; | - | ||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||
88 | if (up
| 0 | ||||||||||||||||||||||||
89 | - | |||||||||||||||||||||||||
90 | qint64 val = 0x8000 * s / d - 0x8000; | - | ||||||||||||||||||||||||
91 | qint64 inc = (((qint64)s) << 16) / d; | - | ||||||||||||||||||||||||
92 | for (int i = 0; i < d
| 0 | ||||||||||||||||||||||||
93 | int pos = val >> 16; | - | ||||||||||||||||||||||||
94 | if (pos < 0
| 0 | ||||||||||||||||||||||||
95 | p[j++] = 0; never executed: p[j++] = 0; | 0 | ||||||||||||||||||||||||
96 | else if (pos >= (s - 1)
| 0 | ||||||||||||||||||||||||
97 | p[j++] = 0; never executed: p[j++] = 0; | 0 | ||||||||||||||||||||||||
98 | else | - | ||||||||||||||||||||||||
99 | p[j++] = (val >> 8) - ((val >> 8) & 0xffffff00); never executed: p[j++] = (val >> 8) - ((val >> 8) & 0xffffff00); | 0 | ||||||||||||||||||||||||
100 | val += inc; | - | ||||||||||||||||||||||||
101 | } never executed: end of block | 0 | ||||||||||||||||||||||||
102 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
103 | - | |||||||||||||||||||||||||
104 | qint64 val = 0; | - | ||||||||||||||||||||||||
105 | qint64 inc = (((qint64)s) << 16) / d; | - | ||||||||||||||||||||||||
106 | int Cp = (((d << 14) + s - 1) / s); | - | ||||||||||||||||||||||||
107 | for (int i = 0; i < d
| 0 | ||||||||||||||||||||||||
108 | int ap = ((0x10000 - (val & 0xffff)) * Cp) >> 16; | - | ||||||||||||||||||||||||
109 | p[j] = ap | (Cp << 16); | - | ||||||||||||||||||||||||
110 | j++; | - | ||||||||||||||||||||||||
111 | val += inc; | - | ||||||||||||||||||||||||
112 | } never executed: end of block | 0 | ||||||||||||||||||||||||
113 | } never executed: end of block | 0 | ||||||||||||||||||||||||
114 | if (rv
| 0 | ||||||||||||||||||||||||
115 | int tmp; | - | ||||||||||||||||||||||||
116 | for (int i = d / 2; --
| 0 | ||||||||||||||||||||||||
117 | tmp = p[i]; | - | ||||||||||||||||||||||||
118 | p[i] = p[d - i - 1]; | - | ||||||||||||||||||||||||
119 | p[d - i - 1] = tmp; | - | ||||||||||||||||||||||||
120 | } never executed: end of block | 0 | ||||||||||||||||||||||||
121 | } never executed: end of block | 0 | ||||||||||||||||||||||||
122 | return never executed: p;return p; never executed: return p; | 0 | ||||||||||||||||||||||||
123 | } | - | ||||||||||||||||||||||||
124 | - | |||||||||||||||||||||||||
125 | QImageScaleInfo* QImageScale::qimageFreeScaleInfo(QImageScaleInfo *isi) | - | ||||||||||||||||||||||||
126 | { | - | ||||||||||||||||||||||||
127 | if (isi
| 0 | ||||||||||||||||||||||||
128 | delete[] isi->xpoints; | - | ||||||||||||||||||||||||
129 | delete[] isi->ypoints; | - | ||||||||||||||||||||||||
130 | delete[] isi->xapoints; | - | ||||||||||||||||||||||||
131 | delete[] isi->yapoints; | - | ||||||||||||||||||||||||
132 | delete isi; | - | ||||||||||||||||||||||||
133 | } never executed: end of block | 0 | ||||||||||||||||||||||||
134 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
135 | } | - | ||||||||||||||||||||||||
136 | - | |||||||||||||||||||||||||
137 | QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img, | - | ||||||||||||||||||||||||
138 | int sw, int sh, | - | ||||||||||||||||||||||||
139 | int dw, int dh, char aa) | - | ||||||||||||||||||||||||
140 | { | - | ||||||||||||||||||||||||
141 | QImageScaleInfo *isi; | - | ||||||||||||||||||||||||
142 | int scw, sch; | - | ||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||
144 | scw = dw * qlonglong(img.width()) / sw; | - | ||||||||||||||||||||||||
145 | sch = dh * qlonglong(img.height()) / sh; | - | ||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||
147 | isi = new QImageScaleInfo; | - | ||||||||||||||||||||||||
148 | if (!isi
| 0 | ||||||||||||||||||||||||
149 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
150 | memset(isi, 0, sizeof(QImageScaleInfo)); | - | ||||||||||||||||||||||||
151 | - | |||||||||||||||||||||||||
152 | isi->xup_yup = (qAbs(dw) >= sw) + ((qAbs(dh) >= sh) << 1); | - | ||||||||||||||||||||||||
153 | - | |||||||||||||||||||||||||
154 | isi->xpoints = qimageCalcXPoints(img.width(), scw); | - | ||||||||||||||||||||||||
155 | if (!isi->xpoints
| 0 | ||||||||||||||||||||||||
156 | return never executed: qimageFreeScaleInfo(isi);return qimageFreeScaleInfo(isi); never executed: return qimageFreeScaleInfo(isi); | 0 | ||||||||||||||||||||||||
157 | isi->ypoints = qimageCalcYPoints((const unsigned int *)img.scanLine(0), | - | ||||||||||||||||||||||||
158 | img.bytesPerLine() / 4, img.height(), sch); | - | ||||||||||||||||||||||||
159 | if (!isi->ypoints
| 0 | ||||||||||||||||||||||||
160 | return never executed: qimageFreeScaleInfo(isi);return qimageFreeScaleInfo(isi); never executed: return qimageFreeScaleInfo(isi); | 0 | ||||||||||||||||||||||||
161 | if (aa
| 0 | ||||||||||||||||||||||||
162 | isi->xapoints = qimageCalcApoints(img.width(), scw, isi->xup_yup & 1); | - | ||||||||||||||||||||||||
163 | if (!isi->xapoints
| 0 | ||||||||||||||||||||||||
164 | return never executed: qimageFreeScaleInfo(isi);return qimageFreeScaleInfo(isi); never executed: return qimageFreeScaleInfo(isi); | 0 | ||||||||||||||||||||||||
165 | isi->yapoints = qimageCalcApoints(img.height(), sch, isi->xup_yup & 2); | - | ||||||||||||||||||||||||
166 | if (!isi->yapoints
| 0 | ||||||||||||||||||||||||
167 | return never executed: qimageFreeScaleInfo(isi);return qimageFreeScaleInfo(isi); never executed: return qimageFreeScaleInfo(isi); | 0 | ||||||||||||||||||||||||
168 | } never executed: end of block | 0 | ||||||||||||||||||||||||
169 | return never executed: isi;return isi; never executed: return isi; | 0 | ||||||||||||||||||||||||
170 | } | - | ||||||||||||||||||||||||
171 | - | |||||||||||||||||||||||||
172 | - | |||||||||||||||||||||||||
173 | static void qt_qimageScaleAARGBA_up_x_down_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
174 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
175 | - | |||||||||||||||||||||||||
176 | static void qt_qimageScaleAARGBA_down_x_up_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
177 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
178 | - | |||||||||||||||||||||||||
179 | static void qt_qimageScaleAARGBA_down_xy(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
180 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||
182 | - | |||||||||||||||||||||||||
183 | template<bool RGB> | - | ||||||||||||||||||||||||
184 | void qt_qimageScaleAARGBA_up_x_down_y_sse4(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
185 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
186 | template<bool RGB> | - | ||||||||||||||||||||||||
187 | void qt_qimageScaleAARGBA_down_x_up_y_sse4(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
188 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
189 | template<bool RGB> | - | ||||||||||||||||||||||||
190 | void qt_qimageScaleAARGBA_down_xy_sse4(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
191 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
192 | - | |||||||||||||||||||||||||
193 | - | |||||||||||||||||||||||||
194 | static void qt_qimageScaleAARGBA_up_xy(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
195 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
196 | { | - | ||||||||||||||||||||||||
197 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
198 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
199 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
200 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
201 | - | |||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||
203 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
204 | - | |||||||||||||||||||||||||
205 | const unsigned int *sptr = ypoints[y]; | - | ||||||||||||||||||||||||
206 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
207 | const int yap = yapoints[y]; | - | ||||||||||||||||||||||||
208 | if (yap > 0
| 0 | ||||||||||||||||||||||||
209 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
210 | const unsigned int *pix = sptr + xpoints[x]; | - | ||||||||||||||||||||||||
211 | const int xap = xapoints[x]; | - | ||||||||||||||||||||||||
212 | if (xap > 0
| 0 | ||||||||||||||||||||||||
213 | * never executed: dptr = interpolate_4_pixels(pix[0], pix[1], pix[sow], pix[sow + 1], xap, yap);*dptr = interpolate_4_pixels(pix[0], pix[1], pix[sow], pix[sow + 1], xap, yap); never executed: *dptr = interpolate_4_pixels(pix[0], pix[1], pix[sow], pix[sow + 1], xap, yap); | 0 | ||||||||||||||||||||||||
214 | else | - | ||||||||||||||||||||||||
215 | * never executed: dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - yap, pix[sow], yap);*dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - yap, pix[sow], yap); never executed: *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - yap, pix[sow], yap); | 0 | ||||||||||||||||||||||||
216 | dptr++; | - | ||||||||||||||||||||||||
217 | } never executed: end of block | 0 | ||||||||||||||||||||||||
218 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
219 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
220 | const unsigned int *pix = sptr + xpoints[x]; | - | ||||||||||||||||||||||||
221 | const int xap = xapoints[x]; | - | ||||||||||||||||||||||||
222 | if (xap > 0
| 0 | ||||||||||||||||||||||||
223 | * never executed: dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap);*dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap); never executed: *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap); | 0 | ||||||||||||||||||||||||
224 | else | - | ||||||||||||||||||||||||
225 | * never executed: dptr = pix[0];*dptr = pix[0]; never executed: *dptr = pix[0]; | 0 | ||||||||||||||||||||||||
226 | dptr++; | - | ||||||||||||||||||||||||
227 | } never executed: end of block | 0 | ||||||||||||||||||||||||
228 | } never executed: end of block | 0 | ||||||||||||||||||||||||
229 | } | - | ||||||||||||||||||||||||
230 | } never executed: end of block | 0 | ||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||
233 | static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
234 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
235 | { | - | ||||||||||||||||||||||||
236 | - | |||||||||||||||||||||||||
237 | if (isi->xup_yup == 3
| 0 | ||||||||||||||||||||||||
238 | qt_qimageScaleAARGBA_up_xy(isi, dest, dw, dh, dow, sow); | - | ||||||||||||||||||||||||
239 | } never executed: end of block | 0 | ||||||||||||||||||||||||
240 | - | |||||||||||||||||||||||||
241 | else if (isi->xup_yup == 1
| 0 | ||||||||||||||||||||||||
242 | - | |||||||||||||||||||||||||
243 | if (((
| 0 | ||||||||||||||||||||||||
244 | qt_qimageScaleAARGBA_up_x_down_y_sse4<false>(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_up_x_down_y_sse4<false>(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
245 | else | - | ||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||
247 | qt_qimageScaleAARGBA_up_x_down_y(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_up_x_down_y(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
248 | } | - | ||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||
250 | else if (isi->xup_yup == 2
| 0 | ||||||||||||||||||||||||
251 | - | |||||||||||||||||||||||||
252 | if (((
| 0 | ||||||||||||||||||||||||
253 | qt_qimageScaleAARGBA_down_x_up_y_sse4<false>(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_down_x_up_y_sse4<false>(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
254 | else | - | ||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||
256 | qt_qimageScaleAARGBA_down_x_up_y(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_down_x_up_y(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
257 | } | - | ||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||
259 | else { | - | ||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||
261 | if (((
| 0 | ||||||||||||||||||||||||
262 | qt_qimageScaleAARGBA_down_xy_sse4<false>(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_down_xy_sse4<false>(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
263 | else | - | ||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | qt_qimageScaleAARGBA_down_xy(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_down_xy(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
266 | } | - | ||||||||||||||||||||||||
267 | } | - | ||||||||||||||||||||||||
268 | - | |||||||||||||||||||||||||
269 | inline static void qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step, int &r, int &g, int &b, int &a) | - | ||||||||||||||||||||||||
270 | { | - | ||||||||||||||||||||||||
271 | r = qRed(*pix) * xyap; | - | ||||||||||||||||||||||||
272 | g = qGreen(*pix) * xyap; | - | ||||||||||||||||||||||||
273 | b = qBlue(*pix) * xyap; | - | ||||||||||||||||||||||||
274 | a = qAlpha(*pix) * xyap; | - | ||||||||||||||||||||||||
275 | int j; | - | ||||||||||||||||||||||||
276 | for (j = (1 << 14) - xyap; j > Cxy
| 0 | ||||||||||||||||||||||||
277 | pix += step; | - | ||||||||||||||||||||||||
278 | r += qRed(*pix) * Cxy; | - | ||||||||||||||||||||||||
279 | g += qGreen(*pix) * Cxy; | - | ||||||||||||||||||||||||
280 | b += qBlue(*pix) * Cxy; | - | ||||||||||||||||||||||||
281 | a += qAlpha(*pix) * Cxy; | - | ||||||||||||||||||||||||
282 | } never executed: end of block | 0 | ||||||||||||||||||||||||
283 | pix += step; | - | ||||||||||||||||||||||||
284 | r += qRed(*pix) * j; | - | ||||||||||||||||||||||||
285 | g += qGreen(*pix) * j; | - | ||||||||||||||||||||||||
286 | b += qBlue(*pix) * j; | - | ||||||||||||||||||||||||
287 | a += qAlpha(*pix) * j; | - | ||||||||||||||||||||||||
288 | } never executed: end of block | 0 | ||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||
290 | static void qt_qimageScaleAARGBA_up_x_down_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
291 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
292 | { | - | ||||||||||||||||||||||||
293 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
294 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
295 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
296 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
297 | - | |||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||
299 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
300 | int Cy = yapoints[y] >> 16; | - | ||||||||||||||||||||||||
301 | int yap = yapoints[y] & 0xffff; | - | ||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||
303 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
304 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
305 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
306 | int r, g, b, a; | - | ||||||||||||||||||||||||
307 | qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow, r, g, b, a); | - | ||||||||||||||||||||||||
308 | - | |||||||||||||||||||||||||
309 | int xap = xapoints[x]; | - | ||||||||||||||||||||||||
310 | if (xap > 0
| 0 | ||||||||||||||||||||||||
311 | int rr, gg, bb, aa; | - | ||||||||||||||||||||||||
312 | qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow, rr, gg, bb, aa); | - | ||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||
314 | r = r * (256 - xap); | - | ||||||||||||||||||||||||
315 | g = g * (256 - xap); | - | ||||||||||||||||||||||||
316 | b = b * (256 - xap); | - | ||||||||||||||||||||||||
317 | a = a * (256 - xap); | - | ||||||||||||||||||||||||
318 | r = (r + (rr * xap)) >> 8; | - | ||||||||||||||||||||||||
319 | g = (g + (gg * xap)) >> 8; | - | ||||||||||||||||||||||||
320 | b = (b + (bb * xap)) >> 8; | - | ||||||||||||||||||||||||
321 | a = (a + (aa * xap)) >> 8; | - | ||||||||||||||||||||||||
322 | } never executed: end of block | 0 | ||||||||||||||||||||||||
323 | *dptr++ = qRgba(r >> 14, g >> 14, b >> 14, a >> 14); | - | ||||||||||||||||||||||||
324 | } never executed: end of block | 0 | ||||||||||||||||||||||||
325 | } never executed: end of block | 0 | ||||||||||||||||||||||||
326 | } never executed: end of block | 0 | ||||||||||||||||||||||||
327 | - | |||||||||||||||||||||||||
328 | static void qt_qimageScaleAARGBA_down_x_up_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
329 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
330 | { | - | ||||||||||||||||||||||||
331 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
332 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
333 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
334 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
335 | - | |||||||||||||||||||||||||
336 | - | |||||||||||||||||||||||||
337 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
338 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
339 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
340 | int Cx = xapoints[x] >> 16; | - | ||||||||||||||||||||||||
341 | int xap = xapoints[x] & 0xffff; | - | ||||||||||||||||||||||||
342 | - | |||||||||||||||||||||||||
343 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
344 | int r, g, b, a; | - | ||||||||||||||||||||||||
345 | qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, r, g, b, a); | - | ||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||
347 | int yap = yapoints[y]; | - | ||||||||||||||||||||||||
348 | if (yap > 0
| 0 | ||||||||||||||||||||||||
349 | int rr, gg, bb, aa; | - | ||||||||||||||||||||||||
350 | qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1, rr, gg, bb, aa); | - | ||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||
352 | r = r * (256 - yap); | - | ||||||||||||||||||||||||
353 | g = g * (256 - yap); | - | ||||||||||||||||||||||||
354 | b = b * (256 - yap); | - | ||||||||||||||||||||||||
355 | a = a * (256 - yap); | - | ||||||||||||||||||||||||
356 | r = (r + (rr * yap)) >> 8; | - | ||||||||||||||||||||||||
357 | g = (g + (gg * yap)) >> 8; | - | ||||||||||||||||||||||||
358 | b = (b + (bb * yap)) >> 8; | - | ||||||||||||||||||||||||
359 | a = (a + (aa * yap)) >> 8; | - | ||||||||||||||||||||||||
360 | } never executed: end of block | 0 | ||||||||||||||||||||||||
361 | *dptr = qRgba(r >> 14, g >> 14, b >> 14, a >> 14); | - | ||||||||||||||||||||||||
362 | dptr++; | - | ||||||||||||||||||||||||
363 | } never executed: end of block | 0 | ||||||||||||||||||||||||
364 | } never executed: end of block | 0 | ||||||||||||||||||||||||
365 | } never executed: end of block | 0 | ||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||
367 | static void qt_qimageScaleAARGBA_down_xy(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
368 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
369 | { | - | ||||||||||||||||||||||||
370 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
371 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
372 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
373 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
374 | - | |||||||||||||||||||||||||
375 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
376 | int Cy = (yapoints[y]) >> 16; | - | ||||||||||||||||||||||||
377 | int yap = (yapoints[y]) & 0xffff; | - | ||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||
379 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
380 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
381 | int Cx = xapoints[x] >> 16; | - | ||||||||||||||||||||||||
382 | int xap = xapoints[x] & 0xffff; | - | ||||||||||||||||||||||||
383 | - | |||||||||||||||||||||||||
384 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
385 | int rx, gx, bx, ax; | - | ||||||||||||||||||||||||
386 | qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax); | - | ||||||||||||||||||||||||
387 | - | |||||||||||||||||||||||||
388 | int r = ((rx>>4) * yap); | - | ||||||||||||||||||||||||
389 | int g = ((gx>>4) * yap); | - | ||||||||||||||||||||||||
390 | int b = ((bx>>4) * yap); | - | ||||||||||||||||||||||||
391 | int a = ((ax>>4) * yap); | - | ||||||||||||||||||||||||
392 | - | |||||||||||||||||||||||||
393 | int j; | - | ||||||||||||||||||||||||
394 | for (j = (1 << 14) - yap; j > Cy
| 0 | ||||||||||||||||||||||||
395 | sptr += sow; | - | ||||||||||||||||||||||||
396 | qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax); | - | ||||||||||||||||||||||||
397 | r += ((rx>>4) * Cy); | - | ||||||||||||||||||||||||
398 | g += ((gx>>4) * Cy); | - | ||||||||||||||||||||||||
399 | b += ((bx>>4) * Cy); | - | ||||||||||||||||||||||||
400 | a += ((ax>>4) * Cy); | - | ||||||||||||||||||||||||
401 | } never executed: end of block | 0 | ||||||||||||||||||||||||
402 | sptr += sow; | - | ||||||||||||||||||||||||
403 | qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax); | - | ||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||
405 | r += ((rx>>4) * j); | - | ||||||||||||||||||||||||
406 | g += ((gx>>4) * j); | - | ||||||||||||||||||||||||
407 | b += ((bx>>4) * j); | - | ||||||||||||||||||||||||
408 | a += ((ax>>4) * j); | - | ||||||||||||||||||||||||
409 | - | |||||||||||||||||||||||||
410 | *dptr = qRgba(r >> 24, g >> 24, b >> 24, a >> 24); | - | ||||||||||||||||||||||||
411 | dptr++; | - | ||||||||||||||||||||||||
412 | } never executed: end of block | 0 | ||||||||||||||||||||||||
413 | } never executed: end of block | 0 | ||||||||||||||||||||||||
414 | } never executed: end of block | 0 | ||||||||||||||||||||||||
415 | - | |||||||||||||||||||||||||
416 | static void qt_qimageScaleAARGB_up_x_down_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
417 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
418 | - | |||||||||||||||||||||||||
419 | static void qt_qimageScaleAARGB_down_x_up_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
420 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
421 | - | |||||||||||||||||||||||||
422 | static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
423 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
424 | - | |||||||||||||||||||||||||
425 | - | |||||||||||||||||||||||||
426 | static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
427 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
428 | { | - | ||||||||||||||||||||||||
429 | - | |||||||||||||||||||||||||
430 | if (isi->xup_yup == 3
| 0 | ||||||||||||||||||||||||
431 | qt_qimageScaleAARGBA_up_xy(isi, dest, dw, dh, dow, sow); | - | ||||||||||||||||||||||||
432 | } never executed: end of block | 0 | ||||||||||||||||||||||||
433 | - | |||||||||||||||||||||||||
434 | else if (isi->xup_yup == 1
| 0 | ||||||||||||||||||||||||
435 | - | |||||||||||||||||||||||||
436 | if (((
| 0 | ||||||||||||||||||||||||
437 | qt_qimageScaleAARGBA_up_x_down_y_sse4<true>(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_up_x_down_y_sse4<true>(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
438 | else | - | ||||||||||||||||||||||||
439 | - | |||||||||||||||||||||||||
440 | qt_qimageScaleAARGB_up_x_down_y(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGB_up_x_down_y(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
441 | } | - | ||||||||||||||||||||||||
442 | - | |||||||||||||||||||||||||
443 | else if (isi->xup_yup == 2
| 0 | ||||||||||||||||||||||||
444 | - | |||||||||||||||||||||||||
445 | if (((
| 0 | ||||||||||||||||||||||||
446 | qt_qimageScaleAARGBA_down_x_up_y_sse4<true>(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_down_x_up_y_sse4<true>(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
447 | else | - | ||||||||||||||||||||||||
448 | - | |||||||||||||||||||||||||
449 | qt_qimageScaleAARGB_down_x_up_y(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGB_down_x_up_y(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
450 | } | - | ||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||
452 | else { | - | ||||||||||||||||||||||||
453 | - | |||||||||||||||||||||||||
454 | if (((
| 0 | ||||||||||||||||||||||||
455 | qt_qimageScaleAARGBA_down_xy_sse4<true>(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_down_xy_sse4<true>(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
456 | else | - | ||||||||||||||||||||||||
457 | - | |||||||||||||||||||||||||
458 | qt_qimageScaleAARGB_down_xy(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGB_down_xy(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
459 | } | - | ||||||||||||||||||||||||
460 | } | - | ||||||||||||||||||||||||
461 | - | |||||||||||||||||||||||||
462 | - | |||||||||||||||||||||||||
463 | inline static void qt_qimageScaleAARGB_helper(const unsigned int *pix, int xyap, int Cxy, int step, int &r, int &g, int &b) | - | ||||||||||||||||||||||||
464 | { | - | ||||||||||||||||||||||||
465 | r = qRed(*pix) * xyap; | - | ||||||||||||||||||||||||
466 | g = qGreen(*pix) * xyap; | - | ||||||||||||||||||||||||
467 | b = qBlue(*pix) * xyap; | - | ||||||||||||||||||||||||
468 | int j; | - | ||||||||||||||||||||||||
469 | for (j = (1 << 14) - xyap; j > Cxy
| 0 | ||||||||||||||||||||||||
470 | pix += step; | - | ||||||||||||||||||||||||
471 | r += qRed(*pix) * Cxy; | - | ||||||||||||||||||||||||
472 | g += qGreen(*pix) * Cxy; | - | ||||||||||||||||||||||||
473 | b += qBlue(*pix) * Cxy; | - | ||||||||||||||||||||||||
474 | } never executed: end of block | 0 | ||||||||||||||||||||||||
475 | pix += step; | - | ||||||||||||||||||||||||
476 | r += qRed(*pix) * j; | - | ||||||||||||||||||||||||
477 | g += qGreen(*pix) * j; | - | ||||||||||||||||||||||||
478 | b += qBlue(*pix) * j; | - | ||||||||||||||||||||||||
479 | } never executed: end of block | 0 | ||||||||||||||||||||||||
480 | - | |||||||||||||||||||||||||
481 | static void qt_qimageScaleAARGB_up_x_down_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
482 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
483 | { | - | ||||||||||||||||||||||||
484 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
485 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
486 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
487 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
488 | - | |||||||||||||||||||||||||
489 | - | |||||||||||||||||||||||||
490 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
491 | int Cy = yapoints[y] >> 16; | - | ||||||||||||||||||||||||
492 | int yap = yapoints[y] & 0xffff; | - | ||||||||||||||||||||||||
493 | - | |||||||||||||||||||||||||
494 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
495 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
496 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
497 | int r, g, b; | - | ||||||||||||||||||||||||
498 | qt_qimageScaleAARGB_helper(sptr, yap, Cy, sow, r, g, b); | - | ||||||||||||||||||||||||
499 | - | |||||||||||||||||||||||||
500 | int xap = xapoints[x]; | - | ||||||||||||||||||||||||
501 | if (xap > 0
| 0 | ||||||||||||||||||||||||
502 | int rr, bb, gg; | - | ||||||||||||||||||||||||
503 | qt_qimageScaleAARGB_helper(sptr + 1, yap, Cy, sow, rr, gg, bb); | - | ||||||||||||||||||||||||
504 | - | |||||||||||||||||||||||||
505 | r = r * (256 - xap); | - | ||||||||||||||||||||||||
506 | g = g * (256 - xap); | - | ||||||||||||||||||||||||
507 | b = b * (256 - xap); | - | ||||||||||||||||||||||||
508 | r = (r + (rr * xap)) >> 8; | - | ||||||||||||||||||||||||
509 | g = (g + (gg * xap)) >> 8; | - | ||||||||||||||||||||||||
510 | b = (b + (bb * xap)) >> 8; | - | ||||||||||||||||||||||||
511 | } never executed: end of block | 0 | ||||||||||||||||||||||||
512 | *dptr++ = qRgb(r >> 14, g >> 14, b >> 14); | - | ||||||||||||||||||||||||
513 | } never executed: end of block | 0 | ||||||||||||||||||||||||
514 | } never executed: end of block | 0 | ||||||||||||||||||||||||
515 | } never executed: end of block | 0 | ||||||||||||||||||||||||
516 | - | |||||||||||||||||||||||||
517 | static void qt_qimageScaleAARGB_down_x_up_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
518 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
519 | { | - | ||||||||||||||||||||||||
520 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
521 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
522 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
523 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
524 | - | |||||||||||||||||||||||||
525 | - | |||||||||||||||||||||||||
526 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
527 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
528 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
529 | int Cx = xapoints[x] >> 16; | - | ||||||||||||||||||||||||
530 | int xap = xapoints[x] & 0xffff; | - | ||||||||||||||||||||||||
531 | - | |||||||||||||||||||||||||
532 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
533 | int r, g, b; | - | ||||||||||||||||||||||||
534 | qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, r, g, b); | - | ||||||||||||||||||||||||
535 | - | |||||||||||||||||||||||||
536 | int yap = yapoints[y]; | - | ||||||||||||||||||||||||
537 | if (yap > 0
| 0 | ||||||||||||||||||||||||
538 | int rr, bb, gg; | - | ||||||||||||||||||||||||
539 | qt_qimageScaleAARGB_helper(sptr + sow, xap, Cx, 1, rr, gg, bb); | - | ||||||||||||||||||||||||
540 | - | |||||||||||||||||||||||||
541 | r = r * (256 - yap); | - | ||||||||||||||||||||||||
542 | g = g * (256 - yap); | - | ||||||||||||||||||||||||
543 | b = b * (256 - yap); | - | ||||||||||||||||||||||||
544 | r = (r + (rr * yap)) >> 8; | - | ||||||||||||||||||||||||
545 | g = (g + (gg * yap)) >> 8; | - | ||||||||||||||||||||||||
546 | b = (b + (bb * yap)) >> 8; | - | ||||||||||||||||||||||||
547 | } never executed: end of block | 0 | ||||||||||||||||||||||||
548 | *dptr++ = qRgb(r >> 14, g >> 14, b >> 14); | - | ||||||||||||||||||||||||
549 | } never executed: end of block | 0 | ||||||||||||||||||||||||
550 | } never executed: end of block | 0 | ||||||||||||||||||||||||
551 | } never executed: end of block | 0 | ||||||||||||||||||||||||
552 | - | |||||||||||||||||||||||||
553 | static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
554 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
555 | { | - | ||||||||||||||||||||||||
556 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
557 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
558 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
559 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
560 | - | |||||||||||||||||||||||||
561 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
562 | int Cy = yapoints[y] >> 16; | - | ||||||||||||||||||||||||
563 | int yap = yapoints[y] & 0xffff; | - | ||||||||||||||||||||||||
564 | - | |||||||||||||||||||||||||
565 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
566 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
567 | int Cx = xapoints[x] >> 16; | - | ||||||||||||||||||||||||
568 | int xap = xapoints[x] & 0xffff; | - | ||||||||||||||||||||||||
569 | - | |||||||||||||||||||||||||
570 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
571 | int rx, gx, bx; | - | ||||||||||||||||||||||||
572 | qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx); | - | ||||||||||||||||||||||||
573 | - | |||||||||||||||||||||||||
574 | int r = (rx >> 4) * yap; | - | ||||||||||||||||||||||||
575 | int g = (gx >> 4) * yap; | - | ||||||||||||||||||||||||
576 | int b = (bx >> 4) * yap; | - | ||||||||||||||||||||||||
577 | - | |||||||||||||||||||||||||
578 | int j; | - | ||||||||||||||||||||||||
579 | for (j = (1 << 14) - yap; j > Cy
| 0 | ||||||||||||||||||||||||
580 | sptr += sow; | - | ||||||||||||||||||||||||
581 | qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx); | - | ||||||||||||||||||||||||
582 | - | |||||||||||||||||||||||||
583 | r += (rx >> 4) * Cy; | - | ||||||||||||||||||||||||
584 | g += (gx >> 4) * Cy; | - | ||||||||||||||||||||||||
585 | b += (bx >> 4) * Cy; | - | ||||||||||||||||||||||||
586 | } never executed: end of block | 0 | ||||||||||||||||||||||||
587 | sptr += sow; | - | ||||||||||||||||||||||||
588 | qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx); | - | ||||||||||||||||||||||||
589 | - | |||||||||||||||||||||||||
590 | r += (rx >> 4) * j; | - | ||||||||||||||||||||||||
591 | g += (gx >> 4) * j; | - | ||||||||||||||||||||||||
592 | b += (bx >> 4) * j; | - | ||||||||||||||||||||||||
593 | - | |||||||||||||||||||||||||
594 | *dptr = qRgb(r >> 24, g >> 24, b >> 24); | - | ||||||||||||||||||||||||
595 | dptr++; | - | ||||||||||||||||||||||||
596 | } never executed: end of block | 0 | ||||||||||||||||||||||||
597 | } never executed: end of block | 0 | ||||||||||||||||||||||||
598 | } never executed: end of block | 0 | ||||||||||||||||||||||||
599 | - | |||||||||||||||||||||||||
600 | QImage qSmoothScaleImage(const QImage &src, int dw, int dh) | - | ||||||||||||||||||||||||
601 | { | - | ||||||||||||||||||||||||
602 | QImage buffer; | - | ||||||||||||||||||||||||
603 | if (src.isNull()
| 0 | ||||||||||||||||||||||||
604 | return never executed: buffer;return buffer; never executed: return buffer; | 0 | ||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||
606 | int w = src.width(); | - | ||||||||||||||||||||||||
607 | int h = src.height(); | - | ||||||||||||||||||||||||
608 | QImageScaleInfo *scaleinfo = | - | ||||||||||||||||||||||||
609 | qimageCalcScaleInfo(src, w, h, dw, dh, true); | - | ||||||||||||||||||||||||
610 | if (!scaleinfo
| 0 | ||||||||||||||||||||||||
611 | return never executed: buffer;return buffer; never executed: return buffer; | 0 | ||||||||||||||||||||||||
612 | - | |||||||||||||||||||||||||
613 | buffer = QImage(dw, dh, src.format()); | - | ||||||||||||||||||||||||
614 | if (buffer.isNull()
| 0 | ||||||||||||||||||||||||
615 | QMessageLogger(__FILE__, 701, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null"); | - | ||||||||||||||||||||||||
616 | qimageFreeScaleInfo(scaleinfo); | - | ||||||||||||||||||||||||
617 | return never executed: QImage();return QImage(); never executed: return QImage(); | 0 | ||||||||||||||||||||||||
618 | } | - | ||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||
620 | if (src.hasAlphaChannel()
| 0 | ||||||||||||||||||||||||
621 | qt_qimageScaleAARGBA(scaleinfo, (unsigned int *)buffer.scanLine(0), never executed: qt_qimageScaleAARGBA(scaleinfo, (unsigned int *)buffer.scanLine(0), dw, dh, dw, src.bytesPerLine() / 4); | 0 | ||||||||||||||||||||||||
622 | dw, dh, dw, src.bytesPerLine() / 4); never executed: qt_qimageScaleAARGBA(scaleinfo, (unsigned int *)buffer.scanLine(0), dw, dh, dw, src.bytesPerLine() / 4); | 0 | ||||||||||||||||||||||||
623 | else | - | ||||||||||||||||||||||||
624 | qt_qimageScaleAARGB(scaleinfo, (unsigned int *)buffer.scanLine(0), never executed: qt_qimageScaleAARGB(scaleinfo, (unsigned int *)buffer.scanLine(0), dw, dh, dw, src.bytesPerLine() / 4); | 0 | ||||||||||||||||||||||||
625 | dw, dh, dw, src.bytesPerLine() / 4); never executed: qt_qimageScaleAARGB(scaleinfo, (unsigned int *)buffer.scanLine(0), dw, dh, dw, src.bytesPerLine() / 4); | 0 | ||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||
627 | qimageFreeScaleInfo(scaleinfo); | - | ||||||||||||||||||||||||
628 | return never executed: buffer;return buffer; never executed: return buffer; | 0 | ||||||||||||||||||||||||
629 | } | - | ||||||||||||||||||||||||
630 | - | |||||||||||||||||||||||||
631 | - | |||||||||||||||||||||||||
Switch to Source code | Preprocessed file |