Changeset 561 for trunk/src/gui/painting/qdrawhelper.cpp
- 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.cpp
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 ** 40 40 ****************************************************************************/ 41 41 42 #include <private/qdrawhelper_p.h> 42 43 #include <private/qpaintengine_raster_p.h> 43 44 #include <private/qpainter_p.h> 44 45 #include <private/qdrawhelper_x86_p.h> 46 #include <private/qdrawhelper_armv6_p.h> 47 #include <private/qdrawhelper_neon_p.h> 45 48 #include <private/qmath_p.h> 46 49 #include <qmath.h> 47 50 48 51 QT_BEGIN_NAMESPACE 52 49 53 50 54 #define MASK(src, a) src = BYTE_MUL(src, a) … … 158 162 } 159 163 160 #if defined(Q_CC_MSVC) && _MSC_VER <= 1300 && !defined(Q_CC_INTEL)161 template <typename EnumType, int value>162 class QEnumToType163 {164 public:165 inline EnumType operator()() const166 {167 return EnumType(value);168 }169 };170 template <QImage::Format format>171 class QImageFormatToType172 {173 public:174 inline QImage::Format operator()() const175 {176 return format;177 }178 };179 // Would have used QEnumToType instead of creating a specialized version for QImageFormatToType,180 // but that causes internal compiler error on VC6181 #define Q_TEMPLATE_IMAGEFORMAT_FIX(format) , const QImageFormatToType<format> &imageFormatType182 #define Q_TEMPLATE_IMAGEFORMAT_CALL(format) , QImageFormatToType<format>()183 #define Q_TEMPLATE_ENUM_FIX(Type, Value) , const QEnumToType<Type, Value> &enumTemplateType184 #define Q_TEMPLATE_ENUM_CALL(Type, Value) , QEnumToType<Type, Value>()185 #define Q_TEMPLATE_FIX(Type) , const QTypeInfo<Type> &templateType186 #define Q_TEMPLATE_CALL(Type) , QTypeInfo<Type>()187 #else188 #define Q_TEMPLATE_IMAGEFORMAT_FIX(format)189 #define Q_TEMPLATE_IMAGEFORMAT_CALL(format)190 #define Q_TEMPLATE_ENUM_FIX(Type, Value)191 #define Q_TEMPLATE_ENUM_CALL(Type, Value)192 #define Q_TEMPLATE_FIX(Type)193 #define Q_TEMPLATE_CALL(Type)194 #endif195 196 164 template <class DST> 197 165 Q_STATIC_TEMPLATE_FUNCTION uint * QT_FASTCALL destFetch(uint *buffer, QRasterBuffer *rasterBuffer, 198 int x, int y, int length 199 Q_TEMPLATE_FIX(DST)) 166 int x, int y, int length) 200 167 { 201 168 const DST *src = reinterpret_cast<DST*>(rasterBuffer->scanLine(y)) + x; … … 206 173 } 207 174 208 #if defined(Q_CC_MSVC) && _MSC_VER <= 1300 && !defined(Q_CC_INTEL)209 #define DEST_FETCH_DECL(DST) \210 static uint * QT_FASTCALL destFetch_##DST(uint *buffer, \211 QRasterBuffer *rasterBuffer, \212 int x, int y, int length) \213 { \214 return destFetch<DST>(buffer, rasterBuffer, x, y, length Q_TEMPLATE_CALL(DST)); \215 }216 217 DEST_FETCH_DECL(qargb8565)218 DEST_FETCH_DECL(qrgb666)219 DEST_FETCH_DECL(qargb6666)220 DEST_FETCH_DECL(qrgb555)221 DEST_FETCH_DECL(qrgb888)222 DEST_FETCH_DECL(qargb8555)223 DEST_FETCH_DECL(qrgb444)224 DEST_FETCH_DECL(qargb4444)225 #undef DEST_FETCH_DECL226 # define SPANFUNC_POINTER_DESTFETCH(Arg) destFetch_##Arg227 #else // !VC6 && !VC2002228 175 # define SPANFUNC_POINTER_DESTFETCH(Arg) destFetch<Arg> 229 #endif230 176 231 177 static const DestFetchProc destFetchProc[QImage::NImageFormats] = … … 367 313 Q_STATIC_TEMPLATE_FUNCTION void QT_FASTCALL destStore(QRasterBuffer *rasterBuffer, 368 314 int x, int y, 369 const uint *buffer, int length 370 Q_TEMPLATE_FIX(DST)) 315 const uint *buffer, int length) 371 316 { 372 317 DST *dest = reinterpret_cast<DST*>(rasterBuffer->scanLine(y)) + x; 373 const quint32 *src = reinterpret_cast<const quint32*>(buffer);318 const quint32p *src = reinterpret_cast<const quint32p*>(buffer); 374 319 while (length--) 375 320 *dest++ = DST(*src++); 376 321 } 377 322 378 #if defined(Q_CC_MSVC) && _MSC_VER <= 1300 && !defined(Q_CC_INTEL)379 # define DEST_STORE_DECL(DST) \380 static void QT_FASTCALL destStore_##DST(QRasterBuffer *rasterBuffer, \381 int x, int y, \382 const uint *buffer, int length) \383 { \384 destStore<DST>(rasterBuffer, x, y, buffer, length Q_TEMPLATE_CALL(DST)); \385 }386 387 DEST_STORE_DECL(qargb8565)388 DEST_STORE_DECL(qrgb555)389 DEST_STORE_DECL(qrgb666)390 DEST_STORE_DECL(qargb6666)391 DEST_STORE_DECL(qargb8555)392 DEST_STORE_DECL(qrgb888)393 DEST_STORE_DECL(qrgb444)394 DEST_STORE_DECL(qargb4444)395 # undef DEST_FETCH_DECL396 # define SPANFUNC_POINTER_DESTSTORE(DEST) destStore_##DEST397 #else // !VC6 && !VC2002398 323 # define SPANFUNC_POINTER_DESTSTORE(DEST) destStore<DEST> 399 #endif400 324 401 325 static const DestStoreProc destStoreProc[QImage::NImageFormats] = … … 426 350 We need 5 fetch methods per surface type: 427 351 untransformed 428 transformed 429 transformed tiled 430 transformed bilinear 431 transformed bilinear tiled 352 transformed (tiled and not tiled) 353 transformed bilinear (tiled and not tiled) 432 354 433 355 We don't need bounds checks for untransformed, but we need them for the other ones. … … 437 359 438 360 template <QImage::Format format> 439 Q_STATIC_TEMPLATE_FUNCTION uint QT_FASTCALL qt_fetchPixel(const uchar *scanLine, int x, const QVector<QRgb> *rgb 440 Q_TEMPLATE_IMAGEFORMAT_FIX(format)); 361 Q_STATIC_TEMPLATE_FUNCTION uint QT_FASTCALL qt_fetchPixel(const uchar *scanLine, int x, const QVector<QRgb> *rgb); 441 362 442 363 template<> 443 364 Q_STATIC_TEMPLATE_SPECIALIZATION 444 365 uint QT_FASTCALL qt_fetchPixel<QImage::Format_Mono>(const uchar *scanLine, 445 int x, const QVector<QRgb> *rgb 446 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_Mono)) 366 int x, const QVector<QRgb> *rgb) 447 367 { 448 368 bool pixel = scanLine[x>>3] & (0x80 >> (x & 7)); … … 454 374 Q_STATIC_TEMPLATE_SPECIALIZATION 455 375 uint QT_FASTCALL qt_fetchPixel<QImage::Format_MonoLSB>(const uchar *scanLine, 456 int x, const QVector<QRgb> *rgb 457 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_MonoLSB)) 376 int x, const QVector<QRgb> *rgb) 458 377 { 459 378 bool pixel = scanLine[x>>3] & (0x1 << (x & 7)); … … 465 384 Q_STATIC_TEMPLATE_SPECIALIZATION 466 385 uint QT_FASTCALL qt_fetchPixel<QImage::Format_Indexed8>(const uchar *scanLine, 467 int x, const QVector<QRgb> *rgb 468 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_Indexed8)) 386 int x, const QVector<QRgb> *rgb) 469 387 { 470 388 return PREMUL(rgb->at(scanLine[x])); … … 474 392 Q_STATIC_TEMPLATE_SPECIALIZATION 475 393 uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB32>(const uchar *scanLine, 476 int x, const QVector<QRgb> * 477 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_ARGB32)) 394 int x, const QVector<QRgb> *) 478 395 { 479 396 return PREMUL(((const uint *)scanLine)[x]); … … 483 400 Q_STATIC_TEMPLATE_SPECIALIZATION 484 401 uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB32_Premultiplied>(const uchar *scanLine, 485 int x, const QVector<QRgb> * 486 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_ARGB32_Premultiplied)) 402 int x, const QVector<QRgb> *) 487 403 { 488 404 return ((const uint *)scanLine)[x]; … … 492 408 Q_STATIC_TEMPLATE_SPECIALIZATION 493 409 uint QT_FASTCALL qt_fetchPixel<QImage::Format_RGB16>(const uchar *scanLine, 494 int x, const QVector<QRgb> * 495 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_RGB16)) 410 int x, const QVector<QRgb> *) 496 411 { 497 412 return qConvertRgb16To32(((const ushort *)scanLine)[x]); … … 502 417 uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB8565_Premultiplied>(const uchar *scanLine, 503 418 int x, 504 const QVector<QRgb> * 505 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_ARGB8565_Premultiplied)) 419 const QVector<QRgb> *) 506 420 { 507 421 const qargb8565 color = reinterpret_cast<const qargb8565*>(scanLine)[x]; … … 513 427 uint QT_FASTCALL qt_fetchPixel<QImage::Format_RGB666>(const uchar *scanLine, 514 428 int x, 515 const QVector<QRgb> * 516 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_RGB666)) 429 const QVector<QRgb> *) 517 430 { 518 431 const qrgb666 color = reinterpret_cast<const qrgb666*>(scanLine)[x]; … … 524 437 uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB6666_Premultiplied>(const uchar *scanLine, 525 438 int x, 526 const QVector<QRgb> * 527 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_ARGB6666_Premultiplied)) 439 const QVector<QRgb> *) 528 440 { 529 441 const qargb6666 color = reinterpret_cast<const qargb6666*>(scanLine)[x]; … … 535 447 uint QT_FASTCALL qt_fetchPixel<QImage::Format_RGB555>(const uchar *scanLine, 536 448 int x, 537 const QVector<QRgb> * 538 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_RGB555)) 449 const QVector<QRgb> *) 539 450 { 540 451 const qrgb555 color = reinterpret_cast<const qrgb555*>(scanLine)[x]; … … 546 457 uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB8555_Premultiplied>(const uchar *scanLine, 547 458 int x, 548 const QVector<QRgb> * 549 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_ARGB8555_Premultiplied)) 459 const QVector<QRgb> *) 550 460 { 551 461 const qargb8555 color = reinterpret_cast<const qargb8555*>(scanLine)[x]; … … 557 467 uint QT_FASTCALL qt_fetchPixel<QImage::Format_RGB888>(const uchar *scanLine, 558 468 int x, 559 const QVector<QRgb> * 560 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_RGB888)) 469 const QVector<QRgb> *) 561 470 { 562 471 const qrgb888 color = reinterpret_cast<const qrgb888*>(scanLine)[x]; … … 568 477 uint QT_FASTCALL qt_fetchPixel<QImage::Format_RGB444>(const uchar *scanLine, 569 478 int x, 570 const QVector<QRgb> * 571 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_RGB444)) 479 const QVector<QRgb> *) 572 480 { 573 481 const qrgb444 color = reinterpret_cast<const qrgb444*>(scanLine)[x]; … … 579 487 uint QT_FASTCALL qt_fetchPixel<QImage::Format_ARGB4444_Premultiplied>(const uchar *scanLine, 580 488 int x, 581 const QVector<QRgb> * 582 Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_ARGB4444_Premultiplied)) 489 const QVector<QRgb> *) 583 490 { 584 491 const qargb4444 color = reinterpret_cast<const qargb4444*>(scanLine)[x]; … … 586 493 } 587 494 495 template<> 496 Q_STATIC_TEMPLATE_SPECIALIZATION 497 uint QT_FASTCALL qt_fetchPixel<QImage::Format_Invalid>(const uchar *, 498 int , 499 const QVector<QRgb> *) 500 { 501 return 0; 502 } 503 588 504 typedef uint (QT_FASTCALL *FetchPixelProc)(const uchar *scanLine, int x, const QVector<QRgb> *); 589 505 590 #if defined(Q_CC_MSVC) && _MSC_VER <= 1300 && !defined(Q_CC_INTEL) 591 592 // explicit template instantiations needed to compile with VC6 and VC2002 593 594 #define SPANFUNC_INSTANTIATION_FETCHPIXEL(Arg) \ 595 static inline uint fetchPixel_##Arg(const uchar * scanLine, int x, const QVector<QRgb> * rgb) \ 596 { \ 597 return qt_fetchPixel<QImage::Arg>(scanLine, x, rgb Q_TEMPLATE_IMAGEFORMAT_CALL(QImage::Arg)); \ 598 } 599 600 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_Mono); 601 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_MonoLSB); 602 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_Indexed8); 603 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_ARGB32_Premultiplied); 604 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_ARGB32); 605 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_RGB16); 606 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_ARGB8565_Premultiplied); 607 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_RGB666); 608 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_ARGB6666_Premultiplied); 609 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_RGB555); 610 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_ARGB8555_Premultiplied); 611 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_RGB888); 612 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_RGB444); 613 SPANFUNC_INSTANTIATION_FETCHPIXEL(Format_ARGB4444_Premultiplied); 614 615 #undef SPANFUNC_INSTANTIATION_FETCHPIXEL 616 617 #define SPANFUNC_POINTER_FETCHPIXEL(Arg) fetchPixel_##Arg 618 619 #else // !VC6 && !VC2002 620 # define SPANFUNC_POINTER_FETCHPIXEL(Arg) qt_fetchPixel<QImage::Arg> 621 #endif 506 #define SPANFUNC_POINTER_FETCHPIXEL(Arg) qt_fetchPixel<QImage::Arg> 622 507 623 508 … … 654 539 template <QImage::Format format> 655 540 Q_STATIC_TEMPLATE_FUNCTION const uint * QT_FASTCALL qt_fetchUntransformed(uint *buffer, const Operator *, const QSpanData *data, 656 int y, int x, int length Q_TEMPLATE_IMAGEFORMAT_FIX(format))541 int y, int x, int length) 657 542 { 658 543 const uchar *scanLine = data->texture.scanLine(y); 659 544 for (int i = 0; i < length; ++i) 660 buffer[i] = qt_fetchPixel<format>(scanLine, x + i, data->texture.colorTable Q_TEMPLATE_IMAGEFORMAT_CALL(format));545 buffer[i] = qt_fetchPixel<format>(scanLine, x + i, data->texture.colorTable); 661 546 return buffer; 662 547 } … … 666 551 qt_fetchUntransformed<QImage::Format_ARGB32_Premultiplied>(uint *, const Operator *, 667 552 const QSpanData *data, 668 int y, int x, int Q_TEMPLATE_IMAGEFORMAT_FIX(QImage::Format_ARGB32_Premultiplied))553 int y, int x, int) 669 554 { 670 555 const uchar *scanLine = data->texture.scanLine(y); … … 672 557 } 673 558 674 static const uint * QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data, 559 template<TextureBlendType blendType> /* either BlendTransformed or BlendTransformedTiled */ 560 Q_STATIC_TEMPLATE_FUNCTION 561 const uint * QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const QSpanData *data, 675 562 int y, int x, int length) 676 563 { … … 699 586 int py = fy >> 16; 700 587 701 bool out = (px < 0) || (px >= image_width) 702 || (py < 0) || (py >= image_height); 703 704 const uchar *scanLine = data->texture.scanLine(py); 705 *b = out ? uint(0) : fetch(scanLine, px, data->texture.colorTable); 588 if (blendType == BlendTransformedTiled) { 589 px %= image_width; 590 py %= image_height; 591 if (px < 0) px += image_width; 592 if (py < 0) py += image_height; 593 594 const uchar *scanLine = data->texture.scanLine(py); 595 *b = fetch(scanLine, px, data->texture.colorTable); 596 } else { 597 if ((px < 0) || (px >= image_width) 598 || (py < 0) || (py >= image_height)) { 599 *b = uint(0); 600 } else { 601 const uchar *scanLine = data->texture.scanLine(py); 602 *b = fetch(scanLine, px, data->texture.colorTable); 603 } 604 } 706 605 fx += fdx; 707 606 fy += fdy; … … 721 620 const qreal tx = fx * iw; 722 621 const qreal ty = fy * iw; 723 const int px = int(tx) - (tx < 0); 724 const int py = int(ty) - (ty < 0); 725 726 bool out = (px < 0) || (px >= image_width) 727 || (py < 0) || (py >= image_height); 728 729 const uchar *scanLine = data->texture.scanLine(py); 730 *b = out ? uint(0) : fetch(scanLine, px, data->texture.colorTable); 622 int px = int(tx) - (tx < 0); 623 int py = int(ty) - (ty < 0); 624 625 if (blendType == BlendTransformedTiled) { 626 px %= image_width; 627 py %= image_height; 628 if (px < 0) px += image_width; 629 if (py < 0) py += image_height; 630 631 const uchar *scanLine = data->texture.scanLine(py); 632 *b = fetch(scanLine, px, data->texture.colorTable); 633 } else { 634 if ((px < 0) || (px >= image_width) 635 || (py < 0) || (py >= image_height)) { 636 *b = uint(0); 637 } else { 638 const uchar *scanLine = data->texture.scanLine(py); 639 *b = fetch(scanLine, px, data->texture.colorTable); 640 } 641 } 731 642 fx += fdx; 732 643 fy += fdy; … … 743 654 } 744 655 745 static const uint * QT_FASTCALL fetchTransformedTiled(uint *buffer, const Operator *, const QSpanData *data, 746 int y, int x, int length) 747 { 748 FetchPixelProc fetch = fetchPixelProc[data->texture.format]; 656 template<TextureBlendType blendType, QImage::Format format> /* blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled */ 657 Q_STATIC_TEMPLATE_FUNCTION 658 const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *, const QSpanData *data, 659 int y, int x, int length) 660 { 661 #ifdef Q_CC_RVCT // needed to avoid compiler crash in RVCT 2.2 662 FetchPixelProc fetch; 663 if (format != QImage::Format_Invalid) 664 fetch = qt_fetchPixel<format>; 665 else 666 fetch = fetchPixelProc[data->texture.format]; 667 #else 668 FetchPixelProc fetch = (format != QImage::Format_Invalid) ? FetchPixelProc(qt_fetchPixel<format>) : fetchPixelProc[data->texture.format]; 669 #endif 749 670 750 671 int image_width = data->texture.width; … … 766 687 + data->m12 * cx + data->dy) * fixed_scale); 767 688 689 fx -= half_point; 690 fy -= half_point; 768 691 while (b < end) { 769 int px = fx >> 16; 770 int py = fy >> 16; 771 772 px %= image_width; 773 py %= image_height; 774 if (px < 0) px += image_width; 775 if (py < 0) py += image_height; 776 777 const uchar *scanLine = data->texture.scanLine(py); 778 *b = fetch(scanLine, px, data->texture.colorTable); 692 int x1 = (fx >> 16); 693 int x2 = x1 + 1; 694 int y1 = (fy >> 16); 695 int y2 = y1 + 1; 696 697 int distx = ((fx - (x1 << 16)) >> 8); 698 int disty = ((fy - (y1 << 16)) >> 8); 699 int idistx = 256 - distx; 700 int idisty = 256 - disty; 701 702 if (blendType == BlendTransformedBilinearTiled) { 703 x1 %= image_width; 704 x2 %= image_width; 705 y1 %= image_height; 706 y2 %= image_height; 707 708 if (x1 < 0) x1 += image_width; 709 if (x2 < 0) x2 += image_width; 710 if (y1 < 0) y1 += image_height; 711 if (y2 < 0) y2 += image_height; 712 713 Q_ASSERT(x1 >= 0 && x1 < image_width); 714 Q_ASSERT(x2 >= 0 && x2 < image_width); 715 Q_ASSERT(y1 >= 0 && y1 < image_height); 716 Q_ASSERT(y2 >= 0 && y2 < image_height); 717 } else { 718 x1 = qBound(0, x1, image_width - 1); 719 x2 = qBound(0, x2, image_width - 1); 720 y1 = qBound(0, y1, image_height - 1); 721 y2 = qBound(0, y2, image_height - 1); 722 } 723 724 const uchar *s1 = data->texture.scanLine(y1); 725 const uchar *s2 = data->texture.scanLine(y2); 726 727 uint tl = fetch(s1, x1, data->texture.colorTable); 728 uint tr = fetch(s1, x2, data->texture.colorTable); 729 uint bl = fetch(s2, x1, data->texture.colorTable); 730 uint br = fetch(s2, x2, data->texture.colorTable); 731 732 uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); 733 uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); 734 *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); 735 779 736 fx += fdx; 780 737 fy += fdy; … … 792 749 while (b < end) { 793 750 const qreal iw = fw == 0 ? 1 : 1 / fw; 794 const qreal tx = fx * iw; 795 const qreal ty = fy * iw; 796 int px = int(tx) - (tx < 0); 797 int py = int(ty) - (ty < 0); 798 799 px %= image_width; 800 py %= image_height; 801 if (px < 0) px += image_width; 802 if (py < 0) py += image_height; 803 804 const uchar *scanLine = data->texture.scanLine(py); 805 *b = fetch(scanLine, px, data->texture.colorTable); 751 const qreal px = fx * iw - 0.5; 752 const qreal py = fy * iw - 0.5; 753 754 int x1 = int(px) - (px < 0); 755 int x2 = x1 + 1; 756 int y1 = int(py) - (py < 0); 757 int y2 = y1 + 1; 758 759 int distx = int((px - x1) * 256); 760 int disty = int((py - y1) * 256); 761 int idistx = 256 - distx; 762 int idisty = 256 - disty; 763 764 if (blendType == BlendTransformedBilinearTiled) { 765 x1 %= image_width; 766 x2 %= image_width; 767 y1 %= image_height; 768 y2 %= image_height; 769 770 if (x1 < 0) x1 += image_width; 771 if (x2 < 0) x2 += image_width; 772 if (y1 < 0) y1 += image_height; 773 if (y2 < 0) y2 += image_height; 774 775 Q_ASSERT(x1 >= 0 && x1 < image_width); 776 Q_ASSERT(x2 >= 0 && x2 < image_width); 777 Q_ASSERT(y1 >= 0 && y1 < image_height); 778 Q_ASSERT(y2 >= 0 && y2 < image_height); 779 } else { 780 x1 = qBound(0, x1, image_width - 1); 781 x2 = qBound(0, x2, image_width - 1); 782 y1 = qBound(0, y1, image_height - 1); 783 y2 = qBound(0, y2, image_height - 1); 784 } 785 786 const uchar *s1 = data->texture.scanLine(y1); 787 const uchar *s2 = data->texture.scanLine(y2); 788 789 uint tl = fetch(s1, x1, data->texture.colorTable); 790 uint tr = fetch(s1, x2, data->texture.colorTable); 791 uint bl = fetch(s2, x1, data->texture.colorTable); 792 uint br = fetch(s2, x2, data->texture.colorTable); 793 794 uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); 795 uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); 796 *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); 797 806 798 fx += fdx; 807 799 fy += fdy; … … 818 810 } 819 811 820 static const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *, const QSpanData *data, 821 int y, int x, int length) 822 { 823 FetchPixelProc fetch = fetchPixelProc[data->texture.format]; 824 825 int image_width = data->texture.width; 826 int image_height = data->texture.height; 827 828 const qreal cx = x + 0.5; 829 const qreal cy = y + 0.5; 830 831 const uint *end = buffer + length; 832 uint *b = buffer; 833 if (data->fast_matrix) { 834 // The increment pr x in the scanline 835 int fdx = (int)(data->m11 * fixed_scale); 836 int fdy = (int)(data->m12 * fixed_scale); 837 838 int fx = int((data->m21 * cy 839 + data->m11 * cx + data->dx) * fixed_scale); 840 int fy = int((data->m22 * cy 841 + data->m12 * cx + data->dy) * fixed_scale); 842 843 fx -= half_point; 844 fy -= half_point; 845 while (b < end) { 846 int x1 = (fx >> 16); 847 int x2 = x1 + 1; 848 int y1 = (fy >> 16); 849 int y2 = y1 + 1; 850 851 int distx = ((fx - (x1 << 16)) >> 8); 852 int disty = ((fy - (y1 << 16)) >> 8); 853 int idistx = 256 - distx; 854 int idisty = 256 - disty; 855 856 x1 = qBound(0, x1, image_width - 1); 857 x2 = qBound(0, x2, image_width - 1); 858 y1 = qBound(0, y1, image_height - 1); 859 y2 = qBound(0, y2, image_height - 1); 860 861 const uchar *s1 = data->texture.scanLine(y1); 862 const uchar *s2 = data->texture.scanLine(y2); 863 864 uint tl = fetch(s1, x1, data->texture.colorTable); 865 uint tr = fetch(s1, x2, data->texture.colorTable); 866 uint bl = fetch(s2, x1, data->texture.colorTable); 867 uint br = fetch(s2, x2, data->texture.colorTable); 868 869 uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); 870 uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); 871 *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); 872 873 fx += fdx; 874 fy += fdy; 875 ++b; 876 } 877 } else { 878 const qreal fdx = data->m11; 879 const qreal fdy = data->m12; 880 const qreal fdw = data->m13; 881 882 qreal fx = data->m21 * cy + data->m11 * cx + data->dx; 883 qreal fy = data->m22 * cy + data->m12 * cx + data->dy; 884 qreal fw = data->m23 * cy + data->m13 * cx + data->m33; 885 886 while (b < end) { 887 const qreal iw = fw == 0 ? 1 : 1 / fw; 888 const qreal px = fx * iw - 0.5; 889 const qreal py = fy * iw - 0.5; 890 891 int x1 = int(px) - (px < 0); 892 int x2 = x1 + 1; 893 int y1 = int(py) - (py < 0); 894 int y2 = y1 + 1; 895 896 int distx = int((px - x1) * 256); 897 int disty = int((py - y1) * 256); 898 int idistx = 256 - distx; 899 int idisty = 256 - disty; 900 901 x1 = qBound(0, x1, image_width - 1); 902 x2 = qBound(0, x2, image_width - 1); 903 y1 = qBound(0, y1, image_height - 1); 904 y2 = qBound(0, y2, image_height - 1); 905 906 const uchar *s1 = data->texture.scanLine(y1); 907 const uchar *s2 = data->texture.scanLine(y2); 908 909 uint tl = fetch(s1, x1, data->texture.colorTable); 910 uint tr = fetch(s1, x2, data->texture.colorTable); 911 uint bl = fetch(s2, x1, data->texture.colorTable); 912 uint br = fetch(s2, x2, data->texture.colorTable); 913 914 uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); 915 uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); 916 *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); 917 918 fx += fdx; 919 fy += fdy; 920 fw += fdw; 921 //force increment to avoid /0 922 if (!fw) { 923 fw += fdw; 924 } 925 ++b; 926 } 927 } 928 929 return buffer; 930 } 931 932 static const uint * QT_FASTCALL fetchTransformedBilinearTiled(uint *buffer, const Operator *, const QSpanData *data, 933 int y, int x, int length) 934 { 935 FetchPixelProc fetch = fetchPixelProc[data->texture.format]; 936 937 int image_width = data->texture.width; 938 int image_height = data->texture.height; 939 940 const qreal cx = x + 0.5; 941 const qreal cy = y + 0.5; 942 943 const uint *end = buffer + length; 944 uint *b = buffer; 945 if (data->fast_matrix) { 946 // The increment pr x in the scanline 947 int fdx = (int)(data->m11 * fixed_scale); 948 int fdy = (int)(data->m12 * fixed_scale); 949 950 int fx = int((data->m21 * cy + data->m11 * cx + data->dx) * fixed_scale); 951 int fy = int((data->m22 * cy + data->m12 * cx + data->dy) * fixed_scale); 952 953 fx -= half_point; 954 fy -= half_point; 955 while (b < end) { 956 int x1 = (fx >> 16); 957 int x2 = x1 + 1; 958 int y1 = (fy >> 16); 959 int y2 = y1 + 1; 960 961 int distx = ((fx - (x1 << 16)) >> 8); 962 int disty = ((fy - (y1 << 16)) >> 8); 963 int idistx = 256 - distx; 964 int idisty = 256 - disty; 965 966 x1 %= image_width; 967 x2 %= image_width; 968 y1 %= image_height; 969 y2 %= image_height; 970 971 if (x1 < 0) x1 += image_width; 972 if (x2 < 0) x2 += image_width; 973 if (y1 < 0) y1 += image_height; 974 if (y2 < 0) y2 += image_height; 975 976 Q_ASSERT(x1 >= 0 && x1 < image_width); 977 Q_ASSERT(x2 >= 0 && x2 < image_width); 978 Q_ASSERT(y1 >= 0 && y1 < image_height); 979 Q_ASSERT(y2 >= 0 && y2 < image_height); 980 981 const uchar *s1 = data->texture.scanLine(y1); 982 const uchar *s2 = data->texture.scanLine(y2); 983 984 uint tl = fetch(s1, x1, data->texture.colorTable); 985 uint tr = fetch(s1, x2, data->texture.colorTable); 986 uint bl = fetch(s2, x1, data->texture.colorTable); 987 uint br = fetch(s2, x2, data->texture.colorTable); 988 989 uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); 990 uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); 991 *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); 992 993 fx += fdx; 994 fy += fdy; 995 ++b; 996 } 997 } else { 998 const qreal fdx = data->m11; 999 const qreal fdy = data->m12; 1000 const qreal fdw = data->m13; 1001 1002 qreal fx = data->m21 * cy + data->m11 * cx + data->dx; 1003 qreal fy = data->m22 * cy + data->m12 * cx + data->dy; 1004 qreal fw = data->m23 * cy + data->m13 * cx + data->m33; 1005 1006 while (b < end) { 1007 const qreal iw = fw == 0 ? 1 : 1 / fw; 1008 const qreal px = fx * iw - 0.5; 1009 const qreal py = fy * iw - 0.5; 1010 1011 int x1 = int(px) - (px < 0); 1012 int x2 = x1 + 1; 1013 int y1 = int(py) - (py < 0); 1014 int y2 = y1 + 1; 1015 1016 int distx = int((px - x1) * 256); 1017 int disty = int((py - y1) * 256); 1018 int idistx = 256 - distx; 1019 int idisty = 256 - disty; 1020 1021 x1 %= image_width; 1022 x2 %= image_width; 1023 y1 %= image_height; 1024 y2 %= image_height; 1025 1026 if (x1 < 0) x1 += image_width; 1027 if (x2 < 0) x2 += image_width; 1028 if (y1 < 0) y1 += image_height; 1029 if (y2 < 0) y2 += image_height; 1030 1031 Q_ASSERT(x1 >= 0 && x1 < image_width); 1032 Q_ASSERT(x2 >= 0 && x2 < image_width); 1033 Q_ASSERT(y1 >= 0 && y1 < image_height); 1034 Q_ASSERT(y2 >= 0 && y2 < image_height); 1035 1036 const uchar *s1 = data->texture.scanLine(y1); 1037 const uchar *s2 = data->texture.scanLine(y2); 1038 1039 uint tl = fetch(s1, x1, data->texture.colorTable); 1040 uint tr = fetch(s1, x2, data->texture.colorTable); 1041 uint bl = fetch(s2, x1, data->texture.colorTable); 1042 uint br = fetch(s2, x2, data->texture.colorTable); 1043 1044 uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); 1045 uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); 1046 *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); 1047 1048 fx += fdx; 1049 fy += fdy; 1050 fw += fdw; 1051 //force increment to avoid /0 1052 if (!fw) { 1053 fw += fdw; 1054 } 1055 ++b; 1056 } 1057 } 1058 1059 return buffer; 1060 } 1061 1062 #if defined(Q_CC_MSVC) && _MSC_VER <= 1300 && !defined(Q_CC_INTEL) 1063 1064 // explicit template instantiations needed to compile with VC6 and VC2002 1065 1066 #define SPANFUNC_POINTER_FETCHUNTRANSFORMED(Arg) \ 1067 const uint *qt_fetchUntransformed_##Arg(uint *buffer, const Operator *op, const QSpanData *data, \ 1068 int y, int x, int length) \ 1069 { \ 1070 return qt_fetchUntransformed<QImage::Arg>(buffer, op, data, y, x, length Q_TEMPLATE_IMAGEFORMAT_CALL(QImage::Arg)); \ 1071 } 1072 1073 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_Mono); 1074 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_MonoLSB); 1075 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_Indexed8); 1076 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_ARGB32_Premultiplied); 1077 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_ARGB32); 1078 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_RGB16); 1079 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_ARGB8565_Premultiplied); 1080 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_RGB666); 1081 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_ARGB6666_Premultiplied); 1082 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_RGB555); 1083 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_ARGB8555_Premultiplied); 1084 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_RGB888); 1085 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_RGB444); 1086 SPANFUNC_POINTER_FETCHUNTRANSFORMED(Format_ARGB4444_Premultiplied); 1087 1088 #undef SPANFUNC_POINTER_FETCHUNTRANSFORMED 1089 1090 #define SPANFUNC_POINTER_FETCHHUNTRANSFORMED(Arg) qt_fetchUntransformed_##Arg 1091 1092 #else // !VC6 && !VC2002 1093 # define SPANFUNC_POINTER_FETCHHUNTRANSFORMED(Arg) qt_fetchUntransformed<QImage::Arg> 1094 #endif 812 #define SPANFUNC_POINTER_FETCHHUNTRANSFORMED(Arg) qt_fetchUntransformed<QImage::Arg> 1095 813 1096 814 static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { … … 1136 854 { 1137 855 0, // Invalid 1138 fetchTransformed , // Mono1139 fetchTransformed , // MonoLsb1140 fetchTransformed , // Indexed81141 fetchTransformed , // RGB321142 fetchTransformed , // ARGB321143 fetchTransformed , // ARGB32_Premultiplied1144 fetchTransformed , // RGB161145 fetchTransformed , // ARGB8565_Premultiplied1146 fetchTransformed , // RGB6661147 fetchTransformed , // ARGB6666_Premultiplied1148 fetchTransformed , // RGB5551149 fetchTransformed , // ARGB8555_Premultiplied1150 fetchTransformed , // RGB8881151 fetchTransformed , // RGB4441152 fetchTransformed , // ARGB4444_Premultiplied856 fetchTransformed<BlendTransformed>, // Mono 857 fetchTransformed<BlendTransformed>, // MonoLsb 858 fetchTransformed<BlendTransformed>, // Indexed8 859 fetchTransformed<BlendTransformed>, // RGB32 860 fetchTransformed<BlendTransformed>, // ARGB32 861 fetchTransformed<BlendTransformed>, // ARGB32_Premultiplied 862 fetchTransformed<BlendTransformed>, // RGB16 863 fetchTransformed<BlendTransformed>, // ARGB8565_Premultiplied 864 fetchTransformed<BlendTransformed>, // RGB666 865 fetchTransformed<BlendTransformed>, // ARGB6666_Premultiplied 866 fetchTransformed<BlendTransformed>, // RGB555 867 fetchTransformed<BlendTransformed>, // ARGB8555_Premultiplied 868 fetchTransformed<BlendTransformed>, // RGB888 869 fetchTransformed<BlendTransformed>, // RGB444 870 fetchTransformed<BlendTransformed>, // ARGB4444_Premultiplied 1153 871 }, 1154 872 { 1155 873 0, // TransformedTiled 1156 fetchTransformed Tiled, // Mono1157 fetchTransformed Tiled, // MonoLsb1158 fetchTransformed Tiled, // Indexed81159 fetchTransformed Tiled, // RGB321160 fetchTransformed Tiled, // ARGB321161 fetchTransformed Tiled, // ARGB32_Premultiplied1162 fetchTransformed Tiled, // RGB161163 fetchTransformed Tiled, // ARGB8565_Premultiplied1164 fetchTransformed Tiled, // RGB6661165 fetchTransformed Tiled, // ARGB6666_Premultiplied1166 fetchTransformed Tiled, // RGB5551167 fetchTransformed Tiled, // ARGB8555_Premultiplied1168 fetchTransformed Tiled, // RGB8881169 fetchTransformed Tiled, // RGB4441170 fetchTransformed Tiled, // ARGB4444_Premultiplied874 fetchTransformed<BlendTransformedTiled>, // Mono 875 fetchTransformed<BlendTransformedTiled>, // MonoLsb 876 fetchTransformed<BlendTransformedTiled>, // Indexed8 877 fetchTransformed<BlendTransformedTiled>, // RGB32 878 fetchTransformed<BlendTransformedTiled>, // ARGB32 879 fetchTransformed<BlendTransformedTiled>, // ARGB32_Premultiplied 880 fetchTransformed<BlendTransformedTiled>, // RGB16 881 fetchTransformed<BlendTransformedTiled>, // ARGB8565_Premultiplied 882 fetchTransformed<BlendTransformedTiled>, // RGB666 883 fetchTransformed<BlendTransformedTiled>, // ARGB6666_Premultiplied 884 fetchTransformed<BlendTransformedTiled>, // RGB555 885 fetchTransformed<BlendTransformedTiled>, // ARGB8555_Premultiplied 886 fetchTransformed<BlendTransformedTiled>, // RGB888 887 fetchTransformed<BlendTransformedTiled>, // RGB444 888 fetchTransformed<BlendTransformedTiled>, // ARGB4444_Premultiplied 1171 889 }, 1172 890 { 1173 891 0, // Bilinear 1174 fetchTransformedBilinear , // Mono1175 fetchTransformedBilinear , // MonoLsb1176 fetchTransformedBilinear , // Indexed81177 fetchTransformedBilinear , // RGB321178 fetchTransformedBilinear , // ARGB321179 fetchTransformedBilinear , // ARGB32_Premultiplied1180 fetchTransformedBilinear , // RGB161181 fetchTransformedBilinear , // ARGB8565_Premultiplied1182 fetchTransformedBilinear , // RGB6661183 fetchTransformedBilinear , // ARGB6666_Premultiplied1184 fetchTransformedBilinear , // RGB5551185 fetchTransformedBilinear , // ARGB8555_Premultiplied1186 fetchTransformedBilinear , // RGB8881187 fetchTransformedBilinear , // RGB4441188 fetchTransformedBilinear // ARGB4444_Premultiplied892 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // Mono 893 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // MonoLsb 894 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // Indexed8 895 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_ARGB32_Premultiplied>, // RGB32 896 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_ARGB32>, // ARGB32 897 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_ARGB32_Premultiplied>, // ARGB32_Premultiplied 898 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB16 899 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // ARGB8565_Premultiplied 900 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB666 901 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // ARGB6666_Premultiplied 902 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB555 903 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // ARGB8555_Premultiplied 904 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB888 905 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid>, // RGB444 906 fetchTransformedBilinear<BlendTransformedBilinear, QImage::Format_Invalid> // ARGB4444_Premultiplied 1189 907 }, 1190 908 { 1191 909 0, // BilinearTiled 1192 fetchTransformedBilinear Tiled, // Mono1193 fetchTransformedBilinear Tiled, // MonoLsb1194 fetchTransformedBilinear Tiled, // Indexed81195 fetchTransformedBilinear Tiled, // RGB321196 fetchTransformedBilinear Tiled, // ARGB321197 fetchTransformedBilinear Tiled, // ARGB32_Premultiplied1198 fetchTransformedBilinear Tiled, // RGB161199 fetchTransformedBilinear Tiled, // ARGB8565_Premultiplied1200 fetchTransformedBilinear Tiled, // RGB6661201 fetchTransformedBilinear Tiled, // ARGB6666_Premultiplied1202 fetchTransformedBilinear Tiled, // RGB5551203 fetchTransformedBilinear Tiled, // ARGB8555_Premultiplied1204 fetchTransformedBilinear Tiled, // RGB8881205 fetchTransformedBilinear Tiled, // RGB4441206 fetchTransformedBilinear Tiled// ARGB4444_Premultiplied910 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // Mono 911 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // MonoLsb 912 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // Indexed8 913 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_ARGB32_Premultiplied>, // RGB32 914 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_ARGB32>, // ARGB32 915 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_ARGB32_Premultiplied>, // ARGB32_Premultiplied 916 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB16 917 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // ARGB8565_Premultiplied 918 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB666 919 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // ARGB6666_Premultiplied 920 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB555 921 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // ARGB8555_Premultiplied 922 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB888 923 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid>, // RGB444 924 fetchTransformedBilinear<BlendTransformedBilinearTiled, QImage::Format_Invalid> // ARGB4444_Premultiplied 1207 925 }, 1208 926 }; … … 1466 1184 ry -= data->gradient.conical.center.y; 1467 1185 while (buffer < end) { 1468 qreal angle = atan2(ry, rx) + data->gradient.conical.angle;1186 qreal angle = qAtan2(ry, rx) + data->gradient.conical.angle; 1469 1187 1470 1188 *buffer = qt_gradient_pixel(&data->gradient, 1 - angle / (2*Q_PI)); … … 1480 1198 rw = 1; 1481 1199 while (buffer < end) { 1482 qreal angle = atan2(ry/rw - data->gradient.conical.center.x,1200 qreal angle = qAtan2(ry/rw - data->gradient.conical.center.x, 1483 1201 rx/rw - data->gradient.conical.center.y) 1484 1202 + data->gradient.conical.angle; … … 1498 1216 } 1499 1217 1500 1218 #if defined(Q_CC_RVCT) 1219 // Force ARM code generation for comp_func_* -methods 1220 # pragma push 1221 # pragma arm 1222 # if defined(QT_HAVE_ARMV6) 1223 static __forceinline void preload(const uint *start) 1224 { 1225 asm( "pld [start]" ); 1226 } 1227 static const uint L2CacheLineLength = 32; 1228 static const uint L2CacheLineLengthInInts = L2CacheLineLength/sizeof(uint); 1229 # define PRELOAD_INIT(x) preload(x); 1230 # define PRELOAD_INIT2(x,y) PRELOAD_INIT(x) PRELOAD_INIT(y) 1231 # define PRELOAD_COND(x) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts); 1232 // Two consecutive preloads stall, so space them out a bit by using different modulus. 1233 # define PRELOAD_COND2(x,y) if (((uint)&x[i])%L2CacheLineLength == 0) preload(&x[i] + L2CacheLineLengthInInts); \ 1234 if (((uint)&y[i])%L2CacheLineLength == 16) preload(&y[i] + L2CacheLineLengthInInts); 1235 # endif // QT_HAVE_ARMV6 1236 #endif // Q_CC_RVCT 1237 1238 #if !defined(Q_CC_RVCT) || !defined(QT_HAVE_ARMV6) 1239 # define PRELOAD_INIT(x) 1240 # define PRELOAD_INIT2(x,y) 1241 # define PRELOAD_COND(x) 1242 # define PRELOAD_COND2(x,y) 1243 #endif 1501 1244 1502 1245 /* The constant alpha factor describes an alpha factor that gets applied … … 1531 1274 } else { 1532 1275 int ialpha = 255 - const_alpha; 1533 for (int i = 0; i < length; ++i) 1276 PRELOAD_INIT(dest) 1277 for (int i = 0; i < length; ++i) { 1278 PRELOAD_COND(dest) 1534 1279 dest[i] = BYTE_MUL(dest[i], ialpha); 1280 } 1535 1281 } 1536 1282 } … … 1542 1288 } else { 1543 1289 int ialpha = 255 - const_alpha; 1544 for (int i = 0; i < length; ++i) 1290 PRELOAD_INIT(dest) 1291 for (int i = 0; i < length; ++i) { 1292 PRELOAD_COND(dest) 1545 1293 dest[i] = BYTE_MUL(dest[i], ialpha); 1294 } 1546 1295 } 1547 1296 } … … 1558 1307 int ialpha = 255 - const_alpha; 1559 1308 color = BYTE_MUL(color, const_alpha); 1560 for (int i = 0; i < length; ++i) 1309 PRELOAD_INIT(dest) 1310 for (int i = 0; i < length; ++i) { 1311 PRELOAD_COND(dest) 1561 1312 dest[i] = color + BYTE_MUL(dest[i], ialpha); 1313 } 1562 1314 } 1563 1315 } … … 1569 1321 } else { 1570 1322 int ialpha = 255 - const_alpha; 1571 for (int i = 0; i < length; ++i) 1323 PRELOAD_INIT2(dest, src) 1324 for (int i = 0; i < length; ++i) { 1325 PRELOAD_COND2(dest, src) 1572 1326 dest[i] = INTERPOLATE_PIXEL_255(src[i], const_alpha, dest[i], ialpha); 1327 } 1573 1328 } 1574 1329 } … … 1595 1350 if (const_alpha != 255) 1596 1351 color = BYTE_MUL(color, const_alpha); 1597 for (int i = 0; i < length; ++i) 1352 PRELOAD_INIT(dest) 1353 for (int i = 0; i < length; ++i) { 1354 PRELOAD_COND(dest) 1598 1355 dest[i] = color + BYTE_MUL(dest[i], qAlpha(~color)); 1356 } 1599 1357 } 1600 1358 } … … 1602 1360 static void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha) 1603 1361 { 1362 PRELOAD_INIT2(dest, src) 1604 1363 if (const_alpha == 255) { 1605 1364 for (int i = 0; i < length; ++i) { 1365 PRELOAD_COND2(dest, src) 1606 1366 uint s = src[i]; 1607 1367 dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s)); … … 1609 1369 } else { 1610 1370 for (int i = 0; i < length; ++i) { 1371 PRELOAD_COND2(dest, src) 1611 1372 uint s = BYTE_MUL(src[i], const_alpha); 1612 1373 dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s)); … … 1624 1385 if (const_alpha != 255) 1625 1386 color = BYTE_MUL(color, const_alpha); 1387 PRELOAD_INIT(dest) 1626 1388 for (int i = 0; i < length; ++i) { 1389 PRELOAD_COND(dest) 1627 1390 uint d = dest[i]; 1628 1391 dest[i] = d + BYTE_MUL(color, qAlpha(~d)); … … 1632 1395 static void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha) 1633 1396 { 1397 PRELOAD_INIT2(dest, src) 1634 1398 if (const_alpha == 255) { 1635 1399 for (int i = 0; i < length; ++i) { 1400 PRELOAD_COND2(dest, src) 1636 1401 uint d = dest[i]; 1637 1402 dest[i] = d + BYTE_MUL(src[i], qAlpha(~d)); … … 1639 1404 } else { 1640 1405 for (int i = 0; i < length; ++i) { 1406 PRELOAD_COND2(dest, src) 1641 1407 uint d = dest[i]; 1642 1408 uint s = BYTE_MUL(src[i], const_alpha); … … 1652 1418 static void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha) 1653 1419 { 1420 PRELOAD_INIT(dest) 1654 1421 if (const_alpha == 255) { 1655 for (int i = 0; i < length; ++i) 1422 for (int i = 0; i < length; ++i) { 1423 PRELOAD_COND(dest) 1656 1424 dest[i] = BYTE_MUL(color, qAlpha(dest[i])); 1425 } 1657 1426 } else { 1658 1427 color = BYTE_MUL(color, const_alpha); 1659 1428 uint cia = 255 - const_alpha; 1660 1429 for (int i = 0; i < length; ++i) { 1430 PRELOAD_COND(dest) 1661 1431 uint d = dest[i]; 1662 1432 dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(d), d, cia); … … 1667 1437 static void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uint const_alpha) 1668 1438 { 1439 PRELOAD_INIT2(dest, src) 1669 1440 if (const_alpha == 255) { 1670 for (int i = 0; i < length; ++i) 1441 for (int i = 0; i < length; ++i) { 1442 PRELOAD_COND2(dest, src) 1671 1443 dest[i] = BYTE_MUL(src[i], qAlpha(dest[i])); 1444 } 1672 1445 } else { 1673 1446 uint cia = 255 - const_alpha; 1674 1447 for (int i = 0; i < length; ++i) { 1448 PRELOAD_COND2(dest, src) 1675 1449 uint d = dest[i]; 1676 1450 uint s = BYTE_MUL(src[i], const_alpha); … … 1691 1465 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha; 1692 1466 } 1467 PRELOAD_INIT(dest) 1693 1468 for (int i = 0; i < length; ++i) { 1469 PRELOAD_COND(dest) 1694 1470 dest[i] = BYTE_MUL(dest[i], a); 1695 1471 } … … 1698 1474 static void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length, uint const_alpha) 1699 1475 { 1476 PRELOAD_INIT2(dest, src) 1700 1477 if (const_alpha == 255) { 1701 for (int i = 0; i < length; ++i) 1478 for (int i = 0; i < length; ++i) { 1479 PRELOAD_COND2(dest, src) 1702 1480 dest[i] = BYTE_MUL(dest[i], qAlpha(src[i])); 1481 } 1703 1482 } else { 1704 1483 int cia = 255 - const_alpha; 1705 1484 for (int i = 0; i < length; ++i) { 1485 PRELOAD_COND2(dest, src) 1706 1486 uint a = BYTE_MUL(qAlpha(src[i]), const_alpha) + cia; 1707 1487 dest[i] = BYTE_MUL(dest[i], a); … … 1717 1497 static void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha) 1718 1498 { 1499 PRELOAD_INIT(dest) 1719 1500 if (const_alpha == 255) { 1720 for (int i = 0; i < length; ++i) 1501 for (int i = 0; i < length; ++i) { 1502 PRELOAD_COND(dest) 1721 1503 dest[i] = BYTE_MUL(color, qAlpha(~dest[i])); 1504 } 1722 1505 } else { 1723 1506 color = BYTE_MUL(color, const_alpha); 1724 1507 int cia = 255 - const_alpha; 1725 1508 for (int i = 0; i < length; ++i) { 1509 PRELOAD_COND(dest) 1726 1510 uint d = dest[i]; 1727 1511 dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, cia); … … 1732 1516 static void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, uint const_alpha) 1733 1517 { 1518 PRELOAD_INIT2(dest, src) 1734 1519 if (const_alpha == 255) { 1735 for (int i = 0; i < length; ++i) 1520 for (int i = 0; i < length; ++i) { 1521 PRELOAD_COND2(dest, src) 1736 1522 dest[i] = BYTE_MUL(src[i], qAlpha(~dest[i])); 1523 } 1737 1524 } else { 1738 1525 int cia = 255 - const_alpha; 1739 1526 for (int i = 0; i < length; ++i) { 1527 PRELOAD_COND2(dest, src) 1740 1528 uint s = BYTE_MUL(src[i], const_alpha); 1741 1529 uint d = dest[i]; … … 1755 1543 if (const_alpha != 255) 1756 1544 a = BYTE_MUL(a, const_alpha) + 255 - const_alpha; 1757 for (int i = 0; i < length; ++i) 1545 PRELOAD_INIT(dest) 1546 for (int i = 0; i < length; ++i) { 1547 PRELOAD_COND(dest) 1758 1548 dest[i] = BYTE_MUL(dest[i], a); 1549 } 1759 1550 } 1760 1551 1761 1552 static void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int length, uint const_alpha) 1762 1553 { 1554 PRELOAD_INIT2(dest, src) 1763 1555 if (const_alpha == 255) { 1764 for (int i = 0; i < length; ++i) 1556 for (int i = 0; i < length; ++i) { 1557 PRELOAD_COND2(dest, src) 1765 1558 dest[i] = BYTE_MUL(dest[i], qAlpha(~src[i])); 1559 } 1766 1560 } else { 1767 1561 int cia = 255 - const_alpha; 1768 1562 for (int i = 0; i < length; ++i) { 1563 PRELOAD_COND2(dest, src) 1769 1564 uint sia = BYTE_MUL(qAlpha(~src[i]), const_alpha) + cia; 1770 1565 dest[i] = BYTE_MUL(dest[i], sia); … … 1785 1580 } 1786 1581 uint sia = qAlpha(~color); 1787 for (int i = 0; i < length; ++i) 1582 PRELOAD_INIT(dest) 1583 for (int i = 0; i < length; ++i) { 1584 PRELOAD_COND(dest) 1788 1585 dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[i]), dest[i], sia); 1586 } 1789 1587 } 1790 1588 1791 1589 static void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, uint const_alpha) 1792 1590 { 1591 PRELOAD_INIT2(dest, src) 1793 1592 if (const_alpha == 255) { 1794 1593 for (int i = 0; i < length; ++i) { 1594 PRELOAD_COND2(dest, src) 1795 1595 uint s = src[i]; 1796 1596 uint d = dest[i]; … … 1799 1599 } else { 1800 1600 for (int i = 0; i < length; ++i) { 1601 PRELOAD_COND2(dest, src) 1801 1602 uint s = BYTE_MUL(src[i], const_alpha); 1802 1603 uint d = dest[i]; … … 1818 1619 a = qAlpha(color) + 255 - const_alpha; 1819 1620 } 1621 PRELOAD_INIT(dest) 1820 1622 for (int i = 0; i < length; ++i) { 1623 PRELOAD_COND(dest) 1821 1624 uint d = dest[i]; 1822 1625 dest[i] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d)); … … 1826 1629 static void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int length, uint const_alpha) 1827 1630 { 1631 PRELOAD_INIT2(dest, src) 1828 1632 if (const_alpha == 255) { 1829 1633 for (int i = 0; i < length; ++i) { 1634 PRELOAD_COND2(dest, src) 1830 1635 uint s = src[i]; 1831 1636 uint d = dest[i]; … … 1835 1640 int cia = 255 - const_alpha; 1836 1641 for (int i = 0; i < length; ++i) { 1642 PRELOAD_COND2(dest, src) 1837 1643 uint s = BYTE_MUL(src[i], const_alpha); 1838 1644 uint d = dest[i]; … … 1855 1661 uint sia = qAlpha(~color); 1856 1662 1663 PRELOAD_INIT(dest) 1857 1664 for (int i = 0; i < length; ++i) { 1665 PRELOAD_COND(dest) 1858 1666 uint d = dest[i]; 1859 1667 dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia); … … 1863 1671 static void QT_FASTCALL comp_func_XOR(uint *dest, const uint *src, int length, uint const_alpha) 1864 1672 { 1673 PRELOAD_INIT2(dest, src) 1865 1674 if (const_alpha == 255) { 1866 1675 for (int i = 0; i < length; ++i) { 1676 PRELOAD_COND2(dest, src) 1867 1677 uint d = dest[i]; 1868 1678 uint s = src[i]; … … 1871 1681 } else { 1872 1682 for (int i = 0; i < length; ++i) { 1683 PRELOAD_COND2(dest, src) 1873 1684 uint d = dest[i]; 1874 1685 uint s = BYTE_MUL(src[i], const_alpha); … … 1921 1732 uint s = color; 1922 1733 1734 PRELOAD_INIT(dest) 1923 1735 for (int i = 0; i < length; ++i) { 1736 PRELOAD_COND(dest) 1924 1737 uint d = dest[i]; 1925 1738 #define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) … … 1941 1754 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uint *src, int length, const T &coverage) 1942 1755 { 1756 PRELOAD_INIT2(dest, src) 1943 1757 for (int i = 0; i < length; ++i) { 1758 PRELOAD_COND2(dest, src) 1944 1759 uint d = dest[i]; 1945 1760 uint s = src[i]; … … 1977 1792 int sb = qBlue(color); 1978 1793 1794 PRELOAD_INIT(dest) 1979 1795 for (int i = 0; i < length; ++i) { 1796 PRELOAD_COND(dest) 1980 1797 uint d = dest[i]; 1981 1798 int da = qAlpha(d); … … 2003 1820 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *dest, const uint *src, int length, const T &coverage) 2004 1821 { 1822 PRELOAD_INIT2(dest, src) 2005 1823 for (int i = 0; i < length; ++i) { 1824 PRELOAD_COND2(dest, src) 2006 1825 uint d = dest[i]; 2007 1826 uint s = src[i]; … … 2041 1860 int sb = qBlue(color); 2042 1861 1862 PRELOAD_INIT(dest) 2043 1863 for (int i = 0; i < length; ++i) { 1864 PRELOAD_COND(dest) 2044 1865 uint d = dest[i]; 2045 1866 int da = qAlpha(d); … … 2067 1888 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *dest, const uint *src, int length, const T &coverage) 2068 1889 { 1890 PRELOAD_INIT2(dest, src) 2069 1891 for (int i = 0; i < length; ++i) { 1892 PRELOAD_COND2(dest, src) 2070 1893 uint d = dest[i]; 2071 1894 uint s = src[i]; … … 2116 1939 int sb = qBlue(color); 2117 1940 1941 PRELOAD_INIT(dest) 2118 1942 for (int i = 0; i < length; ++i) { 1943 PRELOAD_COND(dest) 2119 1944 uint d = dest[i]; 2120 1945 int da = qAlpha(d); … … 2142 1967 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *dest, const uint *src, int length, const T &coverage) 2143 1968 { 1969 PRELOAD_INIT2(dest, src) 2144 1970 for (int i = 0; i < length; ++i) { 1971 PRELOAD_COND2(dest, src) 2145 1972 uint d = dest[i]; 2146 1973 uint s = src[i]; … … 2185 2012 int sb = qBlue(color); 2186 2013 2014 PRELOAD_INIT(dest) 2187 2015 for (int i = 0; i < length; ++i) { 2016 PRELOAD_COND(dest) 2188 2017 uint d = dest[i]; 2189 2018 int da = qAlpha(d); … … 2211 2040 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *dest, const uint *src, int length, const T &coverage) 2212 2041 { 2042 PRELOAD_INIT2(dest, src) 2213 2043 for (int i = 0; i < length; ++i) { 2044 PRELOAD_COND2(dest, src) 2214 2045 uint d = dest[i]; 2215 2046 uint s = src[i]; … … 2254 2085 int sb = qBlue(color); 2255 2086 2087 PRELOAD_INIT(dest) 2256 2088 for (int i = 0; i < length; ++i) { 2089 PRELOAD_COND(dest) 2257 2090 uint d = dest[i]; 2258 2091 int da = qAlpha(d); … … 2280 2113 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *dest, const uint *src, int length, const T &coverage) 2281 2114 { 2115 PRELOAD_INIT2(dest, src) 2282 2116 for (int i = 0; i < length; ++i) { 2117 PRELOAD_COND2(dest, src) 2283 2118 uint d = dest[i]; 2284 2119 uint s = src[i]; … … 2333 2168 int sb = qBlue(color); 2334 2169 2170 PRELOAD_INIT(dest) 2335 2171 for (int i = 0; i < length; ++i) { 2172 PRELOAD_COND(dest) 2336 2173 uint d = dest[i]; 2337 2174 int da = qAlpha(d); … … 2359 2196 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *dest, const uint *src, int length, const T &coverage) 2360 2197 { 2198 PRELOAD_INIT2(dest, src) 2361 2199 for (int i = 0; i < length; ++i) { 2200 PRELOAD_COND2(dest, src) 2362 2201 uint d = dest[i]; 2363 2202 uint s = src[i]; … … 2401 2240 if (src == 0 || src_da + dst_sa <= sa_da) 2402 2241 return qt_div_255(temp); 2403 else 2404 return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); 2242 return qt_div_255(sa * (src_da + dst_sa - sa_da) / src + temp); 2405 2243 } 2406 2244 … … 2413 2251 int sb = qBlue(color); 2414 2252 2253 PRELOAD_INIT(dest) 2415 2254 for (int i = 0; i < length; ++i) { 2255 PRELOAD_COND(dest) 2416 2256 uint d = dest[i]; 2417 2257 int da = qAlpha(d); … … 2439 2279 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *dest, const uint *src, int length, const T &coverage) 2440 2280 { 2281 PRELOAD_INIT2(dest, src) 2441 2282 for (int i = 0; i < length; ++i) { 2283 PRELOAD_COND2(dest, src) 2442 2284 uint d = dest[i]; 2443 2285 uint s = src[i]; … … 2489 2331 int sb = qBlue(color); 2490 2332 2333 PRELOAD_INIT(dest) 2491 2334 for (int i = 0; i < length; ++i) { 2335 PRELOAD_COND(dest) 2492 2336 uint d = dest[i]; 2493 2337 int da = qAlpha(d); … … 2515 2359 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *dest, const uint *src, int length, const T &coverage) 2516 2360 { 2361 PRELOAD_INIT2(dest, src) 2517 2362 for (int i = 0; i < length; ++i) { 2363 PRELOAD_COND2(dest, src) 2518 2364 uint d = dest[i]; 2519 2365 uint s = src[i]; … … 2542 2388 2543 2389 /* 2544 if 2.Sca <Sa2545 Dca' = Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa)2546 otherwise if 8.Dca <= Da2547 Dca' = Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa).(3 - 8.Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa)2548 otherwise2549 Dca' = (Dca.Sa + ((Dca/Da)^(0.5).Da - Dca).(2.Sca - Sa)) + Sca.(1 - Da) + Dca.(1 - Sa)2390 if 2.Sca <= Sa 2391 Dca' = Dca.(Sa + (2.Sca - Sa).(1 - Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) 2392 otherwise if 2.Sca > Sa and 4.Dca <= Da 2393 Dca' = Dca.Sa + Da.(2.Sca - Sa).(4.Dca/Da.(4.Dca/Da + 1).(Dca/Da - 1) + 7.Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) 2394 otherwise if 2.Sca > Sa and 4.Dca > Da 2395 Dca' = Dca.Sa + Da.(2.Sca - Sa).((Dca/Da)^0.5 - Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) 2550 2396 */ 2551 2397 static inline int soft_light_op(int dst, int src, int da, int sa) … … 2556 2402 2557 2403 if (src2 < sa) 2558 return (dst * ( (sa * 255) - (255 - dst_np) * (src2 - sa)) + temp) / 65025;2559 else if ( 8* dst <= da)2560 return (dst * ((sa * 255) - ((255 - dst_np) * (src2 - sa) * ((3 * 255) - 8 * dst_np)) / 255) + temp) / 65025;2404 return (dst * (sa * 255 + (src2 - sa) * (255 - dst_np)) + temp) / 65025; 2405 else if (4 * dst <= da) 2406 return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; 2561 2407 else { 2562 // sqrt is too expensive to do three times per pixel, so skipping it for now 2563 // a future possibility is to use a LUT 2564 return ((dst * sa * 255) + (int(dst_np) * da - (dst * 255)) * (src2 - sa) + temp) / 65025; 2408 return (dst * sa * 255 + da * (src2 - sa) * (int(sqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; 2565 2409 } 2566 2410 } … … 2574 2418 int sb = qBlue(color); 2575 2419 2420 PRELOAD_INIT(dest) 2576 2421 for (int i = 0; i < length; ++i) { 2422 PRELOAD_COND(dest) 2577 2423 uint d = dest[i]; 2578 2424 int da = qAlpha(d); … … 2600 2446 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *dest, const uint *src, int length, const T &coverage) 2601 2447 { 2448 PRELOAD_INIT2(dest, src) 2602 2449 for (int i = 0; i < length; ++i) { 2450 PRELOAD_COND2(dest, src) 2603 2451 uint d = dest[i]; 2604 2452 uint s = src[i]; … … 2643 2491 int sb = qBlue(color); 2644 2492 2493 PRELOAD_INIT(dest) 2645 2494 for (int i = 0; i < length; ++i) { 2495 PRELOAD_COND(dest) 2646 2496 uint d = dest[i]; 2647 2497 int da = qAlpha(d); … … 2669 2519 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *dest, const uint *src, int length, const T &coverage) 2670 2520 { 2521 PRELOAD_INIT2(dest, src) 2671 2522 for (int i = 0; i < length; ++i) { 2523 PRELOAD_COND2(dest, src) 2672 2524 uint d = dest[i]; 2673 2525 uint s = src[i]; … … 2706 2558 int sb = qBlue(color); 2707 2559 2560 PRELOAD_INIT(dest) 2708 2561 for (int i = 0; i < length; ++i) { 2562 PRELOAD_COND(dest) 2709 2563 uint d = dest[i]; 2710 2564 int da = qAlpha(d); … … 2732 2586 Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *dest, const uint *src, int length, const T &coverage) 2733 2587 { 2588 PRELOAD_INIT2(dest, src) 2734 2589 for (int i = 0; i < length; ++i) { 2590 PRELOAD_COND2(dest, src) 2735 2591 uint d = dest[i]; 2736 2592 uint s = src[i]; … … 2757 2613 comp_func_Exclusion_impl(dest, src, length, QPartialCoverage(const_alpha)); 2758 2614 } 2615 2616 #if defined(Q_CC_RVCT) 2617 // Restore pragma state from previous #pragma arm 2618 # pragma pop 2619 #endif 2759 2620 2760 2621 static void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, … … 3221 3082 3222 3083 template <class T> 3223 Q_STATIC_TEMPLATE_FUNCTION void blendColor(int count, const QSpan *spans, void *userData 3224 Q_TEMPLATE_FIX(T)) 3084 Q_STATIC_TEMPLATE_FUNCTION void blendColor(int count, const QSpan *spans, void *userData) 3225 3085 { 3226 3086 QSpanData *data = reinterpret_cast<QSpanData *>(userData); … … 3268 3128 } 3269 3129 3270 #if defined(Q_CC_MSVC) && _MSC_VER <= 1300 && !defined(Q_CC_INTEL) 3271 #define BLEND_COLOR_DECL(DST) \ 3272 static void blendColor_##DST(int count, \ 3273 const QSpan *spans, \ 3274 void *userData) \ 3275 { \ 3276 blendColor<DST>(count, spans, userData Q_TEMPLATE_CALL(DST)); \ 3277 } 3278 3279 BLEND_COLOR_DECL(qargb8565) 3280 BLEND_COLOR_DECL(qrgb666) 3281 BLEND_COLOR_DECL(qargb6666) 3282 BLEND_COLOR_DECL(qrgb555) 3283 BLEND_COLOR_DECL(qargb8555) 3284 BLEND_COLOR_DECL(qrgb888) 3285 BLEND_COLOR_DECL(qrgb444) 3286 BLEND_COLOR_DECL(qargb4444) 3287 #undef DEST_FETCH_DECL 3288 #define SPANFUNC_POINTER_BLENDCOLOR(DST) blendColor_##DST 3289 #else // !VC6 && !VC2002 3290 # define SPANFUNC_POINTER_BLENDCOLOR(DST) blendColor<DST> 3291 #endif 3130 #define SPANFUNC_POINTER_BLENDCOLOR(DST) blendColor<DST> 3292 3131 3293 3132 static void blend_color_rgb16(int count, const QSpan *spans, void *userData) … … 3367 3206 } 3368 3207 3369 template <SpanMethod spanMethod> 3370 Q_STATIC_TEMPLATE_FUNCTION void blend_src_generic(int count, const QSpan *spans, void *userData 3371 Q_TEMPLATE_ENUM_FIX(SpanMethod, spanMethod)) 3372 { 3373 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 3374 3375 uint buffer[buffer_size]; 3376 uint src_buffer[buffer_size]; 3377 Operator op = getOperator(data, spans, count); 3378 3208 template <typename T> 3209 void handleSpans(int count, const QSpan *spans, const QSpanData *data, T &handler) 3210 { 3379 3211 uint const_alpha = 256; 3380 3212 if (data->type == QSpanData::Texture) 3381 3213 const_alpha = data->texture.const_alpha; 3382 3214 3383 while (count--) { 3215 int coverage = 0; 3216 while (count) { 3384 3217 int x = spans->x; 3385 int length = spans->len; 3386 const int coverage = (spans->coverage * const_alpha) >> 8; 3218 const int y = spans->y; 3219 int right = x + spans->len; 3220 3221 // compute length of adjacent spans 3222 for (int i = 1; i < count && spans[i].y == y && spans[i].x == right; ++i) 3223 right += spans[i].len; 3224 int length = right - x; 3225 3387 3226 while (length) { 3388 3227 int l = qMin(buffer_size, length); 3389 const uint *src = op.src_fetch(src_buffer, &op, data, spans->y, x, l); 3390 if (spanMethod == RegularSpans) { 3391 uint *dest = op.dest_fetch ? op.dest_fetch(buffer, data->rasterBuffer, x, spans->y, l) : buffer; 3392 op.func(dest, src, l, coverage); 3393 if (op.dest_store) 3394 op.dest_store(data->rasterBuffer, x, spans->y, dest, l); 3395 } else { 3396 drawBufferSpan(data, src, l, x, spans->y, l, coverage); 3228 length -= l; 3229 3230 int process_length = l; 3231 int process_x = x; 3232 3233 const uint *src = handler.fetch(process_x, y, process_length); 3234 int offset = 0; 3235 while (l > 0) { 3236 if (x == spans->x) // new span? 3237 coverage = (spans->coverage * const_alpha) >> 8; 3238 3239 int right = spans->x + spans->len; 3240 int len = qMin(l, right - x); 3241 3242 handler.process(x, y, len, coverage, src, offset); 3243 3244 l -= len; 3245 x += len; 3246 offset += len; 3247 3248 if (x == right) { // done with current span? 3249 ++spans; 3250 --count; 3251 } 3397 3252 } 3398 x += l; 3399 length -= l; 3400 } 3401 ++spans; 3402 } 3403 } 3253 handler.store(process_x, y, process_length); 3254 } 3255 } 3256 } 3257 3258 struct QBlendBase 3259 { 3260 QBlendBase(QSpanData *d, Operator o) 3261 : data(d) 3262 , op(o) 3263 , dest(0) 3264 { 3265 } 3266 3267 QSpanData *data; 3268 Operator op; 3269 3270 uint *dest; 3271 3272 uint buffer[buffer_size]; 3273 uint src_buffer[buffer_size]; 3274 }; 3404 3275 3405 3276 template <SpanMethod spanMethod> 3406 Q_STATIC_TEMPLATE_FUNCTION void blend_untransformed_generic(int count, const QSpan *spans, void *userData 3407 Q_TEMPLATE_ENUM_FIX(SpanMethod, spanMethod)) 3277 class BlendSrcGeneric : public QBlendBase 3278 { 3279 public: 3280 BlendSrcGeneric(QSpanData *d, Operator o) 3281 : QBlendBase(d, o) 3282 { 3283 } 3284 3285 const uint *fetch(int x, int y, int len) 3286 { 3287 if (spanMethod == RegularSpans) 3288 dest = op.dest_fetch ? op.dest_fetch(buffer, data->rasterBuffer, x, y, len) : buffer; 3289 3290 return op.src_fetch(src_buffer, &op, data, y, x, len); 3291 } 3292 3293 void process(int x, int y, int len, int coverage, const uint *src, int offset) 3294 { 3295 if (spanMethod == RegularSpans) 3296 op.func(dest + offset, src + offset, len, coverage); 3297 else 3298 drawBufferSpan(data, src + offset, len, x, y, len, coverage); 3299 } 3300 3301 void store(int x, int y, int len) 3302 { 3303 if (spanMethod == RegularSpans && op.dest_store) { 3304 op.dest_store(data->rasterBuffer, x, y, dest, len); 3305 } 3306 } 3307 }; 3308 3309 template <SpanMethod spanMethod> 3310 Q_STATIC_TEMPLATE_FUNCTION void blend_src_generic(int count, const QSpan *spans, void *userData) 3311 { 3312 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 3313 BlendSrcGeneric<spanMethod> blend(data, getOperator(data, spans, count)); 3314 handleSpans(count, spans, data, blend); 3315 } 3316 3317 template <SpanMethod spanMethod> 3318 Q_STATIC_TEMPLATE_FUNCTION void blend_untransformed_generic(int count, const QSpan *spans, void *userData) 3408 3319 { 3409 3320 QSpanData *data = reinterpret_cast<QSpanData *>(userData); … … 3456 3367 3457 3368 template <SpanMethod spanMethod> 3458 Q_STATIC_TEMPLATE_FUNCTION void blend_untransformed_argb(int count, const QSpan *spans, void *userData 3459 Q_TEMPLATE_ENUM_FIX(SpanMethod, spanMethod)) 3369 Q_STATIC_TEMPLATE_FUNCTION void blend_untransformed_argb(int count, const QSpan *spans, void *userData) 3460 3370 { 3461 3371 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 3462 3372 if (data->texture.format != QImage::Format_ARGB32_Premultiplied 3463 3373 && data->texture.format != QImage::Format_RGB32) { 3464 blend_untransformed_generic<spanMethod>(count, spans, userData Q_TEMPLATE_ENUM_CALL(SpanMethod, spanMethod));3374 blend_untransformed_generic<spanMethod>(count, spans, userData); 3465 3375 return; 3466 3376 } … … 4708 4618 mode != QPainter::CompositionMode_Source) 4709 4619 { 4710 blend_src_generic<RegularSpans>(count, spans, userData 4711 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4620 blend_src_generic<RegularSpans>(count, spans, userData); 4712 4621 return; 4713 4622 } … … 4764 4673 void *userData) 4765 4674 { 4766 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_24)4675 #if defined(QT_QWS_DEPTH_24) 4767 4676 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4768 4677 … … 4771 4680 else 4772 4681 #endif 4773 blend_untransformed_generic<RegularSpans>(count, spans, userData 4774 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4682 blend_untransformed_generic<RegularSpans>(count, spans, userData); 4775 4683 } 4776 4684 … … 4778 4686 void *userData) 4779 4687 { 4780 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)4688 #if defined(QT_QWS_DEPTH_18) 4781 4689 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4782 4690 … … 4787 4695 else 4788 4696 #endif 4789 blend_untransformed_generic<RegularSpans>(count, spans, userData 4790 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4697 blend_untransformed_generic<RegularSpans>(count, spans, userData); 4791 4698 } 4792 4699 … … 4794 4701 void *userData) 4795 4702 { 4796 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)4703 #if defined(QT_QWS_DEPTH_18) 4797 4704 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4798 4705 … … 4803 4710 else 4804 4711 #endif 4805 blend_untransformed_generic<RegularSpans>(count, spans, userData 4806 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4712 blend_untransformed_generic<RegularSpans>(count, spans, userData); 4807 4713 } 4808 4714 … … 4810 4716 void *userData) 4811 4717 { 4812 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)4718 #if defined(QT_QWS_DEPTH_16) 4813 4719 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4814 4720 … … 4819 4725 else 4820 4726 #endif 4821 blend_untransformed_generic<RegularSpans>(count, spans, userData 4822 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4727 blend_untransformed_generic<RegularSpans>(count, spans, userData); 4823 4728 } 4824 4729 … … 4826 4731 void *userData) 4827 4732 { 4828 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)4733 #if defined(QT_QWS_DEPTH_16) 4829 4734 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4830 4735 … … 4835 4740 else 4836 4741 #endif 4837 blend_untransformed_generic<RegularSpans>(count, spans, userData 4838 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4742 blend_untransformed_generic<RegularSpans>(count, spans, userData); 4839 4743 } 4840 4744 … … 4842 4746 void *userData) 4843 4747 { 4844 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)4748 #if defined(QT_QWS_DEPTH_15) 4845 4749 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4846 4750 … … 4851 4755 else 4852 4756 #endif 4853 blend_untransformed_generic<RegularSpans>(count, spans, userData 4854 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4757 blend_untransformed_generic<RegularSpans>(count, spans, userData); 4855 4758 } 4856 4759 … … 4858 4761 void *userData) 4859 4762 { 4860 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)4763 #if defined(QT_QWS_DEPTH_15) 4861 4764 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4862 4765 … … 4867 4770 else 4868 4771 #endif 4869 blend_untransformed_generic<RegularSpans>(count, spans, userData 4870 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4772 blend_untransformed_generic<RegularSpans>(count, spans, userData); 4871 4773 } 4872 4774 … … 4874 4776 void *userData) 4875 4777 { 4876 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)4778 #if defined(QT_QWS_DEPTH_12) 4877 4779 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4878 4780 … … 4883 4785 else 4884 4786 #endif 4885 blend_untransformed_generic<RegularSpans>(count, spans, userData 4886 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4787 blend_untransformed_generic<RegularSpans>(count, spans, userData); 4887 4788 } 4888 4789 … … 4890 4791 void *userData) 4891 4792 { 4892 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)4793 #if defined(QT_QWS_DEPTH_12) 4893 4794 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4894 4795 … … 4899 4800 else 4900 4801 #endif 4901 blend_untransformed_generic<RegularSpans>(count, spans, userData 4902 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4802 blend_untransformed_generic<RegularSpans>(count, spans, userData); 4903 4803 } 4904 4804 4905 4805 template <SpanMethod spanMethod> 4906 Q_STATIC_TEMPLATE_FUNCTION void blend_tiled_generic(int count, const QSpan *spans, void *userData 4907 Q_TEMPLATE_ENUM_FIX(SpanMethod, spanMethod)) 4806 Q_STATIC_TEMPLATE_FUNCTION void blend_tiled_generic(int count, const QSpan *spans, void *userData) 4908 4807 { 4909 4808 QSpanData *data = reinterpret_cast<QSpanData *>(userData); … … 4959 4858 4960 4859 template <SpanMethod spanMethod> 4961 Q_STATIC_TEMPLATE_FUNCTION void blend_tiled_argb(int count, const QSpan *spans, void *userData 4962 Q_TEMPLATE_ENUM_FIX(SpanMethod, spanMethod)) 4860 Q_STATIC_TEMPLATE_FUNCTION void blend_tiled_argb(int count, const QSpan *spans, void *userData) 4963 4861 { 4964 4862 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 4965 4863 if (data->texture.format != QImage::Format_ARGB32_Premultiplied 4966 4864 && data->texture.format != QImage::Format_RGB32) { 4967 blend_tiled_generic<spanMethod>(count, spans, userData Q_TEMPLATE_ENUM_CALL(SpanMethod, spanMethod));4865 blend_tiled_generic<spanMethod>(count, spans, userData); 4968 4866 return; 4969 4867 } … … 5021 4919 mode != QPainter::CompositionMode_Source) 5022 4920 { 5023 blend_src_generic<RegularSpans>(count, spans, userData 5024 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 4921 blend_src_generic<RegularSpans>(count, spans, userData); 5025 4922 return; 5026 4923 } … … 5054 4951 sy += image_height; 5055 4952 5056 while (length) { 5057 int l = qMin(image_width - sx, length); 5058 if (buffer_size < l) 5059 l = buffer_size; 5060 5061 DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x; 5062 const SRC *src = (SRC*)data->texture.scanLine(sy) + sx; 5063 if (modeSource && coverage == 255) { 4953 if (modeSource && coverage == 255) { 4954 // Copy the first texture block 4955 length = qMin(image_width,length); 4956 int tx = x; 4957 while (length) { 4958 int l = qMin(image_width - sx, length); 4959 if (buffer_size < l) 4960 l = buffer_size; 4961 DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + tx; 4962 const SRC *src = (SRC*)data->texture.scanLine(sy) + sx; 4963 5064 4964 qt_memconvert<DST, SRC>(dest, src, l); 5065 } else if (sizeof(DST) == 3 && sizeof(SRC) == 3 && l >= 4 && 5066 (quintptr(dest) & 3) == (quintptr(src) & 3)) 5067 { 5068 blendUntransformed_dest24(dest, src, coverage, l); 5069 } else if (sizeof(DST) == 2 && sizeof(SRC) == 2 && l >= 2 && 5070 (quintptr(dest) & 3) == (quintptr(src) & 3)) 5071 { 5072 blendUntransformed_dest16(dest, src, coverage, l); 5073 } else { 5074 blendUntransformed_unaligned(dest, src, coverage, l); 4965 length -= l; 4966 tx += l; 4967 sx = 0; 5075 4968 } 5076 4969 5077 x += l; 5078 length -= l; 5079 sx = 0; 4970 // Now use the rasterBuffer as the source of the texture, 4971 // We can now progressively copy larger blocks 4972 // - Less cpu time in code figuring out what to copy 4973 // We are dealing with one block of data 4974 // - More likely to fit in the cache 4975 // - can use memcpy 4976 int copy_image_width = qMin(image_width, int(spans->len)); 4977 length = spans->len - copy_image_width; 4978 DST *src = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x; 4979 DST *dest = src + copy_image_width; 4980 while (copy_image_width < length) { 4981 qt_memconvert(dest, src, copy_image_width); 4982 dest += copy_image_width; 4983 length -= copy_image_width; 4984 copy_image_width *= 2; 4985 } 4986 qt_memconvert(dest, src, length); 4987 } else { 4988 while (length) { 4989 int l = qMin(image_width - sx, length); 4990 if (buffer_size < l) 4991 l = buffer_size; 4992 DST *dest = ((DST*)data->rasterBuffer->scanLine(spans->y)) + x; 4993 const SRC *src = (SRC*)data->texture.scanLine(sy) + sx; 4994 if (sizeof(DST) == 3 && sizeof(SRC) == 3 && l >= 4 && 4995 (quintptr(dest) & 3) == (quintptr(src) & 3)) 4996 { 4997 blendUntransformed_dest24(dest, src, coverage, l); 4998 } else if (sizeof(DST) == 2 && sizeof(SRC) == 2 && l >= 2 && 4999 (quintptr(dest) & 3) == (quintptr(src) & 3)) 5000 { 5001 blendUntransformed_dest16(dest, src, coverage, l); 5002 } else { 5003 blendUntransformed_unaligned(dest, src, coverage, l); 5004 } 5005 5006 x += l; 5007 length -= l; 5008 sx = 0; 5009 } 5080 5010 } 5081 5011 ++spans; … … 5085 5015 static void blend_tiled_rgb888(int count, const QSpan *spans, void *userData) 5086 5016 { 5087 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_24)5017 #if defined(QT_QWS_DEPTH_24) 5088 5018 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5089 5019 … … 5092 5022 else 5093 5023 #endif 5094 blend_tiled_generic<RegularSpans>(count, spans, userData 5095 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5024 blend_tiled_generic<RegularSpans>(count, spans, userData); 5096 5025 } 5097 5026 5098 5027 static void blend_tiled_argb6666(int count, const QSpan *spans, void *userData) 5099 5028 { 5100 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)5029 #if defined(QT_QWS_DEPTH_18) 5101 5030 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5102 5031 … … 5107 5036 else 5108 5037 #endif 5109 blend_tiled_generic<RegularSpans>(count, spans, userData 5110 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5038 blend_tiled_generic<RegularSpans>(count, spans, userData); 5111 5039 } 5112 5040 5113 5041 static void blend_tiled_rgb666(int count, const QSpan *spans, void *userData) 5114 5042 { 5115 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)5043 #if defined(QT_QWS_DEPTH_18) 5116 5044 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5117 5045 … … 5122 5050 else 5123 5051 #endif 5124 blend_tiled_generic<RegularSpans>(count, spans, userData 5125 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5052 blend_tiled_generic<RegularSpans>(count, spans, userData); 5126 5053 } 5127 5054 5128 5055 static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData) 5129 5056 { 5130 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)5057 #if defined(QT_QWS_DEPTH_16) 5131 5058 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5132 5059 … … 5137 5064 else 5138 5065 #endif 5139 blend_tiled_generic<RegularSpans>(count, spans, userData 5140 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5066 blend_tiled_generic<RegularSpans>(count, spans, userData); 5141 5067 } 5142 5068 5143 5069 static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) 5144 5070 { 5145 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)5071 #if defined(QT_QWS_DEPTH_16) 5146 5072 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5147 5073 … … 5152 5078 else 5153 5079 #endif 5154 blend_tiled_generic<RegularSpans>(count, spans, userData 5155 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5080 blend_tiled_generic<RegularSpans>(count, spans, userData); 5156 5081 } 5157 5082 5158 5083 static void blend_tiled_argb8555(int count, const QSpan *spans, void *userData) 5159 5084 { 5160 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)5085 #if defined(QT_QWS_DEPTH_15) 5161 5086 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5162 5087 … … 5167 5092 else 5168 5093 #endif 5169 blend_tiled_generic<RegularSpans>(count, spans, userData 5170 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5094 blend_tiled_generic<RegularSpans>(count, spans, userData); 5171 5095 } 5172 5096 5173 5097 static void blend_tiled_rgb555(int count, const QSpan *spans, void *userData) 5174 5098 { 5175 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)5099 #if defined(QT_QWS_DEPTH_15) 5176 5100 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5177 5101 … … 5182 5106 else 5183 5107 #endif 5184 blend_tiled_generic<RegularSpans>(count, spans, userData 5185 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5108 blend_tiled_generic<RegularSpans>(count, spans, userData); 5186 5109 } 5187 5110 5188 5111 static void blend_tiled_argb4444(int count, const QSpan *spans, void *userData) 5189 5112 { 5190 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)5113 #if defined(QT_QWS_DEPTH_12) 5191 5114 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5192 5115 … … 5197 5120 else 5198 5121 #endif 5199 blend_tiled_generic<RegularSpans>(count, spans, userData 5200 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5122 blend_tiled_generic<RegularSpans>(count, spans, userData); 5201 5123 } 5202 5124 5203 5125 static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData) 5204 5126 { 5205 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)5127 #if defined(QT_QWS_DEPTH_12) 5206 5128 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5207 5129 … … 5212 5134 else 5213 5135 #endif 5214 blend_tiled_generic<RegularSpans>(count, spans, userData 5215 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5136 blend_tiled_generic<RegularSpans>(count, spans, userData); 5216 5137 } 5217 5138 5218 5139 5219 5140 template <SpanMethod spanMethod> 5220 Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const QSpan *spans, void *userData 5221 Q_TEMPLATE_ENUM_FIX(SpanMethod, spanMethod)) 5141 Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const QSpan *spans, void *userData) 5222 5142 { 5223 5143 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5224 5144 if (data->texture.format != QImage::Format_ARGB32_Premultiplied 5225 5145 && data->texture.format != QImage::Format_RGB32) { 5226 blend_src_generic<spanMethod>(count, spans, userData Q_TEMPLATE_ENUM_CALL(SpanMethod, spanMethod));5146 blend_src_generic<spanMethod>(count, spans, userData); 5227 5147 return; 5228 5148 } … … 5403 5323 5404 5324 if (mode != QPainter::CompositionMode_SourceOver) { 5405 blend_src_generic<RegularSpans>(count, spans, userData 5406 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5325 blend_src_generic<RegularSpans>(count, spans, userData); 5407 5326 return; 5408 5327 } … … 5600 5519 static void blend_transformed_bilinear_rgb888(int count, const QSpan *spans, void *userData) 5601 5520 { 5602 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_24)5521 #if defined(QT_QWS_DEPTH_24) 5603 5522 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5604 5523 … … 5607 5526 else 5608 5527 #endif 5609 blend_src_generic<RegularSpans>(count, spans, userData 5610 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5528 blend_src_generic<RegularSpans>(count, spans, userData); 5611 5529 } 5612 5530 5613 5531 static void blend_transformed_bilinear_argb6666(int count, const QSpan *spans, void *userData) 5614 5532 { 5615 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)5533 #if defined(QT_QWS_DEPTH_18) 5616 5534 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5617 5535 … … 5622 5540 else 5623 5541 #endif 5624 blend_src_generic<RegularSpans>(count, spans, userData 5625 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5542 blend_src_generic<RegularSpans>(count, spans, userData); 5626 5543 } 5627 5544 5628 5545 static void blend_transformed_bilinear_rgb666(int count, const QSpan *spans, void *userData) 5629 5546 { 5630 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)5547 #if defined(QT_QWS_DEPTH_18) 5631 5548 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5632 5549 … … 5637 5554 else 5638 5555 #endif 5639 blend_src_generic<RegularSpans>(count, spans, userData 5640 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5556 blend_src_generic<RegularSpans>(count, spans, userData); 5641 5557 } 5642 5558 5643 5559 static void blend_transformed_bilinear_argb8565(int count, const QSpan *spans, void *userData) 5644 5560 { 5645 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)5561 #if defined(QT_QWS_DEPTH_16) 5646 5562 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5647 5563 … … 5652 5568 else 5653 5569 #endif 5654 blend_src_generic<RegularSpans>(count, spans, userData 5655 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5570 blend_src_generic<RegularSpans>(count, spans, userData); 5656 5571 } 5657 5572 … … 5659 5574 void *userData) 5660 5575 { 5661 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)5576 #if defined(QT_QWS_DEPTH_16) 5662 5577 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5663 5578 … … 5668 5583 else 5669 5584 #endif 5670 blend_src_generic<RegularSpans>(count, spans, userData 5671 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5585 blend_src_generic<RegularSpans>(count, spans, userData); 5672 5586 } 5673 5587 5674 5588 static void blend_transformed_bilinear_argb8555(int count, const QSpan *spans, void *userData) 5675 5589 { 5676 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)5590 #if defined(QT_QWS_DEPTH_15) 5677 5591 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5678 5592 … … 5683 5597 else 5684 5598 #endif 5685 blend_src_generic<RegularSpans>(count, spans, userData 5686 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5599 blend_src_generic<RegularSpans>(count, spans, userData); 5687 5600 } 5688 5601 5689 5602 static void blend_transformed_bilinear_rgb555(int count, const QSpan *spans, void *userData) 5690 5603 { 5691 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)5604 #if defined(QT_QWS_DEPTH_15) 5692 5605 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5693 5606 … … 5698 5611 else 5699 5612 #endif 5700 blend_src_generic<RegularSpans>(count, spans, userData 5701 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5613 blend_src_generic<RegularSpans>(count, spans, userData); 5702 5614 } 5703 5615 5704 5616 static void blend_transformed_bilinear_argb4444(int count, const QSpan *spans, void *userData) 5705 5617 { 5706 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)5618 #if defined(QT_QWS_DEPTH_12) 5707 5619 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5708 5620 … … 5713 5625 else 5714 5626 #endif 5715 blend_src_generic<RegularSpans>(count, spans, userData 5716 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5627 blend_src_generic<RegularSpans>(count, spans, userData); 5717 5628 } 5718 5629 5719 5630 static void blend_transformed_bilinear_rgb444(int count, const QSpan *spans, void *userData) 5720 5631 { 5721 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)5632 #if defined(QT_QWS_DEPTH_12) 5722 5633 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5723 5634 … … 5728 5639 else 5729 5640 #endif 5730 blend_src_generic<RegularSpans>(count, spans, userData 5731 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5641 blend_src_generic<RegularSpans>(count, spans, userData); 5732 5642 } 5733 5643 5734 5644 template <SpanMethod spanMethod> 5735 Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_tiled_argb(int count, const QSpan *spans, void *userData 5736 Q_TEMPLATE_ENUM_FIX(SpanMethod, spanMethod)) 5645 Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_tiled_argb(int count, const QSpan *spans, void *userData) 5737 5646 { 5738 5647 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5739 5648 if (data->texture.format != QImage::Format_ARGB32_Premultiplied 5740 5649 && data->texture.format != QImage::Format_RGB32) { 5741 blend_src_generic<spanMethod>(count, spans, userData Q_TEMPLATE_ENUM_CALL(SpanMethod, spanMethod));5650 blend_src_generic<spanMethod>(count, spans, userData); 5742 5651 return; 5743 5652 } … … 5925 5834 5926 5835 template <SpanMethod spanMethod> 5927 Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_argb(int count, const QSpan *spans, void *userData 5928 Q_TEMPLATE_ENUM_FIX(SpanMethod, spanMethod)) 5836 Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_argb(int count, const QSpan *spans, void *userData) 5929 5837 { 5930 5838 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 5931 5839 if (data->texture.format != QImage::Format_ARGB32_Premultiplied 5932 5840 && data->texture.format != QImage::Format_RGB32) { 5933 blend_src_generic<spanMethod>(count, spans, userData Q_TEMPLATE_ENUM_CALL(SpanMethod, spanMethod));5841 blend_src_generic<spanMethod>(count, spans, userData); 5934 5842 return; 5935 5843 } … … 6053 5961 6054 5962 if (mode != QPainter::CompositionMode_SourceOver) { 6055 blend_src_generic<RegularSpans>(count, spans, userData 6056 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 5963 blend_src_generic<RegularSpans>(count, spans, userData); 6057 5964 return; 6058 5965 } … … 6196 6103 void *userData) 6197 6104 { 6198 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_24)6105 #if defined(QT_QWS_DEPTH_24) 6199 6106 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6200 6107 … … 6203 6110 else 6204 6111 #endif 6205 blend_src_generic<RegularSpans>(count, spans, userData 6206 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6112 blend_src_generic<RegularSpans>(count, spans, userData); 6207 6113 } 6208 6114 … … 6210 6116 void *userData) 6211 6117 { 6212 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)6118 #if defined(QT_QWS_DEPTH_18) 6213 6119 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6214 6120 … … 6219 6125 else 6220 6126 #endif 6221 blend_src_generic<RegularSpans>(count, spans, userData 6222 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6127 blend_src_generic<RegularSpans>(count, spans, userData); 6223 6128 } 6224 6129 … … 6226 6131 void *userData) 6227 6132 { 6228 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)6133 #if defined(QT_QWS_DEPTH_18) 6229 6134 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6230 6135 … … 6235 6140 else 6236 6141 #endif 6237 blend_src_generic<RegularSpans>(count, spans, userData 6238 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6142 blend_src_generic<RegularSpans>(count, spans, userData); 6239 6143 } 6240 6144 … … 6242 6146 void *userData) 6243 6147 { 6244 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)6148 #if defined(QT_QWS_DEPTH_16) 6245 6149 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6246 6150 … … 6251 6155 else 6252 6156 #endif 6253 blend_src_generic<RegularSpans>(count, spans, userData 6254 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6157 blend_src_generic<RegularSpans>(count, spans, userData); 6255 6158 } 6256 6159 … … 6258 6161 void *userData) 6259 6162 { 6260 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)6163 #if defined(QT_QWS_DEPTH_16) 6261 6164 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6262 6165 … … 6267 6170 else 6268 6171 #endif 6269 blend_src_generic<RegularSpans>(count, spans, userData 6270 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6172 blend_src_generic<RegularSpans>(count, spans, userData); 6271 6173 } 6272 6174 … … 6274 6176 void *userData) 6275 6177 { 6276 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)6178 #if defined(QT_QWS_DEPTH_15) 6277 6179 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6278 6180 … … 6283 6185 else 6284 6186 #endif 6285 blend_src_generic<RegularSpans>(count, spans, userData 6286 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6187 blend_src_generic<RegularSpans>(count, spans, userData); 6287 6188 } 6288 6189 … … 6290 6191 void *userData) 6291 6192 { 6292 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)6193 #if defined(QT_QWS_DEPTH_15) 6293 6194 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6294 6195 … … 6299 6200 else 6300 6201 #endif 6301 blend_src_generic<RegularSpans>(count, spans, userData 6302 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6202 blend_src_generic<RegularSpans>(count, spans, userData); 6303 6203 } 6304 6204 … … 6306 6206 void *userData) 6307 6207 { 6308 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)6208 #if defined(QT_QWS_DEPTH_12) 6309 6209 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6310 6210 … … 6315 6215 else 6316 6216 #endif 6317 blend_src_generic<RegularSpans>(count, spans, userData 6318 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6217 blend_src_generic<RegularSpans>(count, spans, userData); 6319 6218 } 6320 6219 … … 6322 6221 void *userData) 6323 6222 { 6324 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)6223 #if defined(QT_QWS_DEPTH_12) 6325 6224 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6326 6225 … … 6331 6230 else 6332 6231 #endif 6333 blend_src_generic<RegularSpans>(count, spans, userData 6334 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6232 blend_src_generic<RegularSpans>(count, spans, userData); 6335 6233 } 6336 6234 6337 6235 template <SpanMethod spanMethod> 6338 Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_tiled_argb(int count, const QSpan *spans, void *userData 6339 Q_TEMPLATE_ENUM_FIX(SpanMethod, spanMethod)) 6236 Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_tiled_argb(int count, const QSpan *spans, void *userData) 6340 6237 { 6341 6238 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6342 6239 if (data->texture.format != QImage::Format_ARGB32_Premultiplied 6343 6240 && data->texture.format != QImage::Format_RGB32) { 6344 blend_src_generic<spanMethod>(count, spans, userData Q_TEMPLATE_ENUM_CALL(SpanMethod, spanMethod));6241 blend_src_generic<spanMethod>(count, spans, userData); 6345 6242 return; 6346 6243 } … … 6476 6373 6477 6374 if (mode != QPainter::CompositionMode_SourceOver) { 6478 blend_src_generic<RegularSpans>(count, spans, userData 6479 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6375 blend_src_generic<RegularSpans>(count, spans, userData); 6480 6376 return; 6481 6377 } … … 6620 6516 void *userData) 6621 6517 { 6622 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_24)6518 #if defined(QT_QWS_DEPTH_24) 6623 6519 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6624 6520 … … 6627 6523 else 6628 6524 #endif 6629 blend_src_generic<RegularSpans>(count, spans, userData 6630 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6525 blend_src_generic<RegularSpans>(count, spans, userData); 6631 6526 } 6632 6527 … … 6634 6529 void *userData) 6635 6530 { 6636 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)6531 #if defined(QT_QWS_DEPTH_18) 6637 6532 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6638 6533 … … 6643 6538 else 6644 6539 #endif 6645 blend_src_generic<RegularSpans>(count, spans, userData 6646 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6540 blend_src_generic<RegularSpans>(count, spans, userData); 6647 6541 } 6648 6542 … … 6650 6544 void *userData) 6651 6545 { 6652 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_18)6546 #if defined(QT_QWS_DEPTH_18) 6653 6547 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6654 6548 … … 6659 6553 else 6660 6554 #endif 6661 blend_src_generic<RegularSpans>(count, spans, userData 6662 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6555 blend_src_generic<RegularSpans>(count, spans, userData); 6663 6556 } 6664 6557 … … 6666 6559 void *userData) 6667 6560 { 6668 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)6561 #if defined(QT_QWS_DEPTH_16) 6669 6562 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6670 6563 … … 6675 6568 else 6676 6569 #endif 6677 blend_src_generic<RegularSpans>(count, spans, userData 6678 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6570 blend_src_generic<RegularSpans>(count, spans, userData); 6679 6571 } 6680 6572 … … 6682 6574 void *userData) 6683 6575 { 6684 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_16)6576 #if defined(QT_QWS_DEPTH_16) 6685 6577 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6686 6578 … … 6691 6583 else 6692 6584 #endif 6693 blend_src_generic<RegularSpans>(count, spans, userData 6694 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6585 blend_src_generic<RegularSpans>(count, spans, userData); 6695 6586 } 6696 6587 … … 6698 6589 void *userData) 6699 6590 { 6700 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)6591 #if defined(QT_QWS_DEPTH_15) 6701 6592 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6702 6593 … … 6707 6598 else 6708 6599 #endif 6709 blend_src_generic<RegularSpans>(count, spans, userData 6710 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6600 blend_src_generic<RegularSpans>(count, spans, userData); 6711 6601 } 6712 6602 … … 6714 6604 void *userData) 6715 6605 { 6716 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_15)6606 #if defined(QT_QWS_DEPTH_15) 6717 6607 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6718 6608 … … 6723 6613 else 6724 6614 #endif 6725 blend_src_generic<RegularSpans>(count, spans, userData 6726 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6615 blend_src_generic<RegularSpans>(count, spans, userData); 6727 6616 } 6728 6617 … … 6730 6619 void *userData) 6731 6620 { 6732 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)6621 #if defined(QT_QWS_DEPTH_12) 6733 6622 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6734 6623 … … 6739 6628 else 6740 6629 #endif 6741 blend_src_generic<RegularSpans>(count, spans, userData 6742 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6630 blend_src_generic<RegularSpans>(count, spans, userData); 6743 6631 } 6744 6632 … … 6746 6634 void *userData) 6747 6635 { 6748 #if !defined(Q_WS_QWS) ||defined(QT_QWS_DEPTH_12)6636 #if defined(QT_QWS_DEPTH_12) 6749 6637 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 6750 6638 … … 6755 6643 else 6756 6644 #endif 6757 blend_src_generic<RegularSpans>(count, spans, userData 6758 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 6759 } 6760 6761 #if defined(Q_CC_MSVC) && _MSC_VER <= 1300 && !defined(Q_CC_INTEL) 6762 6763 // explicit template instantiations needed to compile with VC6 and VC2002 6764 6765 #define SPANFUNC_INSTANTIATION(Name, Arg) \ 6766 static inline void Name##_##Arg(int count, const QSpan *spans, void *userData) \ 6767 { \ 6768 Name<Arg>(count, spans, userData Q_TEMPLATE_ENUM_CALL(SpanMethod, Arg)); \ 6769 } 6770 6771 SPANFUNC_INSTANTIATION(blend_untransformed_generic, RegularSpans); 6772 SPANFUNC_INSTANTIATION(blend_untransformed_argb, RegularSpans); 6773 SPANFUNC_INSTANTIATION(blend_tiled_generic, RegularSpans); 6774 SPANFUNC_INSTANTIATION(blend_tiled_argb, RegularSpans); 6775 SPANFUNC_INSTANTIATION(blend_src_generic, RegularSpans); 6776 SPANFUNC_INSTANTIATION(blend_transformed_argb, RegularSpans); 6777 SPANFUNC_INSTANTIATION(blend_transformed_tiled_argb, RegularSpans); 6778 SPANFUNC_INSTANTIATION(blend_transformed_bilinear_argb, RegularSpans); 6779 SPANFUNC_INSTANTIATION(blend_transformed_bilinear_tiled_argb, RegularSpans); 6780 #undef SPANFUNC_INSTANTIATION 6781 6782 #define SPANFUNC_POINTER(Name, Arg) Name##_##Arg 6783 6784 #else // !VC6 && !VC2002 6645 blend_src_generic<RegularSpans>(count, spans, userData); 6646 } 6647 6785 6648 # define SPANFUNC_POINTER(Name, Arg) Name<Arg> 6786 #endif6787 6649 6788 6650 … … 7151 7013 7152 7014 } else { 7153 blend_src_generic<RegularSpans>(count, spans, userData 7154 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 7015 blend_src_generic<RegularSpans>(count, spans, userData); 7155 7016 } 7156 7017 } … … 7200 7061 7201 7062 } else { 7202 blend_src_generic<RegularSpans>(count, spans, userData 7203 Q_TEMPLATE_ENUM_CALL(SpanMethod, RegularSpans)); 7063 blend_src_generic<RegularSpans>(count, spans, userData); 7204 7064 } 7205 7065 } … … 7260 7120 7261 7121 void qt_build_pow_tables() { 7262 qreal smoothing = 1.7; 7122 qreal smoothing = qreal(1.7); 7123 7124 #ifdef Q_WS_MAC 7125 // decided by testing a few things on an iMac, should probably get this from the 7126 // system... 7127 smoothing = 2.0; 7128 #endif 7263 7129 7264 7130 #ifdef Q_WS_WIN … … 7276 7142 #else 7277 7143 for (int i=0; i<256; ++i) { 7278 qt_pow_rgb_gamma[i] = uchar(qRound( pow(i / 255.0, smoothing) * 255));7279 qt_pow_rgb_invgamma[i] = uchar(qRound( pow(i / 255.0, 1 / smoothing) * 255));7144 qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255)); 7145 qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255)); 7280 7146 } 7281 7147 #endif … … 7284 7150 const qreal gray_gamma = 2.31; 7285 7151 for (int i=0; i<256; ++i) 7286 qt_pow_gamma[i] = uint(qRound( pow(i / 255.0, gray_gamma) * 2047));7152 qt_pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047)); 7287 7153 for (int i=0; i<2048; ++i) 7288 qt_pow_invgamma[i] = uchar(qRound( pow(i / 2047.0, 1 / gray_gamma) * 255));7154 qt_pow_invgamma[i] = uchar(qRound(qPow(i / 2047.0, 1 / gray_gamma) * 255)); 7289 7155 #endif 7290 7156 } … … 7406 7272 { 7407 7273 int ialpha = 255 - coverage; 7408 dest[i] = BYTE_MUL(c, uint(coverage)) + BYTE_MUL(dest[i], ialpha);7274 dest[i] = INTERPOLATE_PIXEL_255(c, coverage, dest[i], ialpha); 7409 7275 } 7410 7276 } … … 7447 7313 { 7448 7314 int ialpha = 255 - coverage; 7449 dest[xp] = BYTE_MUL(c, uint(coverage)) + BYTE_MUL(dest[xp], ialpha);7315 dest[xp] = INTERPOLATE_PIXEL_255(c, coverage, dest[xp], ialpha); 7450 7316 } 7451 7317 } … … 7549 7415 QT_RECTFILL(quint16) 7550 7416 QT_RECTFILL(qargb8565) 7551 QT_RECTFILL(qrgb666) ;7552 QT_RECTFILL(qargb6666) ;7417 QT_RECTFILL(qrgb666) 7418 QT_RECTFILL(qargb6666) 7553 7419 QT_RECTFILL(qrgb555) 7554 7420 QT_RECTFILL(qargb8555) 7555 7421 QT_RECTFILL(qrgb888) 7556 QT_RECTFILL(qrgb444) ;7557 QT_RECTFILL(qargb4444) ;7422 QT_RECTFILL(qrgb444) 7423 QT_RECTFILL(qargb4444) 7558 7424 #undef QT_RECTFILL 7425 7426 inline static void qt_rectfill_nonpremul_quint32(QRasterBuffer *rasterBuffer, 7427 int x, int y, int width, int height, 7428 quint32 color) 7429 { 7430 qt_rectfill<quint32>(reinterpret_cast<quint32 *>(rasterBuffer->buffer()), 7431 INV_PREMUL(color), x, y, width, height, rasterBuffer->bytesPerLine()); 7432 } 7559 7433 7560 7434 … … 7600 7474 qt_alphamapblit_quint32, 7601 7475 qt_alphargbblit_quint32, 7602 qt_rectfill_ quint327476 qt_rectfill_nonpremul_quint32 7603 7477 }, 7604 7478 // Format_ARGB32_Premultiplied … … 7853 7727 SSE2 = 0x20, 7854 7728 CMOV = 0x40, 7855 IWMMXT = 0x80 7729 IWMMXT = 0x80, 7730 NEON = 0x100 7856 7731 }; 7857 7732 … … 7879 7754 static const bool doIWMMXT = !qgetenv("QT_NO_IWMMXT").toInt(); 7880 7755 return doIWMMXT ? IWMMXT : 0; 7756 #elif defined(QT_HAVE_NEON) 7757 static const bool doNEON = !qgetenv("QT_NO_NEON").toInt(); 7758 return doNEON ? NEON : 0; 7881 7759 #else 7882 7760 uint features = 0; … … 8033 7911 } 8034 7912 7913 #if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) 7914 // Move these to qdrawhelper_arm.c when all 7915 // functions are implemented using arm assembly. 7916 static CompositionFunctionSolid qt_functionForModeSolid_ARMv6[numCompositionFunctions] = { 7917 comp_func_solid_SourceOver, 7918 comp_func_solid_DestinationOver, 7919 comp_func_solid_Clear, 7920 comp_func_solid_Source, 7921 comp_func_solid_Destination, 7922 comp_func_solid_SourceIn, 7923 comp_func_solid_DestinationIn, 7924 comp_func_solid_SourceOut, 7925 comp_func_solid_DestinationOut, 7926 comp_func_solid_SourceAtop, 7927 comp_func_solid_DestinationAtop, 7928 comp_func_solid_XOR, 7929 comp_func_solid_Plus, 7930 comp_func_solid_Multiply, 7931 comp_func_solid_Screen, 7932 comp_func_solid_Overlay, 7933 comp_func_solid_Darken, 7934 comp_func_solid_Lighten, 7935 comp_func_solid_ColorDodge, 7936 comp_func_solid_ColorBurn, 7937 comp_func_solid_HardLight, 7938 comp_func_solid_SoftLight, 7939 comp_func_solid_Difference, 7940 comp_func_solid_Exclusion, 7941 rasterop_solid_SourceOrDestination, 7942 rasterop_solid_SourceAndDestination, 7943 rasterop_solid_SourceXorDestination, 7944 rasterop_solid_NotSourceAndNotDestination, 7945 rasterop_solid_NotSourceOrNotDestination, 7946 rasterop_solid_NotSourceXorDestination, 7947 rasterop_solid_NotSource, 7948 rasterop_solid_NotSourceAndDestination, 7949 rasterop_solid_SourceAndNotDestination 7950 }; 7951 7952 static CompositionFunction qt_functionForMode_ARMv6[numCompositionFunctions] = { 7953 comp_func_SourceOver_armv6, 7954 comp_func_DestinationOver, 7955 comp_func_Clear, 7956 comp_func_Source_armv6, 7957 comp_func_Destination, 7958 comp_func_SourceIn, 7959 comp_func_DestinationIn, 7960 comp_func_SourceOut, 7961 comp_func_DestinationOut, 7962 comp_func_SourceAtop, 7963 comp_func_DestinationAtop, 7964 comp_func_XOR, 7965 comp_func_Plus, 7966 comp_func_Multiply, 7967 comp_func_Screen, 7968 comp_func_Overlay, 7969 comp_func_Darken, 7970 comp_func_Lighten, 7971 comp_func_ColorDodge, 7972 comp_func_ColorBurn, 7973 comp_func_HardLight, 7974 comp_func_SoftLight, 7975 comp_func_Difference, 7976 comp_func_Exclusion, 7977 rasterop_SourceOrDestination, 7978 rasterop_SourceAndDestination, 7979 rasterop_SourceXorDestination, 7980 rasterop_NotSourceAndNotDestination, 7981 rasterop_NotSourceOrNotDestination, 7982 rasterop_NotSourceXorDestination, 7983 rasterop_NotSource, 7984 rasterop_NotSourceAndDestination, 7985 rasterop_SourceAndNotDestination 7986 }; 7987 7988 static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userData) 7989 { 7990 QSpanData *data = reinterpret_cast<QSpanData *>(userData); 7991 7992 CompositionFunctionSolid func = qt_functionForModeSolid_ARMv6[data->rasterBuffer->compositionMode]; 7993 while (count--) { 7994 uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x; 7995 func(target, spans->len, data->solid.color, spans->coverage); 7996 ++spans; 7997 } 7998 } 7999 8000 #endif // Q_CC_RVCT && QT_HAVE_ARMV6 8001 8002 8035 8003 void qInitDrawhelperAsm() 8036 8004 { … … 8148 8116 #endif // QT_NO_DEBUG 8149 8117 8118 #if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) 8119 functionForModeAsm = qt_functionForMode_ARMv6; 8120 functionForModeSolidAsm = qt_functionForModeSolid_ARMv6; 8121 8122 qt_memfill32 = qt_memfill32_armv6; 8123 8124 qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_armv6; 8125 8126 qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; 8127 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; 8128 qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; 8129 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; 8130 #elif defined(QT_HAVE_NEON) 8131 if (features & NEON) { 8132 qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; 8133 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; 8134 qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; 8135 qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; 8136 } 8137 #endif 8138 8150 8139 if (functionForModeSolidAsm) { 8151 8140 const int destinationMode = QPainter::CompositionMode_Destination;
Note:
See TracChangeset
for help on using the changeset viewer.