Changeset 561 for trunk/src/gui/painting/qdrawhelper_p.h
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/painting/qdrawhelper_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 88 88 // RVCT doesn't like static template functions 89 89 # define Q_STATIC_TEMPLATE_FUNCTION 90 # define Q_STATIC_INLINE_FUNCTION inline90 # define Q_STATIC_INLINE_FUNCTION static __forceinline 91 91 #else 92 92 # define Q_STATIC_TEMPLATE_FUNCTION static … … 111 111 class QRasterBuffer; 112 112 class QClipData; 113 class QRasterPaintEngineState; 113 114 114 115 typedef QT_FT_SpanFunc ProcessSpans; … … 145 146 const QRect &clipRect, 146 147 int const_alpha); 148 149 typedef void (*SrcOverTransformFunc)(uchar *destPixels, int dbpl, 150 const uchar *src, int spbl, 151 const QRectF &targetRect, 152 const QRectF &sourceRect, 153 const QRect &clipRect, 154 const QTransform &targetRectTransform, 155 int const_alpha); 147 156 148 157 … … 158 167 extern SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats]; 159 168 extern SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats]; 169 extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats]; 160 170 161 171 extern DrawHelper qDrawHelper[QImage::NImageFormats]; … … 294 304 295 305 void init(QRasterBuffer *rb, const QRasterPaintEngine *pe); 296 void setup(const QBrush &brush, int alpha );306 void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode); 297 307 void setupMatrix(const QTransform &matrix, int bilinear); 298 308 void initTexture(const QImage *image, int alpha, QTextureData::Type = QTextureData::Plain, const QRect &sourceRect = QRect()); … … 301 311 302 312 303 static inlineuint BYTE_MUL_RGB16(uint x, uint a) {313 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) { 304 314 a += 1; 305 315 uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0; … … 308 318 } 309 319 310 static inlineuint BYTE_MUL_RGB16_32(uint x, uint a) {320 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) { 311 321 uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0; 312 322 t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f; … … 314 324 } 315 325 326 #if defined(Q_CC_RVCT) 327 # pragma push 328 # pragma arm 329 #endif 316 330 Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) { 317 331 uint t = (x & 0xff00ff) * a; … … 325 339 return x; 326 340 } 327 328 static inline uint PREMUL(uint x) { 341 #if defined(Q_CC_RVCT) 342 # pragma pop 343 #endif 344 345 Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { 329 346 uint a = x >> 24; 330 347 uint t = (x & 0xff00ff) * a; … … 391 408 } 392 409 393 static inlinequint32p fromRawData(quint32 v)410 Q_STATIC_INLINE_FUNCTION quint32p fromRawData(quint32 v) 394 411 { 395 412 quint32p p; … … 422 439 { 423 440 public: 424 static inlinebool hasAlpha() { return true; }441 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; } 425 442 426 443 inline qargb8565() {} … … 439 456 return *this; 440 457 } 441 static inlinequint8 alpha(quint8 a) { return (a + 1) >> 3; }442 static inlinequint8 ialpha(quint8 a) { return 0x20 - alpha(a); }458 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; } 459 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); } 443 460 444 461 inline qargb8565 byte_mul(quint8 a) const; … … 447 464 448 465 inline quint32 rawValue() const; 466 inline quint16 rawValue16() const; 449 467 450 468 private: … … 457 475 { 458 476 public: 459 static inlinebool hasAlpha() { return false; }477 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; } 460 478 461 479 qrgb565(int v = 0) : data(v) {} … … 463 481 inline explicit qrgb565(quint32p v); 464 482 inline explicit qrgb565(quint32 v); 465 inline explicit qrgb565( qargb8565v);483 inline explicit qrgb565(const qargb8565 &v); 466 484 467 485 inline operator quint32() const; … … 472 490 inline quint8 alpha() const { return 0xff; } 473 491 inline qrgb565 truncedAlpha() { return *this; } 474 static inlinequint8 alpha(quint8 a) { return (a + 1) >> 3; }475 static inlinequint8 ialpha(quint8 a) { return 0x20 - alpha(a); }492 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; } 493 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); } 476 494 477 495 inline qrgb565 byte_mul(quint8 a) const; … … 569 587 } 570 588 589 quint16 qargb8565::rawValue16() const 590 { 591 return (data[2] << 8) | data[1]; 592 } 593 571 594 qrgb565::qrgb565(quint32p v) 572 595 { … … 583 606 } 584 607 585 qrgb565::qrgb565( qargb8565v)608 qrgb565::qrgb565(const qargb8565 &v) 586 609 { 587 610 data = (v.data[2] << 8) | v.data[1]; … … 648 671 { 649 672 public: 650 static inlinebool hasAlpha() { return true; }673 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; } 651 674 652 675 qargb8555() {} … … 660 683 inline quint8 alpha() const { return data[0]; } 661 684 inline qargb8555 truncedAlpha() { data[0] &= 0xf8; return *this; } 662 static inlinequint8 alpha(quint8 a) { return (a + 1) >> 3; }663 static inlinequint8 ialpha(quint8 a) { return 0x20 - alpha(a); }685 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; } 686 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); } 664 687 665 688 inline qargb8555 operator+(qargb8555 v) const; … … 678 701 { 679 702 public: 680 static inlinebool hasAlpha() { return false; }703 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; } 681 704 682 705 inline qrgb555(int v = 0) : data(v) {} … … 727 750 inline quint8 alpha() const { return 0xff; } 728 751 inline qrgb555 truncedAlpha() { return *this; } 729 static inlinequint8 alpha(quint8 a) { return (a + 1) >> 3; }730 static inlinequint8 ialpha(quint8 a) { return 0x20 - alpha(a); }752 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 3; } 753 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x20 - alpha(a); } 731 754 732 755 inline bool operator==(const qrgb555 &v) const { return v.data == data; } … … 876 899 { 877 900 public: 878 static inlinebool hasAlpha() { return true; }901 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; } 879 902 880 903 inline qargb6666() {} … … 888 911 inline quint8 alpha() const; 889 912 inline qargb6666 truncedAlpha() { return *this; } 890 static inlinequint8 alpha(quint8 a) { return (a + 1) >> 2; }891 static inlinequint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }913 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 2; } 914 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; } 892 915 893 916 inline qargb6666 byte_mul(quint8 a) const; … … 906 929 { 907 930 public: 908 static inlinebool hasAlpha() { return false; }931 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; } 909 932 910 933 inline qrgb666() {} … … 916 939 inline quint8 alpha() const { return 0xff; } 917 940 inline qrgb666 truncedAlpha() { return *this; } 918 static inlinequint8 alpha(quint8 a) { return (a + 1) >> 2; }919 static inlinequint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; }941 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 2; } 942 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return (255 - a + 1) >> 2; } 920 943 921 944 inline qrgb666 operator+(qrgb666 v) const; … … 1074 1097 { 1075 1098 public: 1076 static inlinebool hasAlpha() { return false; }1099 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; } 1077 1100 1078 1101 inline qrgb888() {} … … 1083 1106 inline quint8 alpha() const { return 0xff; } 1084 1107 inline qrgb888 truncedAlpha() { return *this; } 1085 static inlinequint8 alpha(quint8 a) { return a; }1086 static inlinequint8 ialpha(quint8 a) { return 255 - a; }1108 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return a; } 1109 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 255 - a; } 1087 1110 1088 1111 inline qrgb888 byte_mul(quint8 a) const; … … 1263 1286 { 1264 1287 public: 1265 static inlinebool hasAlpha() { return true; }1288 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; } 1266 1289 1267 1290 inline qargb4444() {} … … 1277 1300 inline quint8 alpha() const { return ((data & 0xf000) >> 8) | ((data & 0xf000) >> 12); } 1278 1301 inline qargb4444 truncedAlpha() { return *this; } 1279 static inlinequint8 alpha(quint8 a) { return (a + 1) >> 4; }1280 static inlinequint8 ialpha(quint8 a) { return 0x10 - alpha(a); }1302 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 4; } 1303 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x10 - alpha(a); } 1281 1304 inline qargb4444 byte_mul(quint8 a) const; 1282 1305 … … 1294 1317 { 1295 1318 public: 1296 static inlinebool hasAlpha() { return false; }1319 Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; } 1297 1320 1298 1321 inline qrgb444() {} … … 1306 1329 inline quint8 alpha() const { return 0xff; } 1307 1330 inline qrgb444 truncedAlpha() { return *this; } 1308 static inlinequint8 alpha(quint8 a) { return (a + 1) >> 4; }1309 static inlinequint8 ialpha(quint8 a) { return 0x10 - alpha(a); }1331 Q_STATIC_INLINE_FUNCTION quint8 alpha(quint8 a) { return (a + 1) >> 4; } 1332 Q_STATIC_INLINE_FUNCTION quint8 ialpha(quint8 a) { return 0x10 - alpha(a); } 1310 1333 inline qrgb444 byte_mul(quint8 a) const; 1311 1334 … … 1768 1791 } while (0) 1769 1792 1793 #if defined(Q_CC_RVCT) 1794 # pragma push 1795 # pragma arm 1796 #endif 1770 1797 Q_STATIC_INLINE_FUNCTION int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } 1798 #if defined(Q_CC_RVCT) 1799 # pragma pop 1800 #endif 1771 1801 1772 1802 inline ushort qConvertRgb32To16(uint c) … … 1811 1841 1812 1842 #if 1 1813 static inlineuint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {1843 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { 1814 1844 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; 1815 1845 t >>= 8; … … 1822 1852 } 1823 1853 1824 static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { 1854 #if defined(Q_CC_RVCT) 1855 # pragma push 1856 # pragma arm 1857 #endif 1858 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { 1825 1859 uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; 1826 1860 t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8; … … 1833 1867 return x; 1834 1868 } 1869 #if defined(Q_CC_RVCT) 1870 # pragma pop 1871 #endif 1835 1872 #else 1836 1873 // possible implementation for 64 bit 1837 static inlineuint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {1874 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { 1838 1875 ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; 1839 1876 t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b; … … 1843 1880 } 1844 1881 1845 static inlineuint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {1882 Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) { 1846 1883 ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a; 1847 1884 t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b; … … 1858 1895 } 1859 1896 1860 static inlineuint PREMUL(uint x) {1897 Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) { 1861 1898 uint a = x >> 24; 1862 1899 ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
Note:
See TracChangeset
for help on using the changeset viewer.