diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:24:57 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:28:42 +0100 |
commit | a02863234d76abb6c9f289026ae4ea3145924f30 (patch) | |
tree | aef6381d0000a78ba69ac80eb03739b1c8ca5fc3 /src/gui/painting | |
parent | e77b13621f0057374d83a2b884f03dd2e5b7b88c (diff) | |
parent | e4d79e1fdeb6b26ba0b12b578daacf7cd672b960 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
configure
mkspecs/common/wince/qplatformdefs.h
src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
src/plugins/platforms/xcb/qxcbbackingstore.cpp
Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qcosmeticstroker.cpp | 38 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 241 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_mips_dsp.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_neon.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_neon_p.h | 3 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_ssse3.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qpagelayout.cpp | 33 | ||||
-rw-r--r-- | src/gui/painting/qpagesize.cpp | 14 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpathclipper.cpp | 9 | ||||
-rw-r--r-- | src/gui/painting/qpdf.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qpolygon.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qtransform.cpp | 22 |
14 files changed, 218 insertions, 178 deletions
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 5cbcdf83d4..4965762d74 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -68,8 +68,8 @@ static inline uint sourceOver(uint d, uint color) inline static int F16Dot16FixedDiv(int x, int y) { if (qAbs(x) > 0x7fff) - return (((qlonglong)x) << 16) / y; - return (x << 16) / y; + return qlonglong(x) * (1<<16) / y; + return x * (1<<16) / y; } typedef void (*DrawPixel)(QCosmeticStroker *stroker, int x, int y, int coverage); @@ -147,12 +147,14 @@ inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom()) return; - int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; - int lasty = stroker->spans[stroker->current_span-1].y; + if (stroker->current_span > 0) { + const int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; + const int lasty = stroker->spans[stroker->current_span-1].y; - if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { - stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); - stroker->current_span = 0; + if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { + stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); + stroker->current_span = 0; + } } stroker->spans[stroker->current_span].x = ushort(x); @@ -439,14 +441,14 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal qSwap(x1, x2); } int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); - int x = x1 << 10; + int x = x1 * (1<<10); int y = (y1 + 32) >> 6; int ys = (y2 + 32) >> 6; int round = (xinc > 0) ? 32 : 0; if (y != ys) { - x += ( ((((y << 6) + round - y1))) * xinc ) >> 6; + x += ((y * (1<<6)) + round - y1) * xinc >> 6; if (swapped) { lastPixel.x = x >> 16; @@ -478,7 +480,7 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal int round = (yinc > 0) ? 32 : 0; if (x != xs) { - y += ( ((((x << 6) + round - x1))) * yinc ) >> 6; + y += ((x * (1<<6)) + round - x1) * yinc >> 6; if (swapped) { lastPixel.x = x; @@ -757,7 +759,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, dir = QCosmeticStroker::BottomToTop; } int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); - int x = x1 << 10; + int x = x1 * (1<<10); if ((stroker->lastDir ^ QCosmeticStroker::VerticalMask) == dir) caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; @@ -769,7 +771,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, int round = (xinc > 0) ? 32 : 0; if (y != ys) { - x += ( ((((y << 6) + round - y1))) * xinc ) >> 6; + x += ((y * (1<<6)) + round - y1) * xinc >> 6; // calculate first and last pixel and perform dropout control QCosmeticStroker::Point first; @@ -808,7 +810,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, stroker->lastDir = dir; stroker->lastAxisAligned = axisAligned; - Dasher dasher(stroker, swapped, y << 6, ys << 6); + Dasher dasher(stroker, swapped, y * (1<<6), ys * (1<<6)); do { if (dasher.on()) @@ -834,7 +836,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, dir = QCosmeticStroker::RightToLeft; } int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); - int y = y1 << 10; + int y = y1 * (1<<10); if ((stroker->lastDir ^ QCosmeticStroker::HorizontalMask) == dir) caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; @@ -846,7 +848,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, int round = (yinc > 0) ? 32 : 0; if (x != xs) { - y += ( ((((x << 6) + round - x1))) * yinc ) >> 6; + y += ((x * (1<<6)) + round - x1) * yinc >> 6; // calculate first and last pixel to perform dropout control QCosmeticStroker::Point first; @@ -884,7 +886,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, stroker->lastDir = dir; stroker->lastAxisAligned = axisAligned; - Dasher dasher(stroker, swapped, x << 6, xs << 6); + Dasher dasher(stroker, swapped, x * (1<<6), xs * (1<<6)); do { if (dasher.on()) @@ -927,7 +929,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx caps = swapCaps(caps); } - int x = (x1 - 32) << 10; + int x = (x1 - 32) * (1<<10); x -= ( ((y1 & 63) - 32) * xinc ) >> 6; capAdjust(caps, y1, y2, x, xinc); @@ -990,7 +992,7 @@ static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx caps = swapCaps(caps); } - int y = (y1 - 32) << 10; + int y = (y1 - 32) * (1<<10); y -= ( ((x1 & 63) - 32) * yinc ) >> 6; capAdjust(caps, x1, x2, y, yinc); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index f60e49f699..29c3ba3480 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -135,10 +135,20 @@ template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB4444_Premultiplied template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB8555_Premultiplied>() { return 8; } template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB8565_Premultiplied>() { return 8; } template<> Q_DECL_CONSTEXPR uint blueShift<QImage::Format_ARGB6666_Premultiplied>() { return 0; } +template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB16>() { return 0; } +template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB444>() { return 0; } +template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB555>() { return 0; } +template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB666>() { return 0; } +template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_RGB888>() { return 0; } template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; } template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB8555_Premultiplied>() { return 8; } template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB8565_Premultiplied>() { return 8; } template<> Q_DECL_CONSTEXPR uint alphaWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; } +template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB16>() { return 0; } +template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB444>() { return 0; } +template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB555>() { return 0; } +template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB666>() { return 0; } +template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_RGB888>() { return 0; } template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB4444_Premultiplied>() { return 12; } template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB8555_Premultiplied>() { return 0; } template<> Q_DECL_CONSTEXPR uint alphaShift<QImage::Format_ARGB8565_Premultiplied>() { return 0; } @@ -235,17 +245,36 @@ static const uint *QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, const uint Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8; Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8; - for (int i = 0; i < count; ++i) { - uint alpha = (src[i] >> alphaShift<Format>()) & alphaMask; - uint red = (src[i] >> redShift<Format>()) & redMask; - uint green = (src[i] >> greenShift<Format>()) & greenMask; - uint blue = (src[i] >> blueShift<Format>()) & blueMask; - - alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); - red = qMin(alpha, (red << redLeftShift) | (red >> redRightShift)); - green = qMin(alpha, (green << greenLeftShift) | (green >> greenRightShift)); - blue = qMin(alpha, (blue << blueLeftShift) | (blue >> blueRightShift)); - buffer[i] = (alpha << 24) | (red << 16) | (green << 8) | blue; + Q_CONSTEXPR bool mustMin = (alphaWidth<Format>() != redWidth<Format>()) || + (alphaWidth<Format>() != greenWidth<Format>()) || + (alphaWidth<Format>() != blueWidth<Format>()); + + if (mustMin) { + for (int i = 0; i < count; ++i) { + uint alpha = (src[i] >> alphaShift<Format>()) & alphaMask; + uint red = (src[i] >> redShift<Format>()) & redMask; + uint green = (src[i] >> greenShift<Format>()) & greenMask; + uint blue = (src[i] >> blueShift<Format>()) & blueMask; + + alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); + red = qMin(alpha, (red << redLeftShift) | (red >> redRightShift)); + green = qMin(alpha, (green << greenLeftShift) | (green >> greenRightShift)); + blue = qMin(alpha, (blue << blueLeftShift) | (blue >> blueRightShift)); + buffer[i] = (alpha << 24) | (red << 16) | (green << 8) | blue; + } + } else { + for (int i = 0; i < count; ++i) { + uint alpha = (src[i] >> alphaShift<Format>()) & alphaMask; + uint red = (src[i] >> redShift<Format>()) & redMask; + uint green = (src[i] >> greenShift<Format>()) & greenMask; + uint blue = (src[i] >> blueShift<Format>()) & blueMask; + + alpha = ((alpha << alphaLeftShift) | (alpha >> alphaRightShift)) << 24; + red = ((red << redLeftShift) | (red >> redRightShift)) << 16; + green = ((green << greenLeftShift) | (green >> greenRightShift)) << 8; + blue = (blue << blueLeftShift) | (blue >> blueRightShift); + buffer[i] = alpha | red | green | blue; + } } return buffer; @@ -270,108 +299,85 @@ static const QRgba64 *QT_FASTCALL convertARGBPMToARGB64PM(QRgba64 *buffer, const Q_CONSTEXPR uchar greenRightShift = 2 * greenWidth<Format>() - 8; Q_CONSTEXPR uchar blueRightShift = 2 * blueWidth<Format>() - 8; - for (int i = 0; i < count; ++i) { - uint alpha = (src[i] >> alphaShift<Format>()) & alphaMask; - uint red = (src[i] >> redShift<Format>()) & redMask; - uint green = (src[i] >> greenShift<Format>()) & greenMask; - uint blue = (src[i] >> blueShift<Format>()) & blueMask; - - alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); - red = qMin(alpha, (red << redLeftShift) | (red >> redRightShift)); - green = qMin(alpha, (green << greenLeftShift) | (green >> greenRightShift)); - blue = qMin(alpha, (blue << blueLeftShift) | (blue >> blueRightShift)); - buffer[i] = QRgba64::fromRgba(red, green, blue, alpha); + Q_CONSTEXPR bool mustMin = (alphaWidth<Format>() != redWidth<Format>()) || + (alphaWidth<Format>() != greenWidth<Format>()) || + (alphaWidth<Format>() != blueWidth<Format>()); + + if (mustMin) { + for (int i = 0; i < count; ++i) { + uint alpha = (src[i] >> alphaShift<Format>()) & alphaMask; + uint red = (src[i] >> redShift<Format>()) & redMask; + uint green = (src[i] >> greenShift<Format>()) & greenMask; + uint blue = (src[i] >> blueShift<Format>()) & blueMask; + + alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); + red = qMin(alpha, (red << redLeftShift) | (red >> redRightShift)); + green = qMin(alpha, (green << greenLeftShift) | (green >> greenRightShift)); + blue = qMin(alpha, (blue << blueLeftShift) | (blue >> blueRightShift)); + buffer[i] = QRgba64::fromRgba(red, green, blue, alpha); + } + } else { + for (int i = 0; i < count; ++i) { + uint alpha = (src[i] >> alphaShift<Format>()) & alphaMask; + uint red = (src[i] >> redShift<Format>()) & redMask; + uint green = (src[i] >> greenShift<Format>()) & greenMask; + uint blue = (src[i] >> blueShift<Format>()) & blueMask; + + alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); + red = (red << redLeftShift) | (red >> redRightShift); + green = (green << greenLeftShift) | (green >> greenRightShift); + blue = (blue << blueLeftShift) | (blue >> blueRightShift); + buffer[i] = QRgba64::fromRgba(red, green, blue, alpha); + } } return buffer; } -template<QImage::Format Format> +template<QImage::Format Format, bool fromRGB> static const uint *QT_FASTCALL convertRGBFromARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { - Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); - Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); - Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); - - Q_CONSTEXPR uchar redRightShift = 24 - redWidth<Format>(); - Q_CONSTEXPR uchar greenRightShift = 16 - greenWidth<Format>(); - Q_CONSTEXPR uchar blueRightShift = 8 - blueWidth<Format>(); - - for (int i = 0; i < count; ++i) { - const uint color = qUnpremultiply(src[i]); - const uint red = ((color >> redRightShift) & redMask) << redShift<Format>(); - const uint green = ((color >> greenRightShift) & greenMask) << greenShift<Format>(); - const uint blue = ((color >> blueRightShift) & blueMask) << blueShift<Format>(); - buffer[i] = red | green | blue; - } - return buffer; -} - -template<QImage::Format Format> -static const uint *QT_FASTCALL convertRGBFromRGB32(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) -{ - Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); - Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); - Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); - - Q_CONSTEXPR uchar redRightShift = 24 - redWidth<Format>(); - Q_CONSTEXPR uchar greenRightShift = 16 - greenWidth<Format>(); - Q_CONSTEXPR uchar blueRightShift = 8 - blueWidth<Format>(); - - for (int i = 0; i < count; ++i) { - const uint red = ((src[i] >> redRightShift) & redMask) << redShift<Format>(); - const uint green = ((src[i] >> greenRightShift) & greenMask) << greenShift<Format>(); - const uint blue = ((src[i] >> blueRightShift) & blueMask) << blueShift<Format>(); - buffer[i] = red | green | blue; - } - return buffer; -} - -template<QImage::Format Format> -static const uint *QT_FASTCALL convertARGBPMFromRGB32(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) -{ - Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); - Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); - Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); - Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); + Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1); + Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1); + Q_CONSTEXPR uint bMask = ((1 << blueWidth<Format>()) - 1); - Q_CONSTEXPR uchar redRightShift = 24 - redWidth<Format>(); - Q_CONSTEXPR uchar greenRightShift = 16 - greenWidth<Format>(); - Q_CONSTEXPR uchar blueRightShift = 8 - blueWidth<Format>(); + Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>(); + Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>(); + Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>(); for (int i = 0; i < count; ++i) { - Q_CONSTEXPR uint alpha = (0xff & alphaMask) << alphaShift<Format>(); - const uint red = ((src[i] >> redRightShift) & redMask) << redShift<Format>(); - const uint green = ((src[i] >> greenRightShift) & greenMask) << greenShift<Format>(); - const uint blue = ((src[i] >> blueRightShift) & blueMask) << blueShift<Format>(); - buffer[i] = alpha | red | green | blue; + const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]); + const uint r = ((c >> rRightShift) & rMask) << redShift<Format>(); + const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>(); + const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>(); + buffer[i] = r | g | b; } return buffer; } -template<QImage::Format Format> +template<QImage::Format Format, bool fromRGB> static const uint *QT_FASTCALL convertARGBPMFromARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { - Q_CONSTEXPR uint alphaMask = ((1 << alphaWidth<Format>()) - 1); - Q_CONSTEXPR uint redMask = ((1 << redWidth<Format>()) - 1); - Q_CONSTEXPR uint greenMask = ((1 << greenWidth<Format>()) - 1); - Q_CONSTEXPR uint blueMask = ((1 << blueWidth<Format>()) - 1); + Q_CONSTEXPR uint aMask = ((1 << alphaWidth<Format>()) - 1); + Q_CONSTEXPR uint rMask = ((1 << redWidth<Format>()) - 1); + Q_CONSTEXPR uint gMask = ((1 << greenWidth<Format>()) - 1); + Q_CONSTEXPR uint bMask = ((1 << blueWidth<Format>()) - 1); - Q_CONSTEXPR uchar alphaRightShift = 32 - alphaWidth<Format>(); - Q_CONSTEXPR uchar redRightShift = 24 - redWidth<Format>(); - Q_CONSTEXPR uchar greenRightShift = 16 - greenWidth<Format>(); - Q_CONSTEXPR uchar blueRightShift = 8 - blueWidth<Format>(); + Q_CONSTEXPR uchar aRightShift = 32 - alphaWidth<Format>(); + Q_CONSTEXPR uchar rRightShift = 24 - redWidth<Format>(); + Q_CONSTEXPR uchar gRightShift = 16 - greenWidth<Format>(); + Q_CONSTEXPR uchar bRightShift = 8 - blueWidth<Format>(); + Q_CONSTEXPR uint aOpaque = (0xff & aMask) << alphaShift<Format>(); for (int i = 0; i < count; ++i) { - const uint alpha = ((src[i] >> alphaRightShift) & alphaMask) << alphaShift<Format>(); - const uint red = ((src[i] >> redRightShift) & redMask) << redShift<Format>(); - const uint green = ((src[i] >> greenRightShift) & greenMask) << greenShift<Format>(); - const uint blue = ((src[i] >> blueRightShift) & blueMask) << blueShift<Format>(); - buffer[i] = alpha | red | green | blue; + const uint c = src[i]; + const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>()); + const uint r = ((c >> rRightShift) & rMask) << redShift<Format>(); + const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>(); + const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>(); + buffer[i] = a | r | g | b; } return buffer; } @@ -387,8 +393,8 @@ template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixe 0, 0, false, bitsPerPixel<Format>(), convertToRGB32<Format>, - convertRGBFromARGB32PM<Format>, - convertRGBFromRGB32<Format>, + convertRGBFromARGB32PM<Format, false>, + convertRGBFromARGB32PM<Format, true>, convertToRGB64<Format> }; } @@ -402,8 +408,8 @@ template<QImage::Format Format> Q_DECL_CONSTEXPR static inline QPixelLayout pixe uchar(alphaWidth<Format>()), uchar(alphaShift<Format>()), true, bitsPerPixel<Format>(), convertARGBPMToARGB32PM<Format>, - convertARGBPMFromARGB32PM<Format>, - convertARGBPMFromRGB32<Format>, + convertARGBPMFromARGB32PM<Format, false>, + convertARGBPMFromARGB32PM<Format, true>, convertARGBPMToARGB64PM<Format> }; } @@ -881,56 +887,56 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = { #else { 5, 11, 6, 5, 5, 0, 0, 0, false, QPixelLayout::BPP16, convertToRGB32<QImage::Format_RGB16>, - convertRGBFromARGB32PM<QImage::Format_RGB16>, - convertRGBFromRGB32<QImage::Format_RGB16>, + convertRGBFromARGB32PM<QImage::Format_RGB16, false>, + convertRGBFromARGB32PM<QImage::Format_RGB16, true>, convertToRGB64<QImage::Format_RGB16>, }, { 5, 19, 6, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, convertARGBPMToARGB32PM<QImage::Format_ARGB8565_Premultiplied>, - convertARGBPMFromARGB32PM<QImage::Format_ARGB8565_Premultiplied>, - convertARGBPMFromRGB32<QImage::Format_ARGB8565_Premultiplied>, + convertARGBPMFromARGB32PM<QImage::Format_ARGB8565_Premultiplied, false>, + convertARGBPMFromARGB32PM<QImage::Format_ARGB8565_Premultiplied, true>, convertARGBPMToARGB64PM<QImage::Format_ARGB8565_Premultiplied>, }, { 6, 12, 6, 6, 6, 0, 0, 0, false, QPixelLayout::BPP24, convertToRGB32<QImage::Format_RGB666>, - convertRGBFromARGB32PM<QImage::Format_RGB666>, - convertRGBFromRGB32<QImage::Format_RGB666>, + convertRGBFromARGB32PM<QImage::Format_RGB666, false>, + convertRGBFromARGB32PM<QImage::Format_RGB666, true>, convertToRGB64<QImage::Format_RGB666>, }, { 6, 12, 6, 6, 6, 0, 6, 18, true, QPixelLayout::BPP24, convertARGBPMToARGB32PM<QImage::Format_ARGB6666_Premultiplied>, - convertARGBPMFromARGB32PM<QImage::Format_ARGB6666_Premultiplied>, - convertARGBPMFromRGB32<QImage::Format_ARGB6666_Premultiplied>, + convertARGBPMFromARGB32PM<QImage::Format_ARGB6666_Premultiplied, false>, + convertARGBPMFromARGB32PM<QImage::Format_ARGB6666_Premultiplied, true>, convertARGBPMToARGB64PM<QImage::Format_ARGB6666_Premultiplied>, }, { 5, 10, 5, 5, 5, 0, 0, 0, false, QPixelLayout::BPP16, convertToRGB32<QImage::Format_RGB555>, - convertRGBFromARGB32PM<QImage::Format_RGB555>, - convertRGBFromRGB32<QImage::Format_RGB555>, + convertRGBFromARGB32PM<QImage::Format_RGB555, false>, + convertRGBFromARGB32PM<QImage::Format_RGB555, true>, convertToRGB64<QImage::Format_RGB555>, }, { 5, 18, 5, 13, 5, 8, 8, 0, true, QPixelLayout::BPP24, convertARGBPMToARGB32PM<QImage::Format_ARGB8555_Premultiplied>, - convertARGBPMFromARGB32PM<QImage::Format_ARGB8555_Premultiplied>, - convertARGBPMFromRGB32<QImage::Format_ARGB8555_Premultiplied>, + convertARGBPMFromARGB32PM<QImage::Format_ARGB8555_Premultiplied, false>, + convertARGBPMFromARGB32PM<QImage::Format_ARGB8555_Premultiplied, true>, convertARGBPMToARGB64PM<QImage::Format_ARGB8555_Premultiplied>, }, { 8, 16, 8, 8, 8, 0, 0, 0, false, QPixelLayout::BPP24, convertToRGB32<QImage::Format_RGB888>, - convertRGBFromARGB32PM<QImage::Format_RGB888>, - convertRGBFromRGB32<QImage::Format_RGB888>, + convertRGBFromARGB32PM<QImage::Format_RGB888, false>, + convertRGBFromARGB32PM<QImage::Format_RGB888, true>, convertToRGB64<QImage::Format_RGB888>, }, { 4, 8, 4, 4, 4, 0, 0, 0, false, QPixelLayout::BPP16, convertToRGB32<QImage::Format_RGB444>, - convertRGBFromARGB32PM<QImage::Format_RGB444>, - convertRGBFromRGB32<QImage::Format_RGB444>, + convertRGBFromARGB32PM<QImage::Format_RGB444, false>, + convertRGBFromARGB32PM<QImage::Format_RGB444, true>, convertToRGB64<QImage::Format_RGB444>, }, { 4, 8, 4, 4, 4, 0, 4, 12, true, QPixelLayout::BPP16, convertARGBPMToARGB32PM<QImage::Format_ARGB4444_Premultiplied>, - convertARGBPMFromARGB32PM<QImage::Format_ARGB4444_Premultiplied>, - convertARGBPMFromRGB32<QImage::Format_ARGB4444_Premultiplied>, + convertARGBPMFromARGB32PM<QImage::Format_ARGB4444_Premultiplied, false>, + convertARGBPMFromARGB32PM<QImage::Format_ARGB4444_Premultiplied, true>, convertARGBPMToARGB64PM<QImage::Format_ARGB4444_Premultiplied>, }, #endif @@ -6376,11 +6382,15 @@ static void qInitDrawhelperFunctions() int const_alpha); extern void QT_FASTCALL storePixelsBPP24_ssse3(uchar *dest, const uint *src, int index, int count); + extern const uint * QT_FASTCALL qt_fetchUntransformed_888_ssse3(uint *buffer, const Operator *, const QSpanData *data, + int y, int x, int length); qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3; qStorePixels[QPixelLayout::BPP24] = storePixelsBPP24_ssse3; + sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_ssse3; + sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_ssse3; } #endif // SSSE3 @@ -6443,6 +6453,9 @@ static void qInitDrawhelperFunctions() qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon; + sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_neon; + sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_neon; + #if defined(ENABLE_PIXMAN_DRAWHELPERS) // The RGB16 helpers are using Arm32 assemblythat has not been ported to AArch64 qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp index 81ae0f43ba..b72ca3da3d 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp.cpp +++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp @@ -495,7 +495,7 @@ void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int l const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 3; fetchUntransformed_888_asm_mips_dsp(buffer, line, length); return buffer; } @@ -503,7 +503,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 2; fetchUntransformed_444_asm_mips_dsp(buffer, line, length); return buffer; } @@ -511,7 +511,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 3; fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length); return buffer; } diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index 7dbfa4fa9c..f5b794ace6 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -1061,6 +1061,16 @@ const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Opera return qt_fetch_radial_gradient_template<QRadialFetchSimd<QSimdNeon>,uint>(buffer, op, data, y, x, length); } +extern void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, const uchar *src, int len); + +const uint * QT_FASTCALL qt_fetchUntransformed_888_neon(uint *buffer, const Operator *, const QSpanData *data, + int y, int x, int length) +{ + const uchar *line = data->texture.scanLine(y) + x * 3; + qt_convert_rgb888_to_rgb32_neon(buffer, line, length); + return buffer; +} + QT_END_NAMESPACE #endif // __ARM_NEON__ diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h index 0134960fa1..3cf949fc32 100644 --- a/src/gui/painting/qdrawhelper_neon_p.h +++ b/src/gui/painting/qdrawhelper_neon_p.h @@ -137,6 +137,9 @@ void QT_FASTCALL qt_destStoreRGB16_neon(QRasterBuffer *rasterBuffer, void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, uint color, uint const_alpha); void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uint const_alpha); +const uint * QT_FASTCALL qt_fetchUntransformed_888_neon(uint *buffer, const Operator *, const QSpanData *data, + int y, int x, int length); + #endif // __ARM_NEON__ QT_END_NAMESPACE diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index e0d1bac6b1..7cd3e9ca1b 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -233,6 +233,16 @@ void QT_FASTCALL storePixelsBPP24_ssse3(uchar *dest, const uint *src, int index, store_uint24_ssse3(dest + index * 3, src, count); } +extern void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len); + +const uint * QT_FASTCALL qt_fetchUntransformed_888_ssse3(uint *buffer, const Operator *, const QSpanData *data, + int y, int x, int length) +{ + const uchar *line = data->texture.scanLine(y) + x * 3; + qt_convert_rgb888_to_rgb32_ssse3(buffer, line, length); + return buffer; +} + QT_END_NAMESPACE #endif // QT_COMPILER_SUPPORTS_SSSE3 diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp index 317e6d241a..f3f7f5f956 100644 --- a/src/gui/painting/qpagelayout.cpp +++ b/src/gui/painting/qpagelayout.cpp @@ -949,40 +949,37 @@ QRect QPageLayout::paintRectPixels(int resolution) const QDebug operator<<(QDebug dbg, const QPageLayout &layout) { QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg.noquote(); + dbg << "QPageLayout("; if (layout.isValid()) { - QString output = QStringLiteral("QPageLayout(%1, %2, l:%3 r:%4 t:%5 b:%6 %7)"); - QString units; + const QMarginsF margins = layout.margins(); + dbg << '"' << layout.pageSize().name() << "\", " + << (layout.orientation() == QPageLayout::Portrait ? "Portrait" : "Landscape") + << ", l:" << margins.left() << " r:" << margins.right() << " t:" + << margins.top() << " b:" << margins.bottom() << ' '; switch (layout.units()) { case QPageLayout::Millimeter: - units = QStringLiteral("mm"); + dbg << "mm"; break; case QPageLayout::Point: - units = QStringLiteral("pt"); + dbg << "pt"; break; case QPageLayout::Inch: - units = QStringLiteral("in"); + dbg << "in"; break; case QPageLayout::Pica: - units = QStringLiteral("pc"); + dbg << "pc"; break; case QPageLayout::Didot: - units = QStringLiteral("DD"); + dbg << "DD"; break; case QPageLayout::Cicero: - units = QStringLiteral("CC"); + dbg << "CC"; break; } - output = output.arg(layout.pageSize().name()) - .arg(layout.orientation() == QPageLayout::Portrait ? QStringLiteral("Portrait") : QStringLiteral("Landscape")) - .arg(layout.margins().left()) - .arg(layout.margins().right()) - .arg(layout.margins().top()) - .arg(layout.margins().bottom()) - .arg(units); - dbg.nospace() << output; - } else { - dbg.nospace() << "QPageLayout()"; } + dbg << ')'; return dbg; } #endif diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index c5a2e7288b..f53285d9cb 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -1861,17 +1861,17 @@ QSize QPageSize::sizePixels(PageSizeId pageSizeId, int resolution) QDebug operator<<(QDebug dbg, const QPageSize &pageSize) { QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg.noquote(); + dbg << "QPageSize("; if (pageSize.isValid()) { - QString output = QStringLiteral("QPageSize(\"%1\", \"%2\", %3x%4pt, %5)"); - output = output.arg(pageSize.name()) - .arg(pageSize.key()) - .arg(pageSize.sizePoints().width()) - .arg(pageSize.sizePoints().height()) - .arg(pageSize.id()); - dbg.nospace() << output; + dbg << '"' << pageSize.name() << "\", key=\"" << pageSize.key() + << "\", " << pageSize.sizePoints().width() << 'x' + << pageSize.sizePoints().height() << "pt, id=" << pageSize.id(); } else { dbg.nospace() << "QPageSize()"; } + dbg << ')'; return dbg; } #endif diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 51a46e4ee9..00dc4ccb81 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1163,7 +1163,7 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) if (s->matrix.type() <= QTransform::TxScale && path.isRect()) { #ifdef QT_DEBUG_DRAW - qDebug() << " --- optimizing vector clip to rect clip..."; + qDebug(" --- optimizing vector clip to rect clip..."); #endif const qreal *points = path.points(); QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]); diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index 8513e6d407..882918fc87 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -230,6 +230,7 @@ private: #endif }; +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QPainterPath) Q_DECLARE_TYPEINFO(QPainterPath::Element, Q_PRIMITIVE_TYPE); #ifndef QT_NO_DATASTREAM diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index cdc9838dbe..48ae3cfc80 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -258,8 +258,6 @@ class SegmentTree public: SegmentTree(QPathSegments &segments); - QRectF boundingRect() const; - void produceIntersections(int segment); private: @@ -310,12 +308,6 @@ SegmentTree::SegmentTree(QPathSegments &segments) m_tree[0] = root; } -QRectF SegmentTree::boundingRect() const -{ - return QRectF(QPointF(m_bounds.x1, m_bounds.y1), - QPointF(m_bounds.x2, m_bounds.y2)); -} - static inline qreal coordinate(const QPointF &pos, int axis) { return axis == 0 ? pos.x() : pos.y(); @@ -1761,6 +1753,7 @@ struct QCrossingEdge return x < edge.x; } }; +Q_DECLARE_TYPEINFO(QCrossingEdge, Q_PRIMITIVE_TYPE); static bool bool_op(bool a, bool b, QPathClipper::Operation op) { diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 5ac5ad06a8..86f176bc99 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1950,7 +1950,7 @@ int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, xprintf("/Interpolate true\n"); int len = 0; if (dct) { - //qDebug() << "DCT"; + //qDebug("DCT"); xprintf("/Filter /DCTDecode\n>>\nstream\n"); write(data); len = data.length(); @@ -1975,6 +1975,7 @@ struct QGradientBound { int function; bool reverse; }; +Q_DECLARE_TYPEINFO(QGradientBound, Q_PRIMITIVE_TYPE); int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from, int to, bool reflect, bool alpha) { @@ -2213,7 +2214,7 @@ int QPdfEnginePrivate::generateGradientShader(const QGradient *gradient, const Q return generateRadialGradientShader(static_cast<const QRadialGradient *>(gradient), matrix, alpha); case QGradient::ConicalGradient: default: - qWarning() << "Implement me!"; + qWarning("Implement me!"); } return 0; } diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h index 7b77ee5014..23bdd1933f 100644 --- a/src/gui/painting/qpolygon.h +++ b/src/gui/painting/qpolygon.h @@ -98,6 +98,7 @@ public: QPolygon intersected(const QPolygon &r) const Q_REQUIRED_RESULT; QPolygon subtracted(const QPolygon &r) const Q_REQUIRED_RESULT; }; +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QPolygon) inline QPolygon::QPolygon(int asize) : QVector<QPoint>(asize) {} @@ -174,6 +175,7 @@ public: QPolygonF intersected(const QPolygonF &r) const Q_REQUIRED_RESULT; QPolygonF subtracted(const QPolygonF &r) const Q_REQUIRED_RESULT; }; +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QPolygonF) inline QPolygonF::QPolygonF(int asize) : QVector<QPointF>(asize) {} diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index a0596d1a07..6058811176 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -53,6 +53,14 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_DEBUG +Q_NEVER_INLINE +static void nanWarning(const char *func) +{ + qWarning("QTransform::%s with NaN called", func); +} +#endif // QT_NO_DEBUG + #define Q_NEAR_CLIP (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) #ifdef MAP @@ -418,7 +426,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy) return *this; #ifndef QT_NO_DEBUG if (qIsNaN(dx) | qIsNaN(dy)) { - qWarning() << "QTransform::translate with NaN called"; + nanWarning("translate"); return *this; } #endif @@ -461,7 +469,7 @@ QTransform QTransform::fromTranslate(qreal dx, qreal dy) { #ifndef QT_NO_DEBUG if (qIsNaN(dx) | qIsNaN(dy)) { - qWarning() << "QTransform::fromTranslate with NaN called"; + nanWarning("fromTranslate"); return QTransform(); } #endif @@ -486,7 +494,7 @@ QTransform & QTransform::scale(qreal sx, qreal sy) return *this; #ifndef QT_NO_DEBUG if (qIsNaN(sx) | qIsNaN(sy)) { - qWarning() << "QTransform::scale with NaN called"; + nanWarning("scale"); return *this; } #endif @@ -527,7 +535,7 @@ QTransform QTransform::fromScale(qreal sx, qreal sy) { #ifndef QT_NO_DEBUG if (qIsNaN(sx) | qIsNaN(sy)) { - qWarning() << "QTransform::fromScale with NaN called"; + nanWarning("fromScale"); return QTransform(); } #endif @@ -552,7 +560,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv) return *this; #ifndef QT_NO_DEBUG if (qIsNaN(sh) | qIsNaN(sv)) { - qWarning() << "QTransform::shear with NaN called"; + nanWarning("shear"); return *this; } #endif @@ -613,7 +621,7 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis) return *this; #ifndef QT_NO_DEBUG if (qIsNaN(a)) { - qWarning() << "QTransform::rotate with NaN called"; + nanWarning("rotate"); return *this; } #endif @@ -704,7 +712,7 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis) { #ifndef QT_NO_DEBUG if (qIsNaN(a)) { - qWarning() << "QTransform::rotateRadians with NaN called"; + nanWarning("rotateRadians"); return *this; } #endif |