307 void setupMatrix(const QTransform &matrix, int bilinear); |
306 void setupMatrix(const QTransform &matrix, int bilinear); |
308 void initTexture(const QImage *image, int alpha, QTextureData::Type = QTextureData::Plain, const QRect &sourceRect = QRect()); |
307 void initTexture(const QImage *image, int alpha, QTextureData::Type = QTextureData::Plain, const QRect &sourceRect = QRect()); |
309 void adjustSpanMethods(); |
308 void adjustSpanMethods(); |
310 }; |
309 }; |
311 |
310 |
312 |
311 #if defined(Q_CC_RVCT) |
313 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) { |
312 # pragma push |
314 a += 1; |
313 # pragma arm |
315 uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0; |
314 #endif |
316 t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f; |
315 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { |
317 return t; |
316 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; |
318 } |
317 t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; |
319 |
318 t &= 0xff00ff; |
320 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) { |
319 |
321 uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0; |
320 x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; |
322 t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f; |
321 x = (x + ((x >> 8) & 0xff00ff) + 0x800080); |
323 return t; |
322 x &= 0xff00ff00; |
|
323 x |= t; |
|
324 return x; |
|
325 } |
|
326 #if defined(Q_CC_RVCT) |
|
327 # pragma pop |
|
328 #endif |
|
329 |
|
330 #if QT_POINTER_SIZE == 8 // 64-bit versions |
|
331 |
|
332 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { |
|
333 quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; |
|
334 t += (((quint64(y)) | ((quint64(y)) << 24)) & 0x00ff00ff00ff00ff) * b; |
|
335 t >>= 8; |
|
336 t &= 0x00ff00ff00ff00ff; |
|
337 return (uint(t)) | (uint(t >> 24)); |
|
338 } |
|
339 |
|
340 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) { |
|
341 quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; |
|
342 t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8; |
|
343 t &= 0x00ff00ff00ff00ff; |
|
344 return (uint(t)) | (uint(t >> 24)); |
|
345 } |
|
346 |
|
347 Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { |
|
348 uint a = x >> 24; |
|
349 quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; |
|
350 t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8; |
|
351 t &= 0x000000ff00ff00ff; |
|
352 return (uint(t)) | (uint(t >> 24)) | (a << 24); |
|
353 } |
|
354 |
|
355 #else // 32-bit versions |
|
356 |
|
357 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { |
|
358 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; |
|
359 t >>= 8; |
|
360 t &= 0xff00ff; |
|
361 |
|
362 x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; |
|
363 x &= 0xff00ff00; |
|
364 x |= t; |
|
365 return x; |
324 } |
366 } |
325 |
367 |
326 #if defined(Q_CC_RVCT) |
368 #if defined(Q_CC_RVCT) |
327 # pragma push |
369 # pragma push |
328 # pragma arm |
370 # pragma arm |
1839 |
1896 |
1840 inline int qBlue565(quint16 rgb) { |
1897 inline int qBlue565(quint16 rgb) { |
1841 const int b = (rgb & 0x001f); |
1898 const int b = (rgb & 0x001f); |
1842 return (b << 3) | (b >> 2); |
1899 return (b << 3) | (b >> 2); |
1843 } |
1900 } |
1844 |
|
1845 #if 1 |
|
1846 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { |
|
1847 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; |
|
1848 t >>= 8; |
|
1849 t &= 0xff00ff; |
|
1850 |
|
1851 x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; |
|
1852 x &= 0xff00ff00; |
|
1853 x |= t; |
|
1854 return x; |
|
1855 } |
|
1856 |
|
1857 #if defined(Q_CC_RVCT) |
|
1858 # pragma push |
|
1859 # pragma arm |
|
1860 #endif |
|
1861 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { |
|
1862 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; |
|
1863 t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; |
|
1864 t &= 0xff00ff; |
|
1865 |
|
1866 x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; |
|
1867 x = (x + ((x >> 8) & 0xff00ff) + 0x800080); |
|
1868 x &= 0xff00ff00; |
|
1869 x |= t; |
|
1870 return x; |
|
1871 } |
|
1872 #if defined(Q_CC_RVCT) |
|
1873 # pragma pop |
|
1874 #endif |
|
1875 #else |
|
1876 // possible implementation for 64 bit |
|
1877 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { |
|
1878 ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; |
|
1879 t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b; |
|
1880 t >>= 8; |
|
1881 t &= 0x00ff00ff00ff00ff; |
|
1882 return (uint(t)) | (uint(t >> 24)); |
|
1883 } |
|
1884 |
|
1885 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { |
|
1886 ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; |
|
1887 t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b; |
|
1888 t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080); |
|
1889 t &= 0x00ff00ff00ff00ff; |
|
1890 return (uint(t)) | (uint(t >> 24)); |
|
1891 } |
|
1892 |
|
1893 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) { |
|
1894 ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; |
|
1895 t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080); |
|
1896 t &= 0x00ff00ff00ff00ff; |
|
1897 return (uint(t)) | (uint(t >> 24)); |
|
1898 } |
|
1899 |
|
1900 Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { |
|
1901 uint a = x >> 24; |
|
1902 ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; |
|
1903 t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080); |
|
1904 t &= 0x00ff00ff00ff00ff; |
|
1905 return (uint(t)) | (uint(t >> 24)) | 0xff000000; |
|
1906 } |
|
1907 #endif |
|
1908 |
1901 |
1909 const uint qt_bayer_matrix[16][16] = { |
1902 const uint qt_bayer_matrix[16][16] = { |
1910 { 0x1, 0xc0, 0x30, 0xf0, 0xc, 0xcc, 0x3c, 0xfc, |
1903 { 0x1, 0xc0, 0x30, 0xf0, 0xc, 0xcc, 0x3c, 0xfc, |
1911 0x3, 0xc3, 0x33, 0xf3, 0xf, 0xcf, 0x3f, 0xff}, |
1904 0x3, 0xc3, 0x33, 0xf3, 0xf, 0xcf, 0x3f, 0xff}, |
1912 { 0x80, 0x40, 0xb0, 0x70, 0x8c, 0x4c, 0xbc, 0x7c, |
1905 { 0x80, 0x40, 0xb0, 0x70, 0x8c, 0x4c, 0xbc, 0x7c, |
1943 |
1936 |
1944 #define ARGB_COMBINE_ALPHA(argb, alpha) \ |
1937 #define ARGB_COMBINE_ALPHA(argb, alpha) \ |
1945 ((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff) |
1938 ((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff) |
1946 |
1939 |
1947 |
1940 |
|
1941 #if QT_POINTER_SIZE == 8 // 64-bit versions |
|
1942 #define AMIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) |
|
1943 #define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) |
|
1944 #else // 32 bits |
|
1945 // The mask for alpha can overflow over 32 bits |
|
1946 #define AMIX(mask) quint32(qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) |
|
1947 #define MIX(mask) (qMin(((quint32(s)&mask) + (quint32(d)&mask)), quint32(mask))) |
|
1948 #endif |
|
1949 |
|
1950 inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha) |
|
1951 { |
|
1952 const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); |
|
1953 return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha); |
|
1954 } |
|
1955 |
|
1956 inline int comp_func_Plus_one_pixel(uint d, const uint s) |
|
1957 { |
|
1958 const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK)); |
|
1959 return result; |
|
1960 } |
|
1961 |
|
1962 #undef MIX |
|
1963 #undef AMIX |
|
1964 |
|
1965 // prototypes of all the composition functions |
|
1966 void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha); |
|
1967 void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha); |
|
1968 void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha); |
|
1969 void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint const_alpha); |
|
1970 void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint); |
|
1971 void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha); |
|
1972 void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha); |
|
1973 void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha); |
|
1974 void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha); |
|
1975 void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha); |
|
1976 void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha); |
|
1977 void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha); |
|
1978 void QT_FASTCALL comp_func_Plus(uint *dest, const uint *src, int length, uint const_alpha); |
|
1979 void QT_FASTCALL comp_func_Multiply(uint *dest, const uint *src, int length, uint const_alpha); |
|
1980 void QT_FASTCALL comp_func_Screen(uint *dest, const uint *src, int length, uint const_alpha); |
|
1981 void QT_FASTCALL comp_func_Overlay(uint *dest, const uint *src, int length, uint const_alpha); |
|
1982 void QT_FASTCALL comp_func_Darken(uint *dest, const uint *src, int length, uint const_alpha); |
|
1983 void QT_FASTCALL comp_func_Lighten(uint *dest, const uint *src, int length, uint const_alpha); |
|
1984 void QT_FASTCALL comp_func_ColorDodge(uint *dest, const uint *src, int length, uint const_alpha); |
|
1985 void QT_FASTCALL comp_func_ColorBurn(uint *dest, const uint *src, int length, uint const_alpha); |
|
1986 void QT_FASTCALL comp_func_HardLight(uint *dest, const uint *src, int length, uint const_alpha); |
|
1987 void QT_FASTCALL comp_func_SoftLight(uint *dest, const uint *src, int length, uint const_alpha); |
|
1988 void QT_FASTCALL comp_func_Difference(uint *dest, const uint *src, int length, uint const_alpha); |
|
1989 void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, uint const_alpha); |
|
1990 void QT_FASTCALL rasterop_SourceOrDestination(uint *dest, const uint *src, int length, uint const_alpha); |
|
1991 void QT_FASTCALL rasterop_SourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha); |
|
1992 void QT_FASTCALL rasterop_SourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha); |
|
1993 void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha); |
|
1994 void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest, const uint *src, int length, uint const_alpha); |
|
1995 void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest, const uint *src, int length, uint const_alpha); |
|
1996 void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src, int length, uint const_alpha); |
|
1997 void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha); |
|
1998 void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha); |
|
1999 |
|
2000 // prototypes of all the solid composition functions |
|
2001 void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha); |
|
2002 void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint color, uint const_alpha); |
|
2003 void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint color, uint const_alpha); |
|
2004 void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha); |
|
2005 void QT_FASTCALL comp_func_solid_Destination(uint *dest, int length, uint color, uint const_alpha); |
|
2006 void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha); |
|
2007 void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint color, uint const_alpha); |
|
2008 void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha); |
|
2009 void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint color, uint const_alpha); |
|
2010 void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color, uint const_alpha); |
|
2011 void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint color, uint const_alpha); |
|
2012 void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint const_alpha); |
|
2013 void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint const_alpha); |
|
2014 void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint color, uint const_alpha); |
|
2015 void QT_FASTCALL comp_func_solid_Screen(uint *dest, int length, uint color, uint const_alpha); |
|
2016 void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint color, uint const_alpha); |
|
2017 void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint color, uint const_alpha); |
|
2018 void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint color, uint const_alpha); |
|
2019 void QT_FASTCALL comp_func_solid_ColorDodge(uint *dest, int length, uint color, uint const_alpha); |
|
2020 void QT_FASTCALL comp_func_solid_ColorBurn(uint *dest, int length, uint color, uint const_alpha); |
|
2021 void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint color, uint const_alpha); |
|
2022 void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, uint const_alpha); |
|
2023 void QT_FASTCALL comp_func_solid_Difference(uint *dest, int length, uint color, uint const_alpha); |
|
2024 void QT_FASTCALL comp_func_solid_Exclusion(uint *dest, int length, uint color, uint const_alpha); |
|
2025 void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, int length, uint color, uint const_alpha); |
|
2026 void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest, int length, uint color, uint const_alpha); |
|
2027 void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest, int length, uint color, uint const_alpha); |
|
2028 void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha); |
|
2029 void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest, int length, uint color, uint const_alpha); |
|
2030 void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest, int length, uint color, uint const_alpha); |
|
2031 void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length, uint color, uint const_alpha); |
|
2032 void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest, int length, uint color, uint const_alpha); |
|
2033 void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha); |
|
2034 |
1948 QT_END_NAMESPACE |
2035 QT_END_NAMESPACE |
1949 |
2036 |
1950 #endif // QDRAWHELPER_P_H |
2037 #endif // QDRAWHELPER_P_H |