diff options
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/painting.pri | 2 | ||||
-rw-r--r-- | src/gui/painting/qblendfunctions.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qcosmeticstroker.cpp | 12 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 119 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_avx2.cpp | 54 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_p.h | 18 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_sse2.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_sse4.cpp | 79 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_ssse3.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qdrawingprimitive_sse2_p.h | 4 | ||||
-rw-r--r-- | src/gui/painting/qimagescale.cpp | 44 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_blitter.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 12 | ||||
-rw-r--r-- | src/gui/painting/qpaintengineex.cpp | 24 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 13 | ||||
-rw-r--r-- | src/gui/painting/qpainter_p.h | 4 |
16 files changed, 257 insertions, 148 deletions
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 0507cc128f..3010d4052a 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -94,6 +94,8 @@ SOURCES += \ SSE2_SOURCES += painting/qdrawhelper_sse2.cpp SSSE3_SOURCES += painting/qdrawhelper_ssse3.cpp +SSE4_1_SOURCES += painting/qdrawhelper_sse4.cpp +AVX2_SOURCES += painting/qdrawhelper_avx2.cpp !ios { CONFIG += no_clang_integrated_as diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 1564e25016..478fe6564c 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -245,7 +245,7 @@ static void qt_blend_argb32_on_rgb16(uchar *destPixels, int dbpl, } quint16 *dst = (quint16 *) destPixels; - quint32 *src = (quint32 *) srcPixels; + const quint32 *src = (const quint32 *) srcPixels; for (int y=0; y<h; ++y) { for (int x=0; x<w; ++x) { @@ -282,7 +282,7 @@ static void qt_blend_argb32_on_rgb16(uchar *destPixels, int dbpl, } } dst = (quint16 *) (((uchar *) dst) + dbpl); - src = (quint32 *) (((uchar *) src) + sbpl); + src = (const quint32 *) (((const uchar *) src) + sbpl); } } diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 93c95e4a86..f82b098012 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -437,8 +437,9 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal int y = (y1 + 32) >> 6; int ys = (y2 + 32) >> 6; + int round = (xinc > 0) ? 32 : 0; if (y != ys) { - x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; + x += ( ((((y << 6) + round - y1))) * xinc ) >> 6; if (swapped) { lastPixel.x = x >> 16; @@ -468,8 +469,9 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal int x = (x1 + 32) >> 6; int xs = (x2 + 32) >> 6; + int round = (yinc > 0) ? 32 : 0; if (x != xs) { - y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; + y += ( ((((x << 6) + round - x1))) * yinc ) >> 6; if (swapped) { lastPixel.x = x; @@ -762,9 +764,10 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, int y = (y1 + 32) >> 6; int ys = (y2 + 32) >> 6; + int round = (xinc > 0) ? 32 : 0; if (y != ys) { - x += ( ((((y << 6) + 32 - y1))) * xinc ) >> 6; + x += ( ((((y << 6) + round - y1))) * xinc ) >> 6; // calculate first and last pixel and perform dropout control QCosmeticStroker::Point first; @@ -837,9 +840,10 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, int x = (x1 + 32) >> 6; int xs = (x2 + 32) >> 6; + int round = (yinc > 0) ? 32 : 0; if (x != xs) { - y += ( ((((x << 6) + 32 - x1))) * yinc ) >> 6; + y += ( ((((x << 6) + round - x1))) * yinc ) >> 6; // calculate first and last pixel to perform dropout control QCosmeticStroker::Point first; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 04857fb0d6..538389f15f 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -355,24 +355,11 @@ static const uint *QT_FASTCALL convertPassThrough(uint *, const uint *src, int, return src; } -static inline const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) -{ - for (int i = 0; i < count; ++i) - buffer[i] = qPremultiply(src[i]); - return buffer; -} - -#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) && !defined(__SSE4_1__) -QT_FUNCTION_TARGET(SSE4_1) -static const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *layout, const QRgb *clut) +static const uint *QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) { - // Twice as fast autovectorized due to SSE4.1 PMULLD instructions. - return convertARGB32ToARGB32PM(buffer, src, count, layout, clut); + return qt_convertARGB32ToARGB32PM(buffer, src, count); } -#endif - static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) @@ -382,24 +369,12 @@ static const uint *QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, const u return buffer; } -static inline const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count, +static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { - for (int i = 0; i < count; ++i) - buffer[i] = qPremultiply(RGBA2ARGB(src[i])); - return buffer; + return qt_convertRGBA8888ToARGB32PM(buffer, src, count); } -#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) && !defined(__SSE4_1__) -QT_FUNCTION_TARGET(SSE4_1) -static const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *layout, const QRgb *clut) -{ - // Twice as fast autovectorized due to SSE4.1 PMULLD instructions. - return convertRGBA8888ToARGB32PM(buffer, src, count, layout, clut); -} -#endif - static const uint *QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { @@ -424,18 +399,6 @@ static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uin return buffer; } -#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) -QT_FUNCTION_TARGET(SSE4_1) -static const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) -{ - for (int i = 0; i < count; ++i) - buffer[i] = qUnpremultiply_sse4(src[i]); - return buffer; -} -#endif - - static const uint *QT_FASTCALL convertRGBA8888PMFromARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { @@ -452,17 +415,6 @@ static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM(uint *buffer, const u return buffer; } -#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) -QT_FUNCTION_TARGET(SSE4_1) -static const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) -{ - for (int i = 0; i < count; ++i) - buffer[i] = ARGB2RGBA(qUnpremultiply_sse4(src[i])); - return buffer; -} -#endif - static const uint *QT_FASTCALL convertRGBXFromRGB32(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) { @@ -479,17 +431,6 @@ static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint return buffer; } -#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) -QT_FUNCTION_TARGET(SSE4_1) -static const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, - const QPixelLayout *, const QRgb *) -{ - for (int i = 0; i < count; ++i) - buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply_sse4(src[i])); - return buffer; -} -#endif - template<QtPixelOrder PixelOrder> static const uint *QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *) @@ -1454,7 +1395,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c lim -= 3; for (; f < lim; x += 4, f += 4) { // Load 4 pixels from s1, and split the alpha-green and red-blue component - __m128i top = _mm_loadu_si128((__m128i*)((const uint *)(s1)+x)); + __m128i top = _mm_loadu_si128((const __m128i*)((const uint *)(s1)+x)); __m128i topAG = _mm_srli_epi16(top, 8); __m128i topRB = _mm_and_si128(top, colorMask); // Multiplies each colour component by idisty @@ -1462,7 +1403,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c topRB = _mm_mullo_epi16 (topRB, idisty_); // Same for the s2 vector - __m128i bottom = _mm_loadu_si128((__m128i*)((const uint *)(s2)+x)); + __m128i bottom = _mm_loadu_si128((const __m128i*)((const uint *)(s2)+x)); __m128i bottomAG = _mm_srli_epi16(bottom, 8); __m128i bottomRB = _mm_and_si128(bottom, colorMask); bottomAG = _mm_mullo_epi16 (bottomAG, disty_); @@ -4741,7 +4682,7 @@ static void blend_untransformed_argb(int count, const QSpan *spans, void *userDa length = image_width - sx; if (length > 0) { const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; - const uint *src = (uint *)data->texture.scanLine(sy) + sx; + const uint *src = (const uint *)data->texture.scanLine(sy) + sx; uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x; op.func(dest, src, length, coverage); } @@ -4840,7 +4781,7 @@ static void blend_untransformed_rgb565(int count, const QSpan *spans, void *user length = image_width - sx; if (length > 0) { quint16 *dest = (quint16 *)data->rasterBuffer->scanLine(spans->y) + x; - const quint16 *src = (quint16 *)data->texture.scanLine(sy) + sx; + const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx; if (coverage == 255) { memcpy(dest, src, length * sizeof(quint16)); } else { @@ -4939,7 +4880,7 @@ static void blend_tiled_argb(int count, const QSpan *spans, void *userData) int l = qMin(image_width - sx, length); if (buffer_size < l) l = buffer_size; - const uint *src = (uint *)data->texture.scanLine(sy) + sx; + const uint *src = (const uint *)data->texture.scanLine(sy) + sx; uint *dest = ((uint *)data->rasterBuffer->scanLine(spans->y)) + x; op.func(dest, src, l, coverage); x += l; @@ -4998,7 +4939,7 @@ static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) if (buffer_size < l) l = buffer_size; quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + tx; - const quint16 *src = (quint16 *)data->texture.scanLine(sy) + sx; + const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx; memcpy(dest, src, l * sizeof(quint16)); length -= l; tx += l; @@ -5032,7 +4973,7 @@ static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) if (buffer_size < l) l = buffer_size; quint16 *dest = ((quint16 *)data->rasterBuffer->scanLine(spans->y)) + x; - const quint16 *src = (quint16 *)data->texture.scanLine(sy) + sx; + const quint16 *src = (const quint16 *)data->texture.scanLine(sy) + sx; blend_sourceOver_rgb16_rgb16(dest, src, l, alpha, ialpha); x += l; length -= l; @@ -5108,8 +5049,8 @@ static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, voi fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_minx, src_maxx, x1, x2); fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_miny, src_maxy, y1, y2); - const quint16 *src1 = (quint16*)data->texture.scanLine(y1); - const quint16 *src2 = (quint16*)data->texture.scanLine(y2); + const quint16 *src1 = (const quint16*)data->texture.scanLine(y1); + const quint16 *src2 = (const quint16*)data->texture.scanLine(y2); quint16 tl = src1[x1]; const quint16 tr = src1[x2]; quint16 bl = src2[x1]; @@ -5195,8 +5136,8 @@ static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, voi fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_minx, src_maxx, x1, x2); fetchTransformedBilinear_pixelBounds<BlendTransformedBilinear>(0, src_miny, src_maxy, y1, y2); - const quint16 *src1 = (quint16 *)data->texture.scanLine(y1); - const quint16 *src2 = (quint16 *)data->texture.scanLine(y2); + const quint16 *src1 = (const quint16 *)data->texture.scanLine(y1); + const quint16 *src2 = (const quint16 *)data->texture.scanLine(y2); quint16 tl = src1[x1]; const quint16 tr = src1[x2]; quint16 bl = src2[x1]; @@ -5392,7 +5333,7 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, void *userDa const int px = qBound(0, x >> 16, image_width - 1); const int py = qBound(0, y >> 16, image_height - 1); - *b = ((quint16 *)data->texture.scanLine(py))[px]; + *b = ((const quint16 *)data->texture.scanLine(py))[px]; ++b; x += fdx; @@ -5451,7 +5392,7 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, void *userDa const int px = qBound(0, int(tx) - (tx < 0), image_width - 1); const int py = qBound(0, int(ty) - (ty < 0), image_height - 1); - *b = ((quint16 *)data->texture.scanLine(py))[px]; + *b = ((const quint16 *)data->texture.scanLine(py))[px]; ++b; x += fdx; @@ -5495,7 +5436,7 @@ static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *us void *t = data->rasterBuffer->scanLine(spans->y); uint *target = ((uint *)t) + spans->x; - uint *image_bits = (uint *)data->texture.imageData; + const uint *image_bits = (const uint *)data->texture.imageData; const qreal cx = spans->x + qreal(0.5); const qreal cy = spans->y + qreal(0.5); @@ -5550,7 +5491,7 @@ static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *us void *t = data->rasterBuffer->scanLine(spans->y); uint *target = ((uint *)t) + spans->x; - uint *image_bits = (uint *)data->texture.imageData; + const uint *image_bits = (const uint *)data->texture.imageData; const qreal cx = spans->x + qreal(0.5); const qreal cy = spans->y + qreal(0.5); @@ -5661,7 +5602,7 @@ static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void * if (py < 0) py += image_height; - *b = ((quint16 *)data->texture.scanLine(py))[px]; + *b = ((const quint16 *)data->texture.scanLine(py))[px]; ++b; x += fdx; @@ -5727,7 +5668,7 @@ static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void * if (py < 0) py += image_height; - *b = ((quint16 *)data->texture.scanLine(py))[px]; + *b = ((const quint16 *)data->texture.scanLine(py))[px]; ++b; x += fdx; @@ -6793,18 +6734,32 @@ void qInitDrawhelperAsm() } #endif // SSSE3 -#if QT_COMPILER_SUPPORTS_HERE(SSE4_1) +#if QT_COMPILER_SUPPORTS_SSE4_1 if (qCpuHasFeature(SSE4_1)) { #if !defined(__SSE4_1__) + extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); + extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4; qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4; #endif + extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); + extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); + extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4; qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4; qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4; } #endif +#if QT_COMPILER_SUPPORTS_AVX2 && !defined(__AVX2__) + if (qCpuHasFeature(AVX2)) { + extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); + extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); + qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_avx2; + qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_avx2; + } +#endif + functionForModeAsm = qt_functionForMode_SSE2; functionForModeSolidAsm = qt_functionForModeSolid_SSE2; #endif // SSE2 diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp new file mode 100644 index 0000000000..5716be682b --- /dev/null +++ b/src/gui/painting/qdrawhelper_avx2.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <private/qdrawhelper_p.h> + +#if defined(QT_COMPILER_SUPPORTS_AVX2) + +QT_BEGIN_NAMESPACE + +const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + return qt_convertARGB32ToARGB32PM(buffer, src, count); +} + +const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + return qt_convertRGBA8888ToARGB32PM(buffer, src, count); +} + +QT_END_NAMESPACE + +#endif diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 08bc0776f7..480ba4c97b 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -769,7 +769,7 @@ do { \ do { \ /* Duff's device */ \ ushort *_d = (ushort*)(dest); \ - const ushort *_s = (ushort*)(src); \ + const ushort *_s = (const ushort*)(src); \ int n = ((length) + 7) / 8; \ switch ((length) & 0x07) \ { \ @@ -893,6 +893,22 @@ inline int qBlue565(quint16 rgb) { return (b << 3) | (b >> 2); } + +static Q_ALWAYS_INLINE const uint *qt_convertARGB32ToARGB32PM(uint *buffer, const uint *src, int count) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qPremultiply(src[i]); + return buffer; +} + +static Q_ALWAYS_INLINE const uint *qt_convertRGBA8888ToARGB32PM(uint *buffer, const uint *src, int count) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qPremultiply(RGBA2ARGB(src[i])); + return buffer; +} + + const uint qt_bayer_matrix[16][16] = { { 0x1, 0xc0, 0x30, 0xf0, 0xc, 0xcc, 0x3c, 0xfc, 0x3, 0xc3, 0x33, 0xf3, 0xf, 0xcf, 0x3f, 0xff}, diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 93d2d94626..84eb3b7909 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -111,7 +111,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, } for (; x < w-3; x += 4) { - __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); __m128i result; @@ -162,7 +162,7 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin // 2) composition with SSE2 for (; x < length - 3; x += 4) { - const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); const __m128i result = _mm_adds_epu8(srcVector, dstVector); @@ -185,7 +185,7 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); // 2) composition with SSE2 for (; x < length - 3; x += 4) { - const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); __m128i result = _mm_adds_epu8(srcVector, dstVector); @@ -218,7 +218,7 @@ void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, u const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); const __m128i oneMinusConstAlpha = _mm_set1_epi16(ialpha); for (; x < length - 3; x += 4) { - const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); INTERPOLATE_PIXEL_255_SSE2(dstVector, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half) _mm_store_si128((__m128i *)&dst[x], dstVector); diff --git a/src/gui/painting/qdrawhelper_sse4.cpp b/src/gui/painting/qdrawhelper_sse4.cpp new file mode 100644 index 0000000000..43a3958997 --- /dev/null +++ b/src/gui/painting/qdrawhelper_sse4.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <private/qdrawhelper_p.h> +#include <private/qdrawingprimitive_sse2_p.h> + +#if defined(QT_COMPILER_SUPPORTS_SSE4_1) + +QT_BEGIN_NAMESPACE + +const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + return qt_convertARGB32ToARGB32PM(buffer, src, count); +} + +const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + return qt_convertRGBA8888ToARGB32PM(buffer, src, count); +} + +const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qUnpremultiply_sse4(src[i]); + return buffer; +} + +const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = ARGB2RGBA(qUnpremultiply_sse4(src[i])); + return buffer; +} + +const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = ARGB2RGBA(0xff000000 | qUnpremultiply_sse4(src[i])); + return buffer; +} + +QT_END_NAMESPACE + +#endif diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index cb4bd35d33..fff4145d21 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -53,7 +53,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src) */ #define BLENDING_LOOP(palignrOffset, length)\ for (; x-minusOffsetToAlignSrcOn16Bytes < length-7; x += 4) { \ - const __m128i srcVectorLastLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes + 4]);\ + const __m128i srcVectorLastLoaded = _mm_load_si128((const __m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes + 4]);\ const __m128i srcVector = _mm_alignr_epi8(srcVectorLastLoaded, srcVectorPrevLoaded, palignrOffset); \ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ @@ -97,7 +97,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src) See the SSE2 version for more documentation on the algorithm itself. */\ const __m128i alphaShuffleMask = _mm_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);\ for (; x < length-3; x += 4) { \ - const __m128i srcVector = _mm_load_si128((__m128i *)&src[x]); \ + const __m128i srcVector = _mm_load_si128((const __m128i *)&src[x]); \ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ _mm_store_si128((__m128i *)&dst[x], srcVector); \ @@ -113,7 +113,7 @@ inline static void blend_pixel(quint32 &dst, const quint32 src) } /* end for() */\ } else if ((length - x) >= 8) {\ /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\ - __m128i srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ + __m128i srcVectorPrevLoaded = _mm_load_si128((const __m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\ \ const __m128i alphaShuffleMask = _mm_set_epi8(char(0xff),15,char(0xff),15,char(0xff),11,char(0xff),11,char(0xff),7,char(0xff),7,char(0xff),3,char(0xff),3);\ diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h index aded999cdd..4d0790a502 100644 --- a/src/gui/painting/qdrawingprimitive_sse2_p.h +++ b/src/gui/painting/qdrawingprimitive_sse2_p.h @@ -171,7 +171,7 @@ QT_BEGIN_NAMESPACE } \ \ for (; x < length-3; x += 4) { \ - const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ + const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); \ BLEND_SOURCE_OVER_ARGB32_SSE2_helper(dst, srcVector, nullVector, half, one, colorMask, alphaMask) \ } \ for (; x < length; ++x) { \ @@ -207,7 +207,7 @@ QT_BEGIN_NAMESPACE } \ \ for (; x < length-3; x += 4) { \ - __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ + __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); \ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { \ BYTE_MUL_SSE2(srcVector, srcVector, constAlphaVector, colorMask, half); \ \ diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp index 9ae95dff78..58e9112dd6 100644 --- a/src/gui/painting/qimagescale.cpp +++ b/src/gui/painting/qimagescale.cpp @@ -107,12 +107,12 @@ qt_qimageScaleFunc qt_qimageScaleRgb = qt_qimageScaleAARGB; namespace QImageScale { struct QImageScaleInfo { int *xpoints; - unsigned int **ypoints; + const unsigned int **ypoints; int *xapoints, *yapoints; int xup_yup; }; - unsigned int** qimageCalcYPoints(unsigned int *src, int sw, int sh, + const unsigned int** qimageCalcYPoints(const unsigned int *src, int sw, int sh, int dh); int* qimageCalcXPoints(int sw, int dw); int* qimageCalcApoints(int s, int d, int up); @@ -139,10 +139,10 @@ using namespace QImageScale; #define INV_YAP (256 - yapoints[dyy + y]) #define YAP (yapoints[dyy + y]) -unsigned int** QImageScale::qimageCalcYPoints(unsigned int *src, +const unsigned int** QImageScale::qimageCalcYPoints(const unsigned int *src, int sw, int sh, int dh) { - unsigned int **p; + const unsigned int **p; int i, j = 0, rv = 0; qint64 val, inc; @@ -150,7 +150,7 @@ unsigned int** QImageScale::qimageCalcYPoints(unsigned int *src, dh = -dh; rv = 1; } - p = new unsigned int* [dh+1]; + p = new const unsigned int* [dh+1]; int up = qAbs(dh) >= sh; val = up ? 0x8000 * sh / dh - 0x8000 : 0; @@ -161,7 +161,7 @@ unsigned int** QImageScale::qimageCalcYPoints(unsigned int *src, } if(rv){ for(i = dh / 2; --i >= 0; ){ - unsigned int *tmp = p[i]; + const unsigned int *tmp = p[i]; p[i] = p[dh - i - 1]; p[dh - i - 1] = tmp; } @@ -282,7 +282,7 @@ QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img, isi->xpoints = qimageCalcXPoints(img.width(), scw); if(!isi->xpoints) return(qimageFreeScaleInfo(isi)); - isi->ypoints = qimageCalcYPoints((unsigned int *)img.scanLine(0), + isi->ypoints = qimageCalcYPoints((const unsigned int *)img.scanLine(0), img.bytesPerLine() / 4, img.height(), sch); if (!isi->ypoints) return(qimageFreeScaleInfo(isi)); @@ -304,9 +304,10 @@ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, int dxx, int dyy, int dx, int dy, int dw, int dh, int dow, int sow) { - unsigned int *sptr, *dptr; + const unsigned int *sptr; + unsigned int *dptr; int x, y, end; - unsigned int **ypoints = isi->ypoints; + const unsigned int **ypoints = isi->ypoints; int *xpoints = isi->xpoints; int *xapoints = isi->xapoints; int *yapoints = isi->yapoints; @@ -323,7 +324,7 @@ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, for(x = dxx; x < end; x++){ int r, g, b, a; int rr, gg, bb, aa; - unsigned int *pix; + const unsigned int *pix; if(XAP > 0){ pix = ypoints[dyy + y] + xpoints[x]; @@ -374,7 +375,7 @@ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, else{ for(x = dxx; x < end; x++){ int r, g, b, a; - unsigned int *pix; + const unsigned int *pix; if(XAP > 0){ pix = ypoints[dyy + y] + xpoints[x]; @@ -403,7 +404,7 @@ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, else if(isi->xup_yup == 1){ /*\ 'Correct' version, with math units prepared for MMXification \*/ int Cy, j; - unsigned int *pix; + const unsigned int *pix; int r, g, b, a, rr, gg, bb, aa; int yap; @@ -477,7 +478,7 @@ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, else if(isi->xup_yup == 2){ /*\ 'Correct' version, with math units prepared for MMXification \*/ int Cx, j; - unsigned int *pix; + const unsigned int *pix; int r, g, b, a, rr, gg, bb, aa; int xap; @@ -555,7 +556,7 @@ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest, |*| psllw (16 - d), %mmb; pmulh %mmc, %mmb \*/ int Cx, Cy, i, j; - unsigned int *pix; + const unsigned int *pix; int a, r, g, b, ax, rx, gx, bx; int xap, yap; @@ -663,9 +664,10 @@ static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int *dest, int dxx, int dyy, int dx, int dy, int dw, int dh, int dow, int sow) { - unsigned int *sptr, *dptr; + const unsigned int *sptr; + unsigned int *dptr; int x, y, end; - unsigned int **ypoints = isi->ypoints; + const unsigned int **ypoints = isi->ypoints; int *xpoints = isi->xpoints; int *xapoints = isi->xapoints; int *yapoints = isi->yapoints; @@ -682,7 +684,7 @@ static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int *dest, for(x = dxx; x < end; x++){ int r = 0, g = 0, b = 0; int rr = 0, gg = 0, bb = 0; - unsigned int *pix; + const unsigned int *pix; if(XAP > 0){ pix = ypoints[dyy + y] + xpoints[x]; @@ -725,7 +727,7 @@ static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int *dest, else{ for(x = dxx; x < end; x++){ int r = 0, g = 0, b = 0; - unsigned int *pix; + const unsigned int *pix; if(XAP > 0){ pix = ypoints[dyy + y] + xpoints[x]; @@ -751,7 +753,7 @@ static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int *dest, else if(isi->xup_yup == 1){ /*\ 'Correct' version, with math units prepared for MMXification \*/ int Cy, j; - unsigned int *pix; + const unsigned int *pix; int r, g, b, rr, gg, bb; int yap; @@ -816,7 +818,7 @@ static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int *dest, else if(isi->xup_yup == 2){ /*\ 'Correct' version, with math units prepared for MMXification \*/ int Cx, j; - unsigned int *pix; + const unsigned int *pix; int r, g, b, rr, gg, bb; int xap; @@ -882,7 +884,7 @@ static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int *dest, else{ /*\ 'Correct' version, with math units prepared for MMXification \*/ int Cx, Cy, i, j; - unsigned int *pix; + const unsigned int *pix; int r, g, b, rx, gx, bx; int xap, yap; diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 7c33dbe266..a2bab58922 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -531,7 +531,7 @@ void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { Q_D(QBlitterPaintEngine); if (path.shape() == QVectorPath::RectangleHint) { - QRectF rect(((QPointF *) path.points())[0], ((QPointF *) path.points())[2]); + QRectF rect(((const QPointF *) path.points())[0], ((const QPointF *) path.points())[2]); fillRect(rect, brush); } else { d->lock(); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 1a1f63844c..18522cb6d0 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1864,7 +1864,7 @@ void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, Poly } // Compose polygon fill.., - QVectorPath vp((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); + QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); ensureOutlineMapper(); QT_FT_Outline *outline = d->outlineMapper->convertPath(vp); @@ -1889,7 +1889,7 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly #endif Q_ASSERT(pointCount >= 2); - if (mode != PolylineMode && QVectorPath::isRect((qreal *) points, pointCount)) { + if (mode != PolylineMode && QVectorPath::isRect((const qreal *) points, pointCount)) { QRectF r(points[0], points[2]); drawRects(&r, 1); return; @@ -1905,7 +1905,7 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly // Do the outline... if (s->penData.blend) { - QVectorPath vp((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); + QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); if (s->flags.fast_pen) { QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); @@ -1930,7 +1930,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg qDebug() << " - " << points[i]; #endif Q_ASSERT(pointCount >= 2); - if (mode != PolylineMode && QVectorPath::isRect((int *) points, pointCount)) { + if (mode != PolylineMode && QVectorPath::isRect((const int *) points, pointCount)) { QRect r(points[0].x(), points[0].y(), points[2].x() - points[0].x(), @@ -1968,7 +1968,7 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg int count = pointCount * 2; QVarLengthArray<qreal> fpoints(count); for (int i=0; i<count; ++i) - fpoints[i] = ((int *) points)[i]; + fpoints[i] = ((const int *) points)[i]; QVectorPath vp((qreal *) fpoints.data(), pointCount, 0, QVectorPath::polygonFlags(mode)); if (s->flags.fast_pen) { @@ -2695,7 +2695,7 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx scanline += bpl; } } else { // 32-bit alpha... - uint *sl = (uint *) scanline; + const uint *sl = (const uint *) scanline; for (int y = y0; y < y1; ++y) { for (int x = x0; x < x1; ) { // Skip those with 0 coverage diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 1de821e1c4..0f80cd18a0 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -521,23 +521,23 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) while (points < lastPoint) { switch (*types) { case QPainterPath::MoveToElement: { - QPointF pt = (*(QPointF *) points) * state()->matrix; + QPointF pt = (*(const QPointF *) points) * state()->matrix; d->activeStroker->moveTo(pt.x(), pt.y()); points += 2; ++types; break; } case QPainterPath::LineToElement: { - QPointF pt = (*(QPointF *) points) * state()->matrix; + QPointF pt = (*(const QPointF *) points) * state()->matrix; d->activeStroker->lineTo(pt.x(), pt.y()); points += 2; ++types; break; } case QPainterPath::CurveToElement: { - QPointF c1 = ((QPointF *) points)[0] * state()->matrix; - QPointF c2 = ((QPointF *) points)[1] * state()->matrix; - QPointF e = ((QPointF *) points)[2] * state()->matrix; + QPointF c1 = ((const QPointF *) points)[0] * state()->matrix; + QPointF c2 = ((const QPointF *) points)[1] * state()->matrix; + QPointF e = ((const QPointF *) points)[2] * state()->matrix; d->activeStroker->cubicTo(c1.x(), c1.y(), c2.x(), c2.y(), e.x(), e.y()); points += 6; types += 3; @@ -549,16 +549,16 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) } } if (path.hasImplicitClose()) { - QPointF pt = * ((QPointF *) path.points()) * state()->matrix; + QPointF pt = * ((const QPointF *) path.points()) * state()->matrix; d->activeStroker->lineTo(pt.x(), pt.y()); } } else { - QPointF p = ((QPointF *)points)[0] * state()->matrix; + QPointF p = ((const QPointF *)points)[0] * state()->matrix; d->activeStroker->moveTo(p.x(), p.y()); points += 2; while (points < lastPoint) { - QPointF p = ((QPointF *)points)[0] * state()->matrix; + QPointF p = ((const QPointF *)points)[0] * state()->matrix; d->activeStroker->lineTo(p.x(), p.y()); points += 2; } @@ -786,7 +786,7 @@ void QPaintEngineEx::drawLines(const QLine *lines, int lineCount) qreal pts[64]; int count2 = count<<1; for (int i=0; i<count2; ++i) - pts[i] = ((int *) lines)[i]; + pts[i] = ((const int *) lines)[i]; QVectorPath path(pts, count, qpaintengineex_line_types_16, QVectorPath::LinesHint); stroke(path, state()->pen); @@ -802,7 +802,7 @@ void QPaintEngineEx::drawLines(const QLineF *lines, int lineCount) while (elementCount > 0) { int count = qMin(elementCount, 32); - QVectorPath path((qreal *) lines, count, qpaintengineex_line_types_16, + QVectorPath path((const qreal *) lines, count, qpaintengineex_line_types_16, QVectorPath::LinesHint); stroke(path, state()->pen); @@ -906,7 +906,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount) void QPaintEngineEx::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) { - QVectorPath path((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); + QVectorPath path((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); if (mode == PolylineMode) stroke(path, state()->pen); @@ -920,7 +920,7 @@ void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDr QVarLengthArray<qreal> pts(count); for (int i=0; i<count; ++i) - pts[i] = ((int *) points)[i]; + pts[i] = ((const int *) points)[i]; QVectorPath path(pts.data(), pointCount, 0, QVectorPath::polygonFlags(mode)); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index bdbb49ff51..6f00abfc5f 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -4626,7 +4626,7 @@ void QPainter::drawLines(const QPointF *pointPairs, int lineCount) { Q_ASSERT(sizeof(QLineF) == 2*sizeof(QPointF)); - drawLines((QLineF*)pointPairs, lineCount); + drawLines((const QLineF*)pointPairs, lineCount); } /*! @@ -4639,7 +4639,7 @@ void QPainter::drawLines(const QPoint *pointPairs, int lineCount) { Q_ASSERT(sizeof(QLine) == 2*sizeof(QPoint)); - drawLines((QLine*)pointPairs, lineCount); + drawLines((const QLine*)pointPairs, lineCount); } @@ -5565,22 +5565,19 @@ void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition); } - d->drawGlyphs(glyphIndexes, fixedPointPositions.data(), count, font, glyphRun.overline(), - glyphRun.underline(), glyphRun.strikeOut()); + d->drawGlyphs(glyphIndexes, fixedPointPositions.data(), count, fontD->fontEngine, + glyphRun.overline(), glyphRun.underline(), glyphRun.strikeOut()); } void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positions, int glyphCount, - const QRawFont &font, bool overline, bool underline, + QFontEngine *fontEngine, bool overline, bool underline, bool strikeOut) { Q_Q(QPainter); updateState(state); - QRawFontPrivate *fontD = QRawFontPrivate::get(font); - QFontEngine *fontEngine = fontD->fontEngine; - QFixed leftMost; QFixed rightMost; QFixed baseLine; diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index dde01d32fa..7c32dc1694 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -70,7 +70,7 @@ struct DataPtrContainer { void *ptr; }; -inline void *data_ptr(const QTransform &t) { return (DataPtrContainer *) &t; } +inline const void *data_ptr(const QTransform &t) { return (const DataPtrContainer *) &t; } inline bool qtransform_fast_equals(const QTransform &a, const QTransform &b) { return data_ptr(a) == data_ptr(b); } // QPen inline functions... @@ -226,7 +226,7 @@ public: #if !defined(QT_NO_RAWFONT) void drawGlyphs(const quint32 *glyphArray, QFixedPoint *positionArray, int glyphCount, - const QRawFont &font, bool overline = false, bool underline = false, + QFontEngine *fontEngine, bool overline = false, bool underline = false, bool strikeOut = false); #endif |