Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qdrawhelper_p.h

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
     
    8888// RVCT doesn't like static template functions
    8989#  define Q_STATIC_TEMPLATE_FUNCTION
    90 #  define Q_STATIC_INLINE_FUNCTION inline
     90#  define Q_STATIC_INLINE_FUNCTION static __forceinline
    9191#else
    9292#  define Q_STATIC_TEMPLATE_FUNCTION static
     
    111111class QRasterBuffer;
    112112class QClipData;
     113class QRasterPaintEngineState;
    113114
    114115typedef QT_FT_SpanFunc ProcessSpans;
     
    145146                                 const QRect &clipRect,
    146147                                 int const_alpha);
     148
     149typedef 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);
    147156
    148157
     
    158167extern SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats];
    159168extern SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats];
     169extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats];
    160170
    161171extern DrawHelper qDrawHelper[QImage::NImageFormats];
     
    294304
    295305    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);
    297307    void setupMatrix(const QTransform &matrix, int bilinear);
    298308    void initTexture(const QImage *image, int alpha, QTextureData::Type = QTextureData::Plain, const QRect &sourceRect = QRect());
     
    301311
    302312
    303 static inline uint BYTE_MUL_RGB16(uint x, uint a) {
     313Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16(uint x, uint a) {
    304314    a += 1;
    305315    uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0;
     
    308318}
    309319
    310 static inline uint BYTE_MUL_RGB16_32(uint x, uint a) {
     320Q_STATIC_INLINE_FUNCTION uint BYTE_MUL_RGB16_32(uint x, uint a) {
    311321    uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0;
    312322    t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f;
     
    314324}
    315325
     326#if defined(Q_CC_RVCT)
     327#  pragma push
     328#  pragma arm
     329#endif
    316330Q_STATIC_INLINE_FUNCTION uint BYTE_MUL(uint x, uint a) {
    317331    uint t = (x & 0xff00ff) * a;
     
    325339    return x;
    326340}
    327 
    328 static inline uint PREMUL(uint x) {
     341#if defined(Q_CC_RVCT)
     342#  pragma pop
     343#endif
     344
     345Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
    329346    uint a = x >> 24;
    330347    uint t = (x & 0xff00ff) * a;
     
    391408    }
    392409
    393     static inline quint32p fromRawData(quint32 v)
     410    Q_STATIC_INLINE_FUNCTION quint32p fromRawData(quint32 v)
    394411    {
    395412        quint32p p;
     
    422439{
    423440public:
    424     static inline bool hasAlpha() { return true; }
     441    Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
    425442
    426443    inline qargb8565() {}
     
    439456        return *this;
    440457    }
    441     static inline quint8 alpha(quint8 a) { return (a + 1) >> 3; }
    442     static inline quint8 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); }
    443460
    444461    inline qargb8565 byte_mul(quint8 a) const;
     
    447464
    448465    inline quint32 rawValue() const;
     466    inline quint16 rawValue16() const;
    449467
    450468private:
     
    457475{
    458476public:
    459     static inline bool hasAlpha() { return false; }
     477    Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
    460478
    461479    qrgb565(int v = 0) : data(v) {}
     
    463481    inline explicit qrgb565(quint32p v);
    464482    inline explicit qrgb565(quint32 v);
    465     inline explicit qrgb565(qargb8565 v);
     483    inline explicit qrgb565(const qargb8565 &v);
    466484
    467485    inline operator quint32() const;
     
    472490    inline quint8 alpha() const { return 0xff; }
    473491    inline qrgb565 truncedAlpha() { return *this; }
    474     static inline quint8 alpha(quint8 a) { return (a + 1) >> 3; }
    475     static inline quint8 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); }
    476494
    477495    inline qrgb565 byte_mul(quint8 a) const;
     
    569587}
    570588
     589quint16 qargb8565::rawValue16() const
     590{
     591    return (data[2] << 8) | data[1];
     592}
     593
    571594qrgb565::qrgb565(quint32p v)
    572595{
     
    583606}
    584607
    585 qrgb565::qrgb565(qargb8565 v)
     608qrgb565::qrgb565(const qargb8565 &v)
    586609{
    587610    data = (v.data[2] << 8) | v.data[1];
     
    648671{
    649672public:
    650     static inline bool hasAlpha() { return true; }
     673    Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
    651674
    652675    qargb8555() {}
     
    660683    inline quint8 alpha() const { return data[0]; }
    661684    inline qargb8555 truncedAlpha() { data[0] &= 0xf8; return *this; }
    662     static inline quint8 alpha(quint8 a) { return (a + 1) >> 3; }
    663     static inline quint8 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); }
    664687
    665688    inline qargb8555 operator+(qargb8555 v) const;
     
    678701{
    679702public:
    680     static inline bool hasAlpha() { return false; }
     703    Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
    681704
    682705    inline qrgb555(int v = 0) : data(v) {}
     
    727750    inline quint8 alpha() const { return 0xff; }
    728751    inline qrgb555 truncedAlpha() { return *this; }
    729     static inline quint8 alpha(quint8 a) { return (a + 1) >> 3; }
    730     static inline quint8 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); }
    731754
    732755    inline bool operator==(const qrgb555 &v) const { return v.data == data; }
     
    876899{
    877900public:
    878     static inline bool hasAlpha() { return true; }
     901    Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
    879902
    880903    inline qargb6666() {}
     
    888911    inline quint8 alpha() const;
    889912    inline qargb6666 truncedAlpha() { return *this; }
    890     static inline quint8 alpha(quint8 a) { return (a + 1) >> 2; }
    891     static inline quint8 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; }
    892915
    893916    inline qargb6666 byte_mul(quint8 a) const;
     
    906929{
    907930public:
    908     static inline bool hasAlpha() { return false; }
     931    Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
    909932
    910933    inline qrgb666() {}
     
    916939    inline quint8 alpha() const { return 0xff; }
    917940    inline qrgb666 truncedAlpha() { return *this; }
    918     static inline quint8 alpha(quint8 a) { return (a + 1) >> 2; }
    919     static inline quint8 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; }
    920943
    921944    inline qrgb666 operator+(qrgb666 v) const;
     
    10741097{
    10751098public:
    1076     static inline bool hasAlpha() { return false; }
     1099    Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
    10771100
    10781101    inline qrgb888() {}
     
    10831106    inline quint8 alpha() const { return 0xff; }
    10841107    inline qrgb888 truncedAlpha() { return *this; }
    1085     static inline quint8 alpha(quint8 a) { return a; }
    1086     static inline quint8 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; }
    10871110
    10881111    inline qrgb888 byte_mul(quint8 a) const;
     
    12631286{
    12641287public:
    1265     static inline bool hasAlpha() { return true; }
     1288    Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return true; }
    12661289
    12671290    inline qargb4444() {}
     
    12771300    inline quint8 alpha() const { return ((data & 0xf000) >> 8) | ((data & 0xf000) >> 12); }
    12781301    inline qargb4444 truncedAlpha() { return *this; }
    1279     static inline quint8 alpha(quint8 a) { return (a + 1) >> 4; }
    1280     static inline quint8 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); }
    12811304    inline qargb4444 byte_mul(quint8 a) const;
    12821305
     
    12941317{
    12951318public:
    1296     static inline bool hasAlpha() { return false; }
     1319    Q_STATIC_INLINE_FUNCTION bool hasAlpha() { return false; }
    12971320
    12981321    inline qrgb444() {}
     
    13061329    inline quint8 alpha() const { return 0xff; }
    13071330    inline qrgb444 truncedAlpha() { return *this; }
    1308     static inline quint8 alpha(quint8 a) { return (a + 1) >> 4; }
    1309     static inline quint8 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); }
    13101333    inline qrgb444 byte_mul(quint8 a) const;
    13111334
     
    17681791} while (0)
    17691792
     1793#if defined(Q_CC_RVCT)
     1794#  pragma push
     1795#  pragma arm
     1796#endif
    17701797Q_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
    17711801
    17721802inline ushort qConvertRgb32To16(uint c)
     
    18111841
    18121842#if 1
    1813 static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
     1843Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
    18141844    uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
    18151845    t >>= 8;
     
    18221852}
    18231853
    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
     1858Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
    18251859    uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
    18261860    t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
     
    18331867    return x;
    18341868}
     1869#if defined(Q_CC_RVCT)
     1870#  pragma pop
     1871#endif
    18351872#else
    18361873// possible implementation for 64 bit
    1837 static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
     1874Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
    18381875    ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
    18391876    t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
     
    18431880}
    18441881
    1845 static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
     1882Q_STATIC_INLINE_FUNCTION uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
    18461883    ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
    18471884    t += (((ulong(y)) | ((ulong(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
     
    18581895}
    18591896
    1860 static inline uint PREMUL(uint x) {
     1897Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x) {
    18611898    uint a = x >> 24;
    18621899    ulong t = (((ulong(x)) | ((ulong(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
Note: See TracChangeset for help on using the changeset viewer.