| 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 | static void qt_qimageScaleAARGBA_up_xy(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 193 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
| 194 | { | - | ||||||||||||||||||||||||
| 195 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
| 196 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
| 197 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
| 198 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||
| 201 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||
| 203 | const unsigned int *sptr = ypoints[y]; | - | ||||||||||||||||||||||||
| 204 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
| 205 | const int yap = yapoints[y]; | - | ||||||||||||||||||||||||
| 206 | if (yap > 0
| 0 | ||||||||||||||||||||||||
| 207 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
| 208 | const unsigned int *pix = sptr + xpoints[x]; | - | ||||||||||||||||||||||||
| 209 | const int xap = xapoints[x]; | - | ||||||||||||||||||||||||
| 210 | if (xap > 0
| 0 | ||||||||||||||||||||||||
| 211 | * never executed: dptr = interpolate_4_pixels(pix, pix + sow, xap, yap);*dptr = interpolate_4_pixels(pix, pix + sow, xap, yap);never executed: *dptr = interpolate_4_pixels(pix, pix + sow, xap, yap); | 0 | ||||||||||||||||||||||||
| 212 | else | - | ||||||||||||||||||||||||
| 213 | * 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 | ||||||||||||||||||||||||
| 214 | dptr++; | - | ||||||||||||||||||||||||
| 215 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 216 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 217 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
| 218 | const unsigned int *pix = sptr + xpoints[x]; | - | ||||||||||||||||||||||||
| 219 | const int xap = xapoints[x]; | - | ||||||||||||||||||||||||
| 220 | if (xap > 0
| 0 | ||||||||||||||||||||||||
| 221 | * 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 | ||||||||||||||||||||||||
| 222 | else | - | ||||||||||||||||||||||||
| 223 | * never executed: dptr = pix[0];*dptr = pix[0];never executed: *dptr = pix[0]; | 0 | ||||||||||||||||||||||||
| 224 | dptr++; | - | ||||||||||||||||||||||||
| 225 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 226 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 227 | } | - | ||||||||||||||||||||||||
| 228 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 232 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
| 233 | { | - | ||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | if (isi->xup_yup == 3
| 0 | ||||||||||||||||||||||||
| 236 | qt_qimageScaleAARGBA_up_xy(isi, dest, dw, dh, dow, sow); | - | ||||||||||||||||||||||||
| 237 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | else if (isi->xup_yup == 1
| 0 | ||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | if (((
| 0 | ||||||||||||||||||||||||
| 242 | 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 | ||||||||||||||||||||||||
| 243 | else | - | ||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | - | |||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | 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 | ||||||||||||||||||||||||
| 250 | } | - | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | else if (isi->xup_yup == 2
| 0 | ||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||
| 254 | if (((
| 0 | ||||||||||||||||||||||||
| 255 | 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 | ||||||||||||||||||||||||
| 256 | else | - | ||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | 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 | ||||||||||||||||||||||||
| 263 | } | - | ||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | else { | - | ||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | if (((
| 0 | ||||||||||||||||||||||||
| 268 | 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 | ||||||||||||||||||||||||
| 269 | else | - | ||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||
| 275 | qt_qimageScaleAARGBA_down_xy(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGBA_down_xy(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
| 276 | } | - | ||||||||||||||||||||||||
| 277 | } | - | ||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||
| 279 | inline static void qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step, int &r, int &g, int &b, int &a) | - | ||||||||||||||||||||||||
| 280 | { | - | ||||||||||||||||||||||||
| 281 | r = qRed(*pix) * xyap; | - | ||||||||||||||||||||||||
| 282 | g = qGreen(*pix) * xyap; | - | ||||||||||||||||||||||||
| 283 | b = qBlue(*pix) * xyap; | - | ||||||||||||||||||||||||
| 284 | a = qAlpha(*pix) * xyap; | - | ||||||||||||||||||||||||
| 285 | int j; | - | ||||||||||||||||||||||||
| 286 | for (j = (1 << 14) - xyap; j > Cxy
| 0 | ||||||||||||||||||||||||
| 287 | pix += step; | - | ||||||||||||||||||||||||
| 288 | r += qRed(*pix) * Cxy; | - | ||||||||||||||||||||||||
| 289 | g += qGreen(*pix) * Cxy; | - | ||||||||||||||||||||||||
| 290 | b += qBlue(*pix) * Cxy; | - | ||||||||||||||||||||||||
| 291 | a += qAlpha(*pix) * Cxy; | - | ||||||||||||||||||||||||
| 292 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 293 | pix += step; | - | ||||||||||||||||||||||||
| 294 | r += qRed(*pix) * j; | - | ||||||||||||||||||||||||
| 295 | g += qGreen(*pix) * j; | - | ||||||||||||||||||||||||
| 296 | b += qBlue(*pix) * j; | - | ||||||||||||||||||||||||
| 297 | a += qAlpha(*pix) * j; | - | ||||||||||||||||||||||||
| 298 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||
| 300 | static void qt_qimageScaleAARGBA_up_x_down_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 301 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
| 302 | { | - | ||||||||||||||||||||||||
| 303 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
| 304 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
| 305 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
| 306 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||
| 308 | - | |||||||||||||||||||||||||
| 309 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
| 310 | int Cy = yapoints[y] >> 16; | - | ||||||||||||||||||||||||
| 311 | int yap = yapoints[y] & 0xffff; | - | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
| 314 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
| 315 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
| 316 | int r, g, b, a; | - | ||||||||||||||||||||||||
| 317 | qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow, r, g, b, a); | - | ||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | int xap = xapoints[x]; | - | ||||||||||||||||||||||||
| 320 | if (xap > 0
| 0 | ||||||||||||||||||||||||
| 321 | int rr, gg, bb, aa; | - | ||||||||||||||||||||||||
| 322 | qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow, rr, gg, bb, aa); | - | ||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | r = r * (256 - xap); | - | ||||||||||||||||||||||||
| 325 | g = g * (256 - xap); | - | ||||||||||||||||||||||||
| 326 | b = b * (256 - xap); | - | ||||||||||||||||||||||||
| 327 | a = a * (256 - xap); | - | ||||||||||||||||||||||||
| 328 | r = (r + (rr * xap)) >> 8; | - | ||||||||||||||||||||||||
| 329 | g = (g + (gg * xap)) >> 8; | - | ||||||||||||||||||||||||
| 330 | b = (b + (bb * xap)) >> 8; | - | ||||||||||||||||||||||||
| 331 | a = (a + (aa * xap)) >> 8; | - | ||||||||||||||||||||||||
| 332 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 333 | *dptr++ = qRgba(r >> 14, g >> 14, b >> 14, a >> 14); | - | ||||||||||||||||||||||||
| 334 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 335 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 336 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | static void qt_qimageScaleAARGBA_down_x_up_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 339 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
| 340 | { | - | ||||||||||||||||||||||||
| 341 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
| 342 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
| 343 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
| 344 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
| 348 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
| 349 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
| 350 | int Cx = xapoints[x] >> 16; | - | ||||||||||||||||||||||||
| 351 | int xap = xapoints[x] & 0xffff; | - | ||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
| 354 | int r, g, b, a; | - | ||||||||||||||||||||||||
| 355 | qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, r, g, b, a); | - | ||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||
| 357 | int yap = yapoints[y]; | - | ||||||||||||||||||||||||
| 358 | if (yap > 0
| 0 | ||||||||||||||||||||||||
| 359 | int rr, gg, bb, aa; | - | ||||||||||||||||||||||||
| 360 | qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1, rr, gg, bb, aa); | - | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | r = r * (256 - yap); | - | ||||||||||||||||||||||||
| 363 | g = g * (256 - yap); | - | ||||||||||||||||||||||||
| 364 | b = b * (256 - yap); | - | ||||||||||||||||||||||||
| 365 | a = a * (256 - yap); | - | ||||||||||||||||||||||||
| 366 | r = (r + (rr * yap)) >> 8; | - | ||||||||||||||||||||||||
| 367 | g = (g + (gg * yap)) >> 8; | - | ||||||||||||||||||||||||
| 368 | b = (b + (bb * yap)) >> 8; | - | ||||||||||||||||||||||||
| 369 | a = (a + (aa * yap)) >> 8; | - | ||||||||||||||||||||||||
| 370 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 371 | *dptr = qRgba(r >> 14, g >> 14, b >> 14, a >> 14); | - | ||||||||||||||||||||||||
| 372 | dptr++; | - | ||||||||||||||||||||||||
| 373 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 374 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 375 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | static void qt_qimageScaleAARGBA_down_xy(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 378 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
| 379 | { | - | ||||||||||||||||||||||||
| 380 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
| 381 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
| 382 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
| 383 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
| 384 | - | |||||||||||||||||||||||||
| 385 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
| 386 | int Cy = (yapoints[y]) >> 16; | - | ||||||||||||||||||||||||
| 387 | int yap = (yapoints[y]) & 0xffff; | - | ||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
| 390 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
| 391 | int Cx = xapoints[x] >> 16; | - | ||||||||||||||||||||||||
| 392 | int xap = xapoints[x] & 0xffff; | - | ||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||
| 394 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
| 395 | int rx, gx, bx, ax; | - | ||||||||||||||||||||||||
| 396 | qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax); | - | ||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||
| 398 | int r = ((rx>>4) * yap); | - | ||||||||||||||||||||||||
| 399 | int g = ((gx>>4) * yap); | - | ||||||||||||||||||||||||
| 400 | int b = ((bx>>4) * yap); | - | ||||||||||||||||||||||||
| 401 | int a = ((ax>>4) * yap); | - | ||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||
| 403 | int j; | - | ||||||||||||||||||||||||
| 404 | for (j = (1 << 14) - yap; j > Cy
| 0 | ||||||||||||||||||||||||
| 405 | sptr += sow; | - | ||||||||||||||||||||||||
| 406 | qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax); | - | ||||||||||||||||||||||||
| 407 | r += ((rx>>4) * Cy); | - | ||||||||||||||||||||||||
| 408 | g += ((gx>>4) * Cy); | - | ||||||||||||||||||||||||
| 409 | b += ((bx>>4) * Cy); | - | ||||||||||||||||||||||||
| 410 | a += ((ax>>4) * Cy); | - | ||||||||||||||||||||||||
| 411 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 412 | sptr += sow; | - | ||||||||||||||||||||||||
| 413 | qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax); | - | ||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||
| 415 | r += ((rx>>4) * j); | - | ||||||||||||||||||||||||
| 416 | g += ((gx>>4) * j); | - | ||||||||||||||||||||||||
| 417 | b += ((bx>>4) * j); | - | ||||||||||||||||||||||||
| 418 | a += ((ax>>4) * j); | - | ||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||
| 420 | *dptr = qRgba(r >> 24, g >> 24, b >> 24, a >> 24); | - | ||||||||||||||||||||||||
| 421 | dptr++; | - | ||||||||||||||||||||||||
| 422 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 423 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 424 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | static void qt_qimageScaleAARGB_up_x_down_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 427 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||
| 429 | static void qt_qimageScaleAARGB_down_x_up_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 430 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||
| 432 | static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 433 | int dw, int dh, int dow, int sow); | - | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 437 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
| 438 | { | - | ||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | if (isi->xup_yup == 3
| 0 | ||||||||||||||||||||||||
| 441 | qt_qimageScaleAARGBA_up_xy(isi, dest, dw, dh, dow, sow); | - | ||||||||||||||||||||||||
| 442 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||
| 444 | else if (isi->xup_yup == 1
| 0 | ||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||
| 446 | if (((
| 0 | ||||||||||||||||||||||||
| 447 | 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 | ||||||||||||||||||||||||
| 448 | else | - | ||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||
| 454 | 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 | ||||||||||||||||||||||||
| 455 | } | - | ||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | else if (isi->xup_yup == 2
| 0 | ||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||
| 459 | if (((
| 0 | ||||||||||||||||||||||||
| 460 | 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 | ||||||||||||||||||||||||
| 461 | else | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||
| 467 | 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 | ||||||||||||||||||||||||
| 468 | } | - | ||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||
| 470 | else { | - | ||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||
| 472 | if (((
| 0 | ||||||||||||||||||||||||
| 473 | 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 | ||||||||||||||||||||||||
| 474 | else | - | ||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | - | |||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||
| 480 | qt_qimageScaleAARGB_down_xy(isi, dest, dw, dh, dow, sow); never executed: qt_qimageScaleAARGB_down_xy(isi, dest, dw, dh, dow, sow); | 0 | ||||||||||||||||||||||||
| 481 | } | - | ||||||||||||||||||||||||
| 482 | } | - | ||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||
| 485 | inline static void qt_qimageScaleAARGB_helper(const unsigned int *pix, int xyap, int Cxy, int step, int &r, int &g, int &b) | - | ||||||||||||||||||||||||
| 486 | { | - | ||||||||||||||||||||||||
| 487 | r = qRed(*pix) * xyap; | - | ||||||||||||||||||||||||
| 488 | g = qGreen(*pix) * xyap; | - | ||||||||||||||||||||||||
| 489 | b = qBlue(*pix) * xyap; | - | ||||||||||||||||||||||||
| 490 | int j; | - | ||||||||||||||||||||||||
| 491 | for (j = (1 << 14) - xyap; j > Cxy
| 0 | ||||||||||||||||||||||||
| 492 | pix += step; | - | ||||||||||||||||||||||||
| 493 | r += qRed(*pix) * Cxy; | - | ||||||||||||||||||||||||
| 494 | g += qGreen(*pix) * Cxy; | - | ||||||||||||||||||||||||
| 495 | b += qBlue(*pix) * Cxy; | - | ||||||||||||||||||||||||
| 496 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 497 | pix += step; | - | ||||||||||||||||||||||||
| 498 | r += qRed(*pix) * j; | - | ||||||||||||||||||||||||
| 499 | g += qGreen(*pix) * j; | - | ||||||||||||||||||||||||
| 500 | b += qBlue(*pix) * j; | - | ||||||||||||||||||||||||
| 501 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 502 | - | |||||||||||||||||||||||||
| 503 | static void qt_qimageScaleAARGB_up_x_down_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 504 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
| 505 | { | - | ||||||||||||||||||||||||
| 506 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
| 507 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
| 508 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
| 509 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
| 513 | int Cy = yapoints[y] >> 16; | - | ||||||||||||||||||||||||
| 514 | int yap = yapoints[y] & 0xffff; | - | ||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||
| 516 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
| 517 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
| 518 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
| 519 | int r, g, b; | - | ||||||||||||||||||||||||
| 520 | qt_qimageScaleAARGB_helper(sptr, yap, Cy, sow, r, g, b); | - | ||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | int xap = xapoints[x]; | - | ||||||||||||||||||||||||
| 523 | if (xap > 0
| 0 | ||||||||||||||||||||||||
| 524 | int rr, bb, gg; | - | ||||||||||||||||||||||||
| 525 | qt_qimageScaleAARGB_helper(sptr + 1, yap, Cy, sow, rr, gg, bb); | - | ||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | r = r * (256 - xap); | - | ||||||||||||||||||||||||
| 528 | g = g * (256 - xap); | - | ||||||||||||||||||||||||
| 529 | b = b * (256 - xap); | - | ||||||||||||||||||||||||
| 530 | r = (r + (rr * xap)) >> 8; | - | ||||||||||||||||||||||||
| 531 | g = (g + (gg * xap)) >> 8; | - | ||||||||||||||||||||||||
| 532 | b = (b + (bb * xap)) >> 8; | - | ||||||||||||||||||||||||
| 533 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 534 | *dptr++ = qRgb(r >> 14, g >> 14, b >> 14); | - | ||||||||||||||||||||||||
| 535 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 536 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 537 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | static void qt_qimageScaleAARGB_down_x_up_y(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 540 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
| 541 | { | - | ||||||||||||||||||||||||
| 542 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
| 543 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
| 544 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
| 545 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||
| 548 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
| 549 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
| 550 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
| 551 | int Cx = xapoints[x] >> 16; | - | ||||||||||||||||||||||||
| 552 | int xap = xapoints[x] & 0xffff; | - | ||||||||||||||||||||||||
| 553 | - | |||||||||||||||||||||||||
| 554 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
| 555 | int r, g, b; | - | ||||||||||||||||||||||||
| 556 | qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, r, g, b); | - | ||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | int yap = yapoints[y]; | - | ||||||||||||||||||||||||
| 559 | if (yap > 0
| 0 | ||||||||||||||||||||||||
| 560 | int rr, bb, gg; | - | ||||||||||||||||||||||||
| 561 | qt_qimageScaleAARGB_helper(sptr + sow, xap, Cx, 1, rr, gg, bb); | - | ||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||
| 563 | r = r * (256 - yap); | - | ||||||||||||||||||||||||
| 564 | g = g * (256 - yap); | - | ||||||||||||||||||||||||
| 565 | b = b * (256 - yap); | - | ||||||||||||||||||||||||
| 566 | r = (r + (rr * yap)) >> 8; | - | ||||||||||||||||||||||||
| 567 | g = (g + (gg * yap)) >> 8; | - | ||||||||||||||||||||||||
| 568 | b = (b + (bb * yap)) >> 8; | - | ||||||||||||||||||||||||
| 569 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 570 | *dptr++ = qRgb(r >> 14, g >> 14, b >> 14); | - | ||||||||||||||||||||||||
| 571 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 572 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 573 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int *dest, | - | ||||||||||||||||||||||||
| 576 | int dw, int dh, int dow, int sow) | - | ||||||||||||||||||||||||
| 577 | { | - | ||||||||||||||||||||||||
| 578 | const unsigned int **ypoints = isi->ypoints; | - | ||||||||||||||||||||||||
| 579 | int *xpoints = isi->xpoints; | - | ||||||||||||||||||||||||
| 580 | int *xapoints = isi->xapoints; | - | ||||||||||||||||||||||||
| 581 | int *yapoints = isi->yapoints; | - | ||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||
| 583 | for (int y = 0; y < dh
| 0 | ||||||||||||||||||||||||
| 584 | int Cy = yapoints[y] >> 16; | - | ||||||||||||||||||||||||
| 585 | int yap = yapoints[y] & 0xffff; | - | ||||||||||||||||||||||||
| 586 | - | |||||||||||||||||||||||||
| 587 | unsigned int *dptr = dest + (y * dow); | - | ||||||||||||||||||||||||
| 588 | for (int x = 0; x < dw
| 0 | ||||||||||||||||||||||||
| 589 | int Cx = xapoints[x] >> 16; | - | ||||||||||||||||||||||||
| 590 | int xap = xapoints[x] & 0xffff; | - | ||||||||||||||||||||||||
| 591 | - | |||||||||||||||||||||||||
| 592 | const unsigned int *sptr = ypoints[y] + xpoints[x]; | - | ||||||||||||||||||||||||
| 593 | int rx, gx, bx; | - | ||||||||||||||||||||||||
| 594 | qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx); | - | ||||||||||||||||||||||||
| 595 | - | |||||||||||||||||||||||||
| 596 | int r = (rx >> 4) * yap; | - | ||||||||||||||||||||||||
| 597 | int g = (gx >> 4) * yap; | - | ||||||||||||||||||||||||
| 598 | int b = (bx >> 4) * yap; | - | ||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | int j; | - | ||||||||||||||||||||||||
| 601 | for (j = (1 << 14) - yap; j > Cy
| 0 | ||||||||||||||||||||||||
| 602 | sptr += sow; | - | ||||||||||||||||||||||||
| 603 | qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx); | - | ||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||
| 605 | r += (rx >> 4) * Cy; | - | ||||||||||||||||||||||||
| 606 | g += (gx >> 4) * Cy; | - | ||||||||||||||||||||||||
| 607 | b += (bx >> 4) * Cy; | - | ||||||||||||||||||||||||
| 608 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 609 | sptr += sow; | - | ||||||||||||||||||||||||
| 610 | qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx); | - | ||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||
| 612 | r += (rx >> 4) * j; | - | ||||||||||||||||||||||||
| 613 | g += (gx >> 4) * j; | - | ||||||||||||||||||||||||
| 614 | b += (bx >> 4) * j; | - | ||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||
| 616 | *dptr = qRgb(r >> 24, g >> 24, b >> 24); | - | ||||||||||||||||||||||||
| 617 | dptr++; | - | ||||||||||||||||||||||||
| 618 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 619 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 620 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | QImage qSmoothScaleImage(const QImage &src, int dw, int dh) | - | ||||||||||||||||||||||||
| 623 | { | - | ||||||||||||||||||||||||
| 624 | QImage buffer; | - | ||||||||||||||||||||||||
| 625 | if (src.isNull()
| 0 | ||||||||||||||||||||||||
| 626 | return never executed: buffer;return buffer;never executed: return buffer; | 0 | ||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||
| 628 | int w = src.width(); | - | ||||||||||||||||||||||||
| 629 | int h = src.height(); | - | ||||||||||||||||||||||||
| 630 | QImageScaleInfo *scaleinfo = | - | ||||||||||||||||||||||||
| 631 | qimageCalcScaleInfo(src, w, h, dw, dh, true); | - | ||||||||||||||||||||||||
| 632 | if (!scaleinfo
| 0 | ||||||||||||||||||||||||
| 633 | return never executed: buffer;return buffer;never executed: return buffer; | 0 | ||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||
| 635 | buffer = QImage(dw, dh, src.format()); | - | ||||||||||||||||||||||||
| 636 | if (buffer.isNull()
| 0 | ||||||||||||||||||||||||
| 637 | QMessageLogger(__FILE__, 743, __PRETTY_FUNCTION__).warning("QImage: out of memory, returning null"); | - | ||||||||||||||||||||||||
| 638 | qimageFreeScaleInfo(scaleinfo); | - | ||||||||||||||||||||||||
| 639 | return never executed: QImage();return QImage();never executed: return QImage(); | 0 | ||||||||||||||||||||||||
| 640 | } | - | ||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||
| 642 | if (src.hasAlphaChannel()
| 0 | ||||||||||||||||||||||||
| 643 | 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 | ||||||||||||||||||||||||
| 644 | dw, dh, dw, src.bytesPerLine() / 4); never executed: qt_qimageScaleAARGBA(scaleinfo, (unsigned int *)buffer.scanLine(0), dw, dh, dw, src.bytesPerLine() / 4); | 0 | ||||||||||||||||||||||||
| 645 | else | - | ||||||||||||||||||||||||
| 646 | 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 | ||||||||||||||||||||||||
| 647 | dw, dh, dw, src.bytesPerLine() / 4); never executed: qt_qimageScaleAARGB(scaleinfo, (unsigned int *)buffer.scanLine(0), dw, dh, dw, src.bytesPerLine() / 4); | 0 | ||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||
| 649 | qimageFreeScaleInfo(scaleinfo); | - | ||||||||||||||||||||||||
| 650 | return never executed: buffer;return buffer;never executed: return buffer; | 0 | ||||||||||||||||||||||||
| 651 | } | - | ||||||||||||||||||||||||
| 652 | - | |||||||||||||||||||||||||
| 653 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |