| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qblendfunctions.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | struct SourceOnlyAlpha | - | ||||||||||||
| 5 | { | - | ||||||||||||
| 6 | inline uchar alpha(uchar src) const { return never executed: src; return src;never executed: } return src; | 0 | ||||||||||||
| 7 | inline quint16 bytemul(quint16 spix) const { return never executed: spix; return spix;never executed: } return spix; | 0 | ||||||||||||
| 8 | }; | - | ||||||||||||
| 9 | - | |||||||||||||
| 10 | - | |||||||||||||
| 11 | struct SourceAndConstAlpha | - | ||||||||||||
| 12 | { | - | ||||||||||||
| 13 | SourceAndConstAlpha(int a) : m_alpha256(a) { | - | ||||||||||||
| 14 | m_alpha255 = (m_alpha256 * 255) >> 8; | - | ||||||||||||
| 15 | } never executed: ; end of block | 0 | ||||||||||||
| 16 | inline uchar alpha(uchar src) const { return never executed: (src * m_alpha256) >> 8; return (src * m_alpha256) >> 8;never executed: } return (src * m_alpha256) >> 8; | 0 | ||||||||||||
| 17 | inline quint16 bytemul(quint16 x) const { | - | ||||||||||||
| 18 | uint t = (((x & 0x07e0)*m_alpha255) >> 8) & 0x07e0; | - | ||||||||||||
| 19 | t |= (((x & 0xf81f)*(m_alpha255>>2)) >> 6) & 0xf81f; | - | ||||||||||||
| 20 | return never executed: t; return t;never executed:  return t; | 0 | ||||||||||||
| 21 | } | - | ||||||||||||
| 22 | int m_alpha255; | - | ||||||||||||
| 23 | int m_alpha256; | - | ||||||||||||
| 24 | }; | - | ||||||||||||
| 25 | - | |||||||||||||
| 26 | - | |||||||||||||
| 27 | - | |||||||||||||
| 28 | - | |||||||||||||
| 29 | - | |||||||||||||
| 30 | - | |||||||||||||
| 31 | struct Blend_RGB16_on_RGB16_NoAlpha { | - | ||||||||||||
| 32 | inline void write(quint16 *dst, quint16 src) { *dst = src; } never executed:  end of block | 0 | ||||||||||||
| 33 | - | |||||||||||||
| 34 | inline void flush(void *) {} | - | ||||||||||||
| 35 | }; | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 | struct Blend_RGB16_on_RGB16_ConstAlpha { | - | ||||||||||||
| 38 | inline Blend_RGB16_on_RGB16_ConstAlpha(quint32 alpha) { | - | ||||||||||||
| 39 | m_alpha = (alpha * 255) >> 8; | - | ||||||||||||
| 40 | m_ialpha = 255 - m_alpha; | - | ||||||||||||
| 41 | } never executed:  end of block | 0 | ||||||||||||
| 42 | - | |||||||||||||
| 43 | inline void write(quint16 *dst, quint16 src) { | - | ||||||||||||
| 44 | *dst = BYTE_MUL_RGB16(src, m_alpha) + BYTE_MUL_RGB16(*dst, m_ialpha); | - | ||||||||||||
| 45 | } never executed:  end of block | 0 | ||||||||||||
| 46 | - | |||||||||||||
| 47 | inline void flush(void *) {} | - | ||||||||||||
| 48 | - | |||||||||||||
| 49 | quint32 m_alpha; | - | ||||||||||||
| 50 | quint32 m_ialpha; | - | ||||||||||||
| 51 | }; | - | ||||||||||||
| 52 | - | |||||||||||||
| 53 | struct Blend_ARGB32_on_RGB16_SourceAlpha { | - | ||||||||||||
| 54 | inline void write(quint16 *dst, quint32 src) { | - | ||||||||||||
| 55 | const quint8 alpha = qAlpha(src); | - | ||||||||||||
| 56 | if (alpha 
 | 0 | ||||||||||||
| 57 | quint16 s = qConvertRgb32To16(src); | - | ||||||||||||
| 58 | if(alpha < 255 
 | 0 | ||||||||||||
| 59 | s += BYTE_MUL_RGB16(*dst, 255 - alpha); never executed:  s += BYTE_MUL_RGB16(*dst, 255 - alpha); | 0 | ||||||||||||
| 60 | *dst = s; | - | ||||||||||||
| 61 | } never executed:  end of block | 0 | ||||||||||||
| 62 | } never executed:  end of block | 0 | ||||||||||||
| 63 | - | |||||||||||||
| 64 | inline void flush(void *) {} | - | ||||||||||||
| 65 | }; | - | ||||||||||||
| 66 | - | |||||||||||||
| 67 | struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha { | - | ||||||||||||
| 68 | inline Blend_ARGB32_on_RGB16_SourceAndConstAlpha(quint32 alpha) { | - | ||||||||||||
| 69 | m_alpha = (alpha * 255) >> 8; | - | ||||||||||||
| 70 | } never executed:  end of block | 0 | ||||||||||||
| 71 | - | |||||||||||||
| 72 | inline void write(quint16 *dst, quint32 src) { | - | ||||||||||||
| 73 | src = BYTE_MUL(src, m_alpha); | - | ||||||||||||
| 74 | const quint8 alpha = qAlpha(src); | - | ||||||||||||
| 75 | if(alpha 
 | 0 | ||||||||||||
| 76 | quint16 s = qConvertRgb32To16(src); | - | ||||||||||||
| 77 | if(alpha < 255 
 | 0 | ||||||||||||
| 78 | s += BYTE_MUL_RGB16(*dst, 255 - alpha); never executed:  s += BYTE_MUL_RGB16(*dst, 255 - alpha); | 0 | ||||||||||||
| 79 | *dst = s; | - | ||||||||||||
| 80 | } never executed:  end of block | 0 | ||||||||||||
| 81 | } never executed:  end of block | 0 | ||||||||||||
| 82 | - | |||||||||||||
| 83 | inline void flush(void *) {} | - | ||||||||||||
| 84 | - | |||||||||||||
| 85 | quint32 m_alpha; | - | ||||||||||||
| 86 | }; | - | ||||||||||||
| 87 | - | |||||||||||||
| 88 | void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl, | - | ||||||||||||
| 89 | const uchar *srcPixels, int sbpl, int srch, | - | ||||||||||||
| 90 | const QRectF &targetRect, | - | ||||||||||||
| 91 | const QRectF &sourceRect, | - | ||||||||||||
| 92 | const QRect &clip, | - | ||||||||||||
| 93 | int const_alpha) | - | ||||||||||||
| 94 | { | - | ||||||||||||
| 95 | - | |||||||||||||
| 96 | - | |||||||||||||
| 97 | - | |||||||||||||
| 98 | - | |||||||||||||
| 99 | - | |||||||||||||
| 100 | - | |||||||||||||
| 101 | - | |||||||||||||
| 102 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 103 | Blend_RGB16_on_RGB16_NoAlpha noAlpha; | - | ||||||||||||
| 104 | qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch, | - | ||||||||||||
| 105 | targetRect, sourceRect, clip, noAlpha); | - | ||||||||||||
| 106 | } never executed: else { end of block | 0 | ||||||||||||
| 107 | Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha); | - | ||||||||||||
| 108 | qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch, | - | ||||||||||||
| 109 | targetRect, sourceRect, clip, constAlpha); | - | ||||||||||||
| 110 | } never executed:  end of block | 0 | ||||||||||||
| 111 | } | - | ||||||||||||
| 112 | - | |||||||||||||
| 113 | void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl, | - | ||||||||||||
| 114 | const uchar *srcPixels, int sbpl, int srch, | - | ||||||||||||
| 115 | const QRectF &targetRect, | - | ||||||||||||
| 116 | const QRectF &sourceRect, | - | ||||||||||||
| 117 | const QRect &clip, | - | ||||||||||||
| 118 | int const_alpha) | - | ||||||||||||
| 119 | { | - | ||||||||||||
| 120 | - | |||||||||||||
| 121 | - | |||||||||||||
| 122 | - | |||||||||||||
| 123 | - | |||||||||||||
| 124 | - | |||||||||||||
| 125 | - | |||||||||||||
| 126 | - | |||||||||||||
| 127 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 128 | Blend_ARGB32_on_RGB16_SourceAlpha noAlpha; | - | ||||||||||||
| 129 | qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch, | - | ||||||||||||
| 130 | targetRect, sourceRect, clip, noAlpha); | - | ||||||||||||
| 131 | } never executed: else { end of block | 0 | ||||||||||||
| 132 | Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha); | - | ||||||||||||
| 133 | qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch, | - | ||||||||||||
| 134 | targetRect, sourceRect, clip, constAlpha); | - | ||||||||||||
| 135 | } never executed:  end of block | 0 | ||||||||||||
| 136 | } | - | ||||||||||||
| 137 | - | |||||||||||||
| 138 | void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl, | - | ||||||||||||
| 139 | const uchar *src, int sbpl, | - | ||||||||||||
| 140 | int w, int h, | - | ||||||||||||
| 141 | int const_alpha) | - | ||||||||||||
| 142 | { | - | ||||||||||||
| 143 | - | |||||||||||||
| 144 | - | |||||||||||||
| 145 | - | |||||||||||||
| 146 | - | |||||||||||||
| 147 | - | |||||||||||||
| 148 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 149 | if (w <= 64 
 | 0 | ||||||||||||
| 150 | while (h-- 
 | 0 | ||||||||||||
| 151 | do { ushort *_d = (ushort*)(dst); const ushort *_s = (const ushort*)(src); int n = ((w) + 7) / 8; switch ((w) & 0x07) { case never executed: 0: case 0:never executed: do { *_d++ = *_s++; case case 0:never executed: 7: case 7:never executed:  case 7:code before this statement never executed: *_d++ = *_s++; case case 7:never executed: 6: case 6:never executed:  case 6:code before this statement never executed: *_d++ = *_s++; case case 6:never executed: 5: case 5:never executed:  case 5:code before this statement never executed: *_d++ = *_s++; case case 5:never executed: 4: case 4:never executed:  case 4:code before this statement never executed: *_d++ = *_s++; case case 4:never executed: 3: case 3:never executed:  case 3:code before this statement never executed: *_d++ = *_s++; case case 3:never executed: 2: case 2:never executed:  case 2:code before this statement never executed: *_d++ = *_s++; case case 2:never executed: 1: case 1:never executed:  case 1:code before this statement never executed: *_d++ = *_s++; } case 1:never executed: while (-- end of block
 
 never executed: } while (0); end of block | 0 | ||||||||||||
| 152 | dst += dbpl; | - | ||||||||||||
| 153 | src += sbpl; | - | ||||||||||||
| 154 | } never executed:  end of block | 0 | ||||||||||||
| 155 | } never executed: else { end of block | 0 | ||||||||||||
| 156 | int length = w << 1; | - | ||||||||||||
| 157 | while (h-- 
 | 0 | ||||||||||||
| 158 | memcpy(dst, src, length); | - | ||||||||||||
| 159 | dst += dbpl; | - | ||||||||||||
| 160 | src += sbpl; | - | ||||||||||||
| 161 | } never executed:  end of block | 0 | ||||||||||||
| 162 | } never executed:  end of block | 0 | ||||||||||||
| 163 | } else if (const_alpha != 0 
 | 0 | ||||||||||||
| 164 | quint16 *d = (quint16 *) dst; | - | ||||||||||||
| 165 | const quint16 *s = (const quint16 *) src; | - | ||||||||||||
| 166 | quint8 a = (255 * const_alpha) >> 8; | - | ||||||||||||
| 167 | quint8 ia = 255 - a; | - | ||||||||||||
| 168 | while (h-- 
 | 0 | ||||||||||||
| 169 | for (int x=0; x<w 
 | 0 | ||||||||||||
| 170 | d[x] = BYTE_MUL_RGB16(s[x], a) + BYTE_MUL_RGB16(d[x], ia); | - | ||||||||||||
| 171 | } never executed:  end of block | 0 | ||||||||||||
| 172 | d = (quint16 *)(((uchar *) d) + dbpl); | - | ||||||||||||
| 173 | s = (const quint16 *)(((const uchar *) s) + sbpl); | - | ||||||||||||
| 174 | } never executed:  end of block | 0 | ||||||||||||
| 175 | } never executed:  end of block | 0 | ||||||||||||
| 176 | } never executed:  end of block | 0 | ||||||||||||
| 177 | - | |||||||||||||
| 178 | - | |||||||||||||
| 179 | void qt_blend_argb32_on_rgb16_const_alpha(uchar *destPixels, int dbpl, | - | ||||||||||||
| 180 | const uchar *srcPixels, int sbpl, | - | ||||||||||||
| 181 | int w, int h, | - | ||||||||||||
| 182 | int const_alpha) | - | ||||||||||||
| 183 | { | - | ||||||||||||
| 184 | quint16 *dst = (quint16 *) destPixels; | - | ||||||||||||
| 185 | const quint32 *src = (const quint32 *) srcPixels; | - | ||||||||||||
| 186 | - | |||||||||||||
| 187 | const_alpha = (const_alpha * 255) >> 8; | - | ||||||||||||
| 188 | for (int y=0; y<h 
 | 0 | ||||||||||||
| 189 | for (int i = 0; i < w 
 | 0 | ||||||||||||
| 190 | uint s = src[i]; | - | ||||||||||||
| 191 | s = BYTE_MUL(s, const_alpha); | - | ||||||||||||
| 192 | int alpha = qAlpha(s); | - | ||||||||||||
| 193 | s = qConvertRgb32To16(s); | - | ||||||||||||
| 194 | s += BYTE_MUL_RGB16(dst[i], 255 - alpha); | - | ||||||||||||
| 195 | dst[i] = s; | - | ||||||||||||
| 196 | } never executed:  end of block | 0 | ||||||||||||
| 197 | dst = (quint16 *)(((uchar *) dst) + dbpl); | - | ||||||||||||
| 198 | src = (const quint32 *)(((const uchar *) src) + sbpl); | - | ||||||||||||
| 199 | } never executed:  end of block | 0 | ||||||||||||
| 200 | } never executed:  end of block | 0 | ||||||||||||
| 201 | - | |||||||||||||
| 202 | static void qt_blend_argb32_on_rgb16(uchar *destPixels, int dbpl, | - | ||||||||||||
| 203 | const uchar *srcPixels, int sbpl, | - | ||||||||||||
| 204 | int w, int h, | - | ||||||||||||
| 205 | int const_alpha) | - | ||||||||||||
| 206 | { | - | ||||||||||||
| 207 | if (const_alpha != 256 
 | 0 | ||||||||||||
| 208 | qt_blend_argb32_on_rgb16_const_alpha(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); | - | ||||||||||||
| 209 | return; never executed:  return; | 0 | ||||||||||||
| 210 | } | - | ||||||||||||
| 211 | - | |||||||||||||
| 212 | quint16 *dst = (quint16 *) destPixels; | - | ||||||||||||
| 213 | const quint32 *src = (const quint32 *) srcPixels; | - | ||||||||||||
| 214 | - | |||||||||||||
| 215 | for (int y=0; y<h 
 | 0 | ||||||||||||
| 216 | for (int x=0; x<w 
 | 0 | ||||||||||||
| 217 | - | |||||||||||||
| 218 | quint32 spix = src[x]; | - | ||||||||||||
| 219 | quint32 alpha = spix >> 24; | - | ||||||||||||
| 220 | - | |||||||||||||
| 221 | if (alpha == 255 
 | 0 | ||||||||||||
| 222 | dst[x] = qConvertRgb32To16(spix); | - | ||||||||||||
| 223 | } never executed: else if (alpha != 0 end of block
 | 0 | ||||||||||||
| 224 | quint32 dpix = dst[x]; | - | ||||||||||||
| 225 | - | |||||||||||||
| 226 | quint32 sia = 255 - alpha; | - | ||||||||||||
| 227 | - | |||||||||||||
| 228 | quint32 sr = (spix >> 8) & 0xf800; | - | ||||||||||||
| 229 | quint32 sg = (spix >> 5) & 0x07e0; | - | ||||||||||||
| 230 | quint32 sb = (spix >> 3) & 0x001f; | - | ||||||||||||
| 231 | - | |||||||||||||
| 232 | quint32 dr = (dpix & 0x0000f800); | - | ||||||||||||
| 233 | quint32 dg = (dpix & 0x000007e0); | - | ||||||||||||
| 234 | quint32 db = (dpix & 0x0000001f); | - | ||||||||||||
| 235 | - | |||||||||||||
| 236 | quint32 siar = dr * sia; | - | ||||||||||||
| 237 | quint32 siag = dg * sia; | - | ||||||||||||
| 238 | quint32 siab = db * sia; | - | ||||||||||||
| 239 | - | |||||||||||||
| 240 | quint32 rr = sr + ((siar + (siar>>8) + (0x80 << 8)) >> 8); | - | ||||||||||||
| 241 | quint32 rg = sg + ((siag + (siag>>8) + (0x80 << 3)) >> 8); | - | ||||||||||||
| 242 | quint32 rb = sb + ((siab + (siab>>8) + (0x80 >> 3)) >> 8); | - | ||||||||||||
| 243 | - | |||||||||||||
| 244 | dst[x] = (rr & 0xf800) | - | ||||||||||||
| 245 | | (rg & 0x07e0) | - | ||||||||||||
| 246 | | (rb); | - | ||||||||||||
| 247 | } never executed:  end of block | 0 | ||||||||||||
| 248 | } never executed:  end of block | 0 | ||||||||||||
| 249 | dst = (quint16 *) (((uchar *) dst) + dbpl); | - | ||||||||||||
| 250 | src = (const quint32 *) (((const uchar *) src) + sbpl); | - | ||||||||||||
| 251 | } never executed:  end of block | 0 | ||||||||||||
| 252 | } never executed:  end of block | 0 | ||||||||||||
| 253 | - | |||||||||||||
| 254 | - | |||||||||||||
| 255 | static void qt_blend_rgb32_on_rgb16(uchar *destPixels, int dbpl, | - | ||||||||||||
| 256 | const uchar *srcPixels, int sbpl, | - | ||||||||||||
| 257 | int w, int h, | - | ||||||||||||
| 258 | int const_alpha) | - | ||||||||||||
| 259 | { | - | ||||||||||||
| 260 | - | |||||||||||||
| 261 | - | |||||||||||||
| 262 | - | |||||||||||||
| 263 | - | |||||||||||||
| 264 | - | |||||||||||||
| 265 | if (const_alpha != 256 
 | 0 | ||||||||||||
| 266 | qt_blend_argb32_on_rgb16(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); | - | ||||||||||||
| 267 | return; never executed:  return; | 0 | ||||||||||||
| 268 | } | - | ||||||||||||
| 269 | - | |||||||||||||
| 270 | const quint32 *src = (const quint32 *) srcPixels; | - | ||||||||||||
| 271 | int srcExtraStride = (sbpl >> 2) - w; | - | ||||||||||||
| 272 | - | |||||||||||||
| 273 | int dstJPL = dbpl / 2; | - | ||||||||||||
| 274 | - | |||||||||||||
| 275 | quint16 *dst = (quint16 *) destPixels; | - | ||||||||||||
| 276 | quint16 *dstEnd = dst + dstJPL * h; | - | ||||||||||||
| 277 | - | |||||||||||||
| 278 | int dstExtraStride = dstJPL - w; | - | ||||||||||||
| 279 | - | |||||||||||||
| 280 | while (dst < dstEnd 
 | 0 | ||||||||||||
| 281 | const quint32 *srcEnd = src + w; | - | ||||||||||||
| 282 | while (src < srcEnd 
 | 0 | ||||||||||||
| 283 | *dst = qConvertRgb32To16(*src); | - | ||||||||||||
| 284 | ++dst; | - | ||||||||||||
| 285 | ++src; | - | ||||||||||||
| 286 | } never executed:  end of block | 0 | ||||||||||||
| 287 | dst += dstExtraStride; | - | ||||||||||||
| 288 | src += srcExtraStride; | - | ||||||||||||
| 289 | } never executed:  end of block | 0 | ||||||||||||
| 290 | } never executed:  end of block | 0 | ||||||||||||
| 291 | - | |||||||||||||
| 292 | - | |||||||||||||
| 293 | - | |||||||||||||
| 294 | - | |||||||||||||
| 295 | - | |||||||||||||
| 296 | - | |||||||||||||
| 297 | - | |||||||||||||
| 298 | static void qt_blend_argb32_on_argb32(uchar *destPixels, int dbpl, | - | ||||||||||||
| 299 | const uchar *srcPixels, int sbpl, | - | ||||||||||||
| 300 | int w, int h, | - | ||||||||||||
| 301 | int const_alpha) | - | ||||||||||||
| 302 | { | - | ||||||||||||
| 303 | - | |||||||||||||
| 304 | - | |||||||||||||
| 305 | - | |||||||||||||
| 306 | - | |||||||||||||
| 307 | - | |||||||||||||
| 308 | - | |||||||||||||
| 309 | const uint *src = (const uint *) srcPixels; | - | ||||||||||||
| 310 | uint *dst = (uint *) destPixels; | - | ||||||||||||
| 311 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 312 | for (int y=0; y<h 
 | 0 | ||||||||||||
| 313 | for (int x=0; x<w 
 | 0 | ||||||||||||
| 314 | uint s = src[x]; | - | ||||||||||||
| 315 | if (s >= 0xff000000 
 | 0 | ||||||||||||
| 316 | dst[x] = s; never executed:  dst[x] = s; | 0 | ||||||||||||
| 317 | else if (s != 0 
 | 0 | ||||||||||||
| 318 | dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); never executed:  dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); | 0 | ||||||||||||
| 319 | } never executed:  end of block | 0 | ||||||||||||
| 320 | dst = (quint32 *)(((uchar *) dst) + dbpl); | - | ||||||||||||
| 321 | src = (const quint32 *)(((const uchar *) src) + sbpl); | - | ||||||||||||
| 322 | } never executed:  end of block | 0 | ||||||||||||
| 323 | } never executed: else if (const_alpha != 0 end of block
 | 0 | ||||||||||||
| 324 | const_alpha = (const_alpha * 255) >> 8; | - | ||||||||||||
| 325 | for (int y=0; y<h 
 | 0 | ||||||||||||
| 326 | for (int x=0; x<w 
 | 0 | ||||||||||||
| 327 | uint s = BYTE_MUL(src[x], const_alpha); | - | ||||||||||||
| 328 | dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); | - | ||||||||||||
| 329 | } never executed:  end of block | 0 | ||||||||||||
| 330 | dst = (quint32 *)(((uchar *) dst) + dbpl); | - | ||||||||||||
| 331 | src = (const quint32 *)(((const uchar *) src) + sbpl); | - | ||||||||||||
| 332 | } never executed:  end of block | 0 | ||||||||||||
| 333 | } never executed:  end of block | 0 | ||||||||||||
| 334 | } never executed:  end of block | 0 | ||||||||||||
| 335 | - | |||||||||||||
| 336 | - | |||||||||||||
| 337 | void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl, | - | ||||||||||||
| 338 | const uchar *srcPixels, int sbpl, | - | ||||||||||||
| 339 | int w, int h, | - | ||||||||||||
| 340 | int const_alpha) | - | ||||||||||||
| 341 | { | - | ||||||||||||
| 342 | - | |||||||||||||
| 343 | - | |||||||||||||
| 344 | - | |||||||||||||
| 345 | - | |||||||||||||
| 346 | - | |||||||||||||
| 347 | - | |||||||||||||
| 348 | if (const_alpha != 256 
 | 0 | ||||||||||||
| 349 | qt_blend_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); | - | ||||||||||||
| 350 | return; never executed:  return; | 0 | ||||||||||||
| 351 | } | - | ||||||||||||
| 352 | - | |||||||||||||
| 353 | const uint *src = (const uint *) srcPixels; | - | ||||||||||||
| 354 | uint *dst = (uint *) destPixels; | - | ||||||||||||
| 355 | int len = w * 4; | - | ||||||||||||
| 356 | for (int y=0; y<h 
 | 0 | ||||||||||||
| 357 | memcpy(dst, src, len); | - | ||||||||||||
| 358 | dst = (quint32 *)(((uchar *) dst) + dbpl); | - | ||||||||||||
| 359 | src = (const quint32 *)(((const uchar *) src) + sbpl); | - | ||||||||||||
| 360 | } never executed:  end of block | 0 | ||||||||||||
| 361 | } never executed:  end of block | 0 | ||||||||||||
| 362 | - | |||||||||||||
| 363 | struct Blend_RGB32_on_RGB32_NoAlpha { | - | ||||||||||||
| 364 | inline void write(quint32 *dst, quint32 src) { *dst = src; } never executed:  end of block | 0 | ||||||||||||
| 365 | - | |||||||||||||
| 366 | inline void flush(void *) {} | - | ||||||||||||
| 367 | }; | - | ||||||||||||
| 368 | - | |||||||||||||
| 369 | struct Blend_RGB32_on_RGB32_ConstAlpha { | - | ||||||||||||
| 370 | inline Blend_RGB32_on_RGB32_ConstAlpha(quint32 alpha) { | - | ||||||||||||
| 371 | m_alpha = (alpha * 255) >> 8; | - | ||||||||||||
| 372 | m_ialpha = 255 - m_alpha; | - | ||||||||||||
| 373 | } never executed:  end of block | 0 | ||||||||||||
| 374 | - | |||||||||||||
| 375 | inline void write(quint32 *dst, quint32 src) { | - | ||||||||||||
| 376 | *dst = BYTE_MUL(src, m_alpha) + BYTE_MUL(*dst, m_ialpha); | - | ||||||||||||
| 377 | } never executed:  end of block | 0 | ||||||||||||
| 378 | - | |||||||||||||
| 379 | inline void flush(void *) {} | - | ||||||||||||
| 380 | - | |||||||||||||
| 381 | quint32 m_alpha; | - | ||||||||||||
| 382 | quint32 m_ialpha; | - | ||||||||||||
| 383 | }; | - | ||||||||||||
| 384 | - | |||||||||||||
| 385 | struct Blend_ARGB32_on_ARGB32_SourceAlpha { | - | ||||||||||||
| 386 | inline void write(quint32 *dst, quint32 src) { | - | ||||||||||||
| 387 | *dst = src + BYTE_MUL(*dst, qAlpha(~src)); | - | ||||||||||||
| 388 | } never executed:  end of block | 0 | ||||||||||||
| 389 | - | |||||||||||||
| 390 | inline void flush(void *) {} | - | ||||||||||||
| 391 | }; | - | ||||||||||||
| 392 | - | |||||||||||||
| 393 | struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha { | - | ||||||||||||
| 394 | inline Blend_ARGB32_on_ARGB32_SourceAndConstAlpha(quint32 alpha) { | - | ||||||||||||
| 395 | m_alpha = (alpha * 255) >> 8; | - | ||||||||||||
| 396 | m_ialpha = 255 - m_alpha; | - | ||||||||||||
| 397 | } never executed:  end of block | 0 | ||||||||||||
| 398 | - | |||||||||||||
| 399 | inline void write(quint32 *dst, quint32 src) { | - | ||||||||||||
| 400 | src = BYTE_MUL(src, m_alpha); | - | ||||||||||||
| 401 | *dst = src + BYTE_MUL(*dst, qAlpha(~src)); | - | ||||||||||||
| 402 | } never executed:  end of block | 0 | ||||||||||||
| 403 | - | |||||||||||||
| 404 | inline void flush(void *) {} | - | ||||||||||||
| 405 | - | |||||||||||||
| 406 | quint32 m_alpha; | - | ||||||||||||
| 407 | quint32 m_ialpha; | - | ||||||||||||
| 408 | }; | - | ||||||||||||
| 409 | - | |||||||||||||
| 410 | void qt_scale_image_rgb32_on_rgb32(uchar *destPixels, int dbpl, | - | ||||||||||||
| 411 | const uchar *srcPixels, int sbpl, int srch, | - | ||||||||||||
| 412 | const QRectF &targetRect, | - | ||||||||||||
| 413 | const QRectF &sourceRect, | - | ||||||||||||
| 414 | const QRect &clip, | - | ||||||||||||
| 415 | int const_alpha) | - | ||||||||||||
| 416 | { | - | ||||||||||||
| 417 | - | |||||||||||||
| 418 | - | |||||||||||||
| 419 | - | |||||||||||||
| 420 | - | |||||||||||||
| 421 | - | |||||||||||||
| 422 | - | |||||||||||||
| 423 | - | |||||||||||||
| 424 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 425 | Blend_RGB32_on_RGB32_NoAlpha noAlpha; | - | ||||||||||||
| 426 | qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch, | - | ||||||||||||
| 427 | targetRect, sourceRect, clip, noAlpha); | - | ||||||||||||
| 428 | } never executed: else { end of block | 0 | ||||||||||||
| 429 | Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha); | - | ||||||||||||
| 430 | qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch, | - | ||||||||||||
| 431 | targetRect, sourceRect, clip, constAlpha); | - | ||||||||||||
| 432 | } never executed:  end of block | 0 | ||||||||||||
| 433 | } | - | ||||||||||||
| 434 | - | |||||||||||||
| 435 | void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl, | - | ||||||||||||
| 436 | const uchar *srcPixels, int sbpl, int srch, | - | ||||||||||||
| 437 | const QRectF &targetRect, | - | ||||||||||||
| 438 | const QRectF &sourceRect, | - | ||||||||||||
| 439 | const QRect &clip, | - | ||||||||||||
| 440 | int const_alpha) | - | ||||||||||||
| 441 | { | - | ||||||||||||
| 442 | - | |||||||||||||
| 443 | - | |||||||||||||
| 444 | - | |||||||||||||
| 445 | - | |||||||||||||
| 446 | - | |||||||||||||
| 447 | - | |||||||||||||
| 448 | - | |||||||||||||
| 449 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 450 | Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha; | - | ||||||||||||
| 451 | qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch, | - | ||||||||||||
| 452 | targetRect, sourceRect, clip, sourceAlpha); | - | ||||||||||||
| 453 | } never executed: else { end of block | 0 | ||||||||||||
| 454 | Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha); | - | ||||||||||||
| 455 | qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch, | - | ||||||||||||
| 456 | targetRect, sourceRect, clip, constAlpha); | - | ||||||||||||
| 457 | } never executed:  end of block | 0 | ||||||||||||
| 458 | } | - | ||||||||||||
| 459 | - | |||||||||||||
| 460 | void qt_transform_image_rgb16_on_rgb16(uchar *destPixels, int dbpl, | - | ||||||||||||
| 461 | const uchar *srcPixels, int sbpl, | - | ||||||||||||
| 462 | const QRectF &targetRect, | - | ||||||||||||
| 463 | const QRectF &sourceRect, | - | ||||||||||||
| 464 | const QRect &clip, | - | ||||||||||||
| 465 | const QTransform &targetRectTransform, | - | ||||||||||||
| 466 | int const_alpha) | - | ||||||||||||
| 467 | { | - | ||||||||||||
| 468 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 469 | Blend_RGB16_on_RGB16_NoAlpha noAlpha; | - | ||||||||||||
| 470 | qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, | - | ||||||||||||
| 471 | reinterpret_cast<const quint16 *>(srcPixels), sbpl, | - | ||||||||||||
| 472 | targetRect, sourceRect, clip, targetRectTransform, noAlpha); | - | ||||||||||||
| 473 | } never executed: else { end of block | 0 | ||||||||||||
| 474 | Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha); | - | ||||||||||||
| 475 | qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, | - | ||||||||||||
| 476 | reinterpret_cast<const quint16 *>(srcPixels), sbpl, | - | ||||||||||||
| 477 | targetRect, sourceRect, clip, targetRectTransform, constAlpha); | - | ||||||||||||
| 478 | } never executed:  end of block | 0 | ||||||||||||
| 479 | } | - | ||||||||||||
| 480 | - | |||||||||||||
| 481 | void qt_transform_image_argb32_on_rgb16(uchar *destPixels, int dbpl, | - | ||||||||||||
| 482 | const uchar *srcPixels, int sbpl, | - | ||||||||||||
| 483 | const QRectF &targetRect, | - | ||||||||||||
| 484 | const QRectF &sourceRect, | - | ||||||||||||
| 485 | const QRect &clip, | - | ||||||||||||
| 486 | const QTransform &targetRectTransform, | - | ||||||||||||
| 487 | int const_alpha) | - | ||||||||||||
| 488 | { | - | ||||||||||||
| 489 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 490 | Blend_ARGB32_on_RGB16_SourceAlpha noAlpha; | - | ||||||||||||
| 491 | qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, | - | ||||||||||||
| 492 | reinterpret_cast<const quint32 *>(srcPixels), sbpl, | - | ||||||||||||
| 493 | targetRect, sourceRect, clip, targetRectTransform, noAlpha); | - | ||||||||||||
| 494 | } never executed: else { end of block | 0 | ||||||||||||
| 495 | Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha); | - | ||||||||||||
| 496 | qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, | - | ||||||||||||
| 497 | reinterpret_cast<const quint32 *>(srcPixels), sbpl, | - | ||||||||||||
| 498 | targetRect, sourceRect, clip, targetRectTransform, constAlpha); | - | ||||||||||||
| 499 | } never executed:  end of block | 0 | ||||||||||||
| 500 | } | - | ||||||||||||
| 501 | - | |||||||||||||
| 502 | - | |||||||||||||
| 503 | void qt_transform_image_rgb32_on_rgb32(uchar *destPixels, int dbpl, | - | ||||||||||||
| 504 | const uchar *srcPixels, int sbpl, | - | ||||||||||||
| 505 | const QRectF &targetRect, | - | ||||||||||||
| 506 | const QRectF &sourceRect, | - | ||||||||||||
| 507 | const QRect &clip, | - | ||||||||||||
| 508 | const QTransform &targetRectTransform, | - | ||||||||||||
| 509 | int const_alpha) | - | ||||||||||||
| 510 | { | - | ||||||||||||
| 511 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 512 | Blend_RGB32_on_RGB32_NoAlpha noAlpha; | - | ||||||||||||
| 513 | qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl, | - | ||||||||||||
| 514 | reinterpret_cast<const quint32 *>(srcPixels), sbpl, | - | ||||||||||||
| 515 | targetRect, sourceRect, clip, targetRectTransform, noAlpha); | - | ||||||||||||
| 516 | } never executed: else { end of block | 0 | ||||||||||||
| 517 | Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha); | - | ||||||||||||
| 518 | qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl, | - | ||||||||||||
| 519 | reinterpret_cast<const quint32 *>(srcPixels), sbpl, | - | ||||||||||||
| 520 | targetRect, sourceRect, clip, targetRectTransform, constAlpha); | - | ||||||||||||
| 521 | } never executed:  end of block | 0 | ||||||||||||
| 522 | } | - | ||||||||||||
| 523 | - | |||||||||||||
| 524 | void qt_transform_image_argb32_on_argb32(uchar *destPixels, int dbpl, | - | ||||||||||||
| 525 | const uchar *srcPixels, int sbpl, | - | ||||||||||||
| 526 | const QRectF &targetRect, | - | ||||||||||||
| 527 | const QRectF &sourceRect, | - | ||||||||||||
| 528 | const QRect &clip, | - | ||||||||||||
| 529 | const QTransform &targetRectTransform, | - | ||||||||||||
| 530 | int const_alpha) | - | ||||||||||||
| 531 | { | - | ||||||||||||
| 532 | if (const_alpha == 256 
 | 0 | ||||||||||||
| 533 | Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha; | - | ||||||||||||
| 534 | qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl, | - | ||||||||||||
| 535 | reinterpret_cast<const quint32 *>(srcPixels), sbpl, | - | ||||||||||||
| 536 | targetRect, sourceRect, clip, targetRectTransform, sourceAlpha); | - | ||||||||||||
| 537 | } never executed: else { end of block | 0 | ||||||||||||
| 538 | Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha); | - | ||||||||||||
| 539 | qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl, | - | ||||||||||||
| 540 | reinterpret_cast<const quint32 *>(srcPixels), sbpl, | - | ||||||||||||
| 541 | targetRect, sourceRect, clip, targetRectTransform, constAlpha); | - | ||||||||||||
| 542 | } never executed:  end of block | 0 | ||||||||||||
| 543 | } | - | ||||||||||||
| 544 | - | |||||||||||||
| 545 | SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats]; | - | ||||||||||||
| 546 | SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats]; | - | ||||||||||||
| 547 | SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats]; | - | ||||||||||||
| 548 | - | |||||||||||||
| 549 | void qInitBlendFunctions() | - | ||||||||||||
| 550 | { | - | ||||||||||||
| 551 | qScaleFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_scale_image_rgb32_on_rgb32; | - | ||||||||||||
| 552 | qScaleFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32; | - | ||||||||||||
| 553 | qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_scale_image_rgb32_on_rgb32; | - | ||||||||||||
| 554 | qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32; | - | ||||||||||||
| 555 | qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16; | - | ||||||||||||
| 556 | qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16; | - | ||||||||||||
| 557 | - | |||||||||||||
| 558 | qScaleFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_scale_image_rgb32_on_rgb32; | - | ||||||||||||
| 559 | qScaleFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32; | - | ||||||||||||
| 560 | qScaleFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_scale_image_rgb32_on_rgb32; | - | ||||||||||||
| 561 | qScaleFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32; | - | ||||||||||||
| 562 | - | |||||||||||||
| 563 | - | |||||||||||||
| 564 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32; | - | ||||||||||||
| 565 | qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32; | - | ||||||||||||
| 566 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32; | - | ||||||||||||
| 567 | qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32; | - | ||||||||||||
| 568 | qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb16; | - | ||||||||||||
| 569 | qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16; | - | ||||||||||||
| 570 | qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16; | - | ||||||||||||
| 571 | - | |||||||||||||
| 572 | qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32; | - | ||||||||||||
| 573 | qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32; | - | ||||||||||||
| 574 | qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32; | - | ||||||||||||
| 575 | qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32; | - | ||||||||||||
| 576 | - | |||||||||||||
| 577 | - | |||||||||||||
| 578 | qTransformFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_transform_image_rgb32_on_rgb32; | - | ||||||||||||
| 579 | qTransformFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_argb32; | - | ||||||||||||
| 580 | qTransformFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_transform_image_rgb32_on_rgb32; | - | ||||||||||||
| 581 | qTransformFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_argb32; | - | ||||||||||||
| 582 | qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16; | - | ||||||||||||
| 583 | qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16; | - | ||||||||||||
| 584 | - | |||||||||||||
| 585 | qTransformFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_transform_image_rgb32_on_rgb32; | - | ||||||||||||
| 586 | qTransformFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_transform_image_argb32_on_argb32; | - | ||||||||||||
| 587 | qTransformFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_transform_image_rgb32_on_rgb32; | - | ||||||||||||
| 588 | qTransformFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_transform_image_argb32_on_argb32; | - | ||||||||||||
| 589 | - | |||||||||||||
| 590 | } never executed:  end of block | 0 | ||||||||||||
| 591 | - | |||||||||||||
| 592 | - | |||||||||||||
| Switch to Source code | Preprocessed file |