src/gui/painting/qblendfunctions.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   221         return;
   221         return;
   222 
   222 
   223     int h = ty2 - ty1;
   223     int h = ty2 - ty1;
   224     int w = tx2 - tx1;
   224     int w = tx2 - tx1;
   225 
   225 
   226     const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1;
   226 
   227     const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1;
   227     quint32 basex;
   228 
   228     quint32 srcy;
   229     quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx;
   229 
   230     quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty;
   230     if (sx < 0) {
       
   231         int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
       
   232         basex = quint32(srcRect.right() * 65536) + dstx;
       
   233     } else {
       
   234         int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
       
   235         basex = quint32(srcRect.left() * 65536) + dstx;
       
   236     }
       
   237     if (sy < 0) {
       
   238         int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
       
   239         srcy = quint32(srcRect.bottom() * 65536) + dsty;
       
   240     } else {
       
   241         int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
       
   242         srcy = quint32(srcRect.top() * 65536) + dsty;
       
   243     }
   231 
   244 
   232     quint16 *dst = ((quint16 *) (destPixels + ty1 * dbpl)) + tx1;
   245     quint16 *dst = ((quint16 *) (destPixels + ty1 * dbpl)) + tx1;
   233 
   246 
   234     while (h--) {
   247     while (h--) {
   235         const SRC *src = (const SRC *) (srcPixels + (srcy >> 16) * sbpl);
   248         const SRC *src = (const SRC *) (srcPixels + (srcy >> 16) * sbpl);
   590         }
   603         }
   591     }
   604     }
   592 }
   605 }
   593 
   606 
   594 
   607 
   595 static void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,
   608 void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,
   596                              const uchar *srcPixels, int sbpl,
   609                              const uchar *srcPixels, int sbpl,
   597                              int w, int h,
   610                              int w, int h,
   598                              int const_alpha)
   611                              int const_alpha)
   599 {
   612 {
   600 #ifdef QT_DEBUG_DRAW
   613 #ifdef QT_DEBUG_DRAW
   721         return;
   734         return;
   722 
   735 
   723     int h = ty2 - ty1;
   736     int h = ty2 - ty1;
   724     int w = tx2 - tx1;
   737     int w = tx2 - tx1;
   725 
   738 
   726     const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1;
   739     quint32 basex;
   727     const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1;
   740     quint32 srcy;
   728 
   741 
   729     quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx;
   742     if (sx < 0) {
   730     quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty;
   743         int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
       
   744         basex = quint32(srcRect.right() * 65536) + dstx;
       
   745     } else {
       
   746         int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
       
   747         basex = quint32(srcRect.left() * 65536) + dstx;
       
   748     }
       
   749     if (sy < 0) {
       
   750         int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
       
   751         srcy = quint32(srcRect.bottom() * 65536) + dsty;
       
   752     } else {
       
   753         int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
       
   754         srcy = quint32(srcRect.top() * 65536) + dsty;
       
   755     }
   731 
   756 
   732     quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1;
   757     quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1;
   733 
   758 
   734     while (h--) {
   759     while (h--) {
   735         const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl);
   760         const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl);