Changeset 58


Ignore:
Timestamp:
Jan 29, 2006, 5:47:28 PM (20 years ago)
Author:
dmik
Message:

Fixed [Qt bug]: bitBlt(QImage,QImage) could produce a fully transparent result when the source didn't have the alpha channel while the destination had it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel/qimage.cpp

    r2 r58  
    61366136            }
    61376137        } else {
    6138             QRgb* d = (QRgb*)dst->scanLine(dy) + dx;
    6139             QRgb* s = (QRgb*)src->scanLine(sy) + sx;
    6140             if ( sw < 64 ) {
    6141                 // Trust ourselves
    6142                 const int dd = dst->width() - sw;
    6143                 const int ds = src->width() - sw;
    6144                 while ( sh-- ) {
    6145                     for ( int t=sw; t--; )
    6146                         *d++ = *s++;
    6147                     d += dd;
    6148                     s += ds;
    6149                 }
    6150             } else {
    6151                 // Trust libc
    6152                 const int dd = dst->width();
    6153                 const int ds = src->width();
    6154                 const int b = sw*sizeof(QRgb);
    6155                 while ( sh-- ) {
    6156                     memcpy( d, s, b );
    6157                     d += dd;
    6158                     s += ds;
    6159                 }
    6160             }
     6138            QRgb* d = (QRgb*)dst->scanLine(dy) + dx;
     6139            QRgb* s = (QRgb*)src->scanLine(sy) + sx;
     6140            if ( dst->hasAlphaBuffer() ) {
     6141                const int dd = dst->width() - sw;
     6142                const int ds = src->width() - sw;
     6143                while ( sh-- ) {
     6144                    for ( int t=sw; t--; )
     6145                        *d++ = *(s++) | ~RGB_MASK;
     6146                    d += dd;
     6147                    s += ds;
     6148                }
     6149            } else {
     6150                if ( sw < 64 ) {
     6151                    // Trust ourselves
     6152                    const int dd = dst->width() - sw;
     6153                    const int ds = src->width() - sw;
     6154                    while ( sh-- ) {
     6155                        for ( int t=sw; t--; )
     6156                            *d++ = *s++;
     6157                        d += dd;
     6158                        s += ds;
     6159                    }
     6160                } else {
     6161                    // Trust libc
     6162                    const int dd = dst->width();
     6163                    const int ds = src->width();
     6164                    const int b = sw*sizeof(QRgb);
     6165                    while ( sh-- ) {
     6166                        memcpy( d, s, b );
     6167                        d += dd;
     6168                        s += ds;
     6169                    }
     6170                }
     6171            }
    61616172        }
    61626173        break;
Note: See TracChangeset for help on using the changeset viewer.