diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qimage_conversions.cpp | 6 | ||||
-rw-r--r-- | src/gui/image/qimage_mips_dspr2.cpp | 20 | ||||
-rw-r--r-- | src/gui/image/qimage_mips_dspr2_asm.S | 92 | ||||
-rw-r--r-- | src/gui/image/qjpeghandler.cpp | 4 | ||||
-rw-r--r-- | src/gui/opengl/qopenglextensions_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 3 | ||||
-rw-r--r-- | src/gui/painting/qpen.cpp | 18 | ||||
-rw-r--r-- | src/gui/painting/qpen.h | 2 | ||||
-rw-r--r-- | src/gui/util/qgridlayoutengine.cpp | 26 | ||||
-rw-r--r-- | src/gui/util/qgridlayoutengine_p.h | 12 |
10 files changed, 164 insertions, 21 deletions
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 629a7c9b69..cf61d2d84b 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -2176,7 +2176,11 @@ void qInitImageConversions() #ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2 extern bool convert_ARGB_to_ARGB_PM_inplace_mips_dspr2(QImageData *data, Qt::ImageConversionFlags); inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_mips_dspr2; - return; + + extern void convert_RGB888_to_RGB32_mips_dspr2(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); + qimage_converter_map[QImage::Format::RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_mips_dspr2; + qimage_converter_map[QImage::Format::RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_mips_dspr2; + qimage_converter_map[QImage::Format::RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_mips_dspr2; #endif } diff --git a/src/gui/image/qimage_mips_dspr2.cpp b/src/gui/image/qimage_mips_dspr2.cpp index a1c40a16df..f61a2262d2 100644 --- a/src/gui/image/qimage_mips_dspr2.cpp +++ b/src/gui/image/qimage_mips_dspr2.cpp @@ -66,4 +66,24 @@ bool convert_ARGB_to_ARGB_PM_inplace_mips_dspr2(QImageData *data, Qt::ImageConve return true; } +extern "C" void qt_convert_rgb888_to_rgb32_mips_dspr2_asm(uint *dst, const uchar *src, int len); + +void convert_RGB888_to_RGB32_mips_dspr2(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_RGB888); + Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const uchar *src_data = (const uchar*) src->data; + quint32 *dest_data = (quint32*) dest->data; + + for (int i = 0; i < src->height; ++i) { + qt_convert_rgb888_to_rgb32_mips_dspr2_asm(dest_data, src_data, src->width); + src_data += src->bytes_per_line; + dest_data = (quint32*) ((uchar*) dest_data + dest->bytes_per_line); + } +} + QT_END_NAMESPACE + diff --git a/src/gui/image/qimage_mips_dspr2_asm.S b/src/gui/image/qimage_mips_dspr2_asm.S index 1f03b72dd4..df626586dc 100644 --- a/src/gui/image/qimage_mips_dspr2_asm.S +++ b/src/gui/image/qimage_mips_dspr2_asm.S @@ -205,3 +205,95 @@ LEAF_MIPS_DSPR2(premultiply_argb_inplace_mips_asm) END(premultiply_argb_inplace_mips_asm) + +LEAF_MIPS_DSPR2(qt_convert_rgb888_to_rgb32_mips_dspr2_asm) +/* + * Parameters: + * a0 - dst *a8r8g8b8 + * a1 - src *r8g8b8 + * a2 - len + * + * R G B r g b R G B r g b R G B r g b . . . -- input + * ------- ------- ------- ------- ------- + * _ R G B _ r g b _ R G B _ r g b _ R G . . -- output + * + * Register usage: + * a2 - tail (len % 4) == (len & 0x3) + * t0 - batches (len / 4) == (len >> 2) + * t1-t7, s1-s3 - temporary + */ + + srl t0, a2, 2 /* batches = len / 4 */ + andi a2, a2, 0x3 /* tail = len % 4 */ + + beqz t0, 5f /* if !batches: tail */ + lui t7, 0xff00 /* [FF 00 00 00] */ + SAVE_REGS_ON_STACK 8, s1, s2, s3, s0, v0, v1 + +1: pref 4, 0 (a1) /* hint: read-streamed */ + pref 5, 0 (a0) /* hint: prepare-write */ + addiu t0, t0, -1 /* batches-- */ + + lbu t1, 0 (a1) /* [__ __ __ R1] */ + lbu t2, 1 (a1) /* [__ __ __ G1] */ + lbu t3, 2 (a1) /* [__ __ __ B1] */ + + lbu t4, 3 (a1) /* [__ __ __ r2] */ + lbu t5, 4 (a1) /* [__ __ __ g2] */ + lbu t6, 5 (a1) /* [__ __ __ b2] */ + + lbu s1, 6 (a1) /* [__ __ __ R3] */ + lbu s2, 7 (a1) /* [__ __ __ G3] */ + lbu s3, 8 (a1) /* [__ __ __ B3] */ + + lbu s0, 9 (a1) /* [__ __ __ r4] */ + lbu v0, 10 (a1) /* [__ __ __ g4] */ + lbu v1, 11 (a1) /* [__ __ __ b4] */ + + append t1, t2, 8 /* [__ __ R1 G1] */ + append t4, t5, 8 /* [__ __ r2 g2] */ + append s1, s2, 8 /* [__ __ R3 G3] */ + append s0, v0, 8 /* [__ __ r4 g4] */ + append t1, t3, 8 /* [__ R1 G1 B1] */ + append t4, t6, 8 /* [__ r2 g2 b2] */ + append s1, s3, 8 /* [__ R3 G4 B3] */ + append s0, v1, 8 /* [__ r4 g4 b4] */ + or t1, t1, t7 /* [FF R1 G1 B1] */ + or t4, t4, t7 /* [FF r2 g2 b2] */ + or s1, s1, t7 /* [FF R3 G3 B3] */ + or s0, s0, t7 /* [FF r4 g4 b4] */ + + sw t1, 0 (a0) + sw t4, 4 (a0) + sw s1, 8 (a0) + sw s0, 12 (a0) + + addiu a1, a1, 12 /* src += 4*3 */ + bnez t0, 1b /* if batches: loop */ + addiu a0, a0, 16 /* dst += 4 */ + + RESTORE_REGS_FROM_STACK 8, s1, s2, s3, s0, v0, v1 + + /* handle remaining "tail" (a2) items */ +5: beqz a2, 0f + lui t0, 0xff00 /* [FF __ __ __] */ + +1: lbu t1, 0 (a1) /* [__ __ __ RR] */ + lbu t2, 1 (a1) /* [__ __ __ GG] */ + lbu t3, 2 (a1) /* [__ __ __ BB] */ + sll t1, t1, 16 /* [__ RR __ __] */ + sll t2, t2, 8 /* [__ __ GG __] */ + or t0, t0, t1 /* [FF RR __ __] */ + or t2, t2, t3 /* [__ __ GG BB] */ + addi a2, a2, -1 /* len-- */ + or t0, t0, t2 /* [FF RR GG BB] */ + addiu a1, a1, 3 /* src += 3 */ + sw t0, 0 (a0) + addiu a0, a0, 4 /* dst++ */ + bnez a2, 1b /* if tail: loop */ + lui t0, 0xff00 /* [FF __ __ __] */ + +0: jr ra + nop + +END(qt_convert_rgb888_to_rgb32_mips_dspr2_asm) diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index 5008b1982b..dfacf34097 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -856,6 +856,7 @@ bool QJpegHandlerPrivate::read(QImage *image) Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, const uchar *src, int len); Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len); +extern "C" void qt_convert_rgb888_to_rgb32_mips_dspr2_asm(quint32 *dst, const uchar *src, int len); QJpegHandler::QJpegHandler() : d(new QJpegHandlerPrivate(this)) @@ -874,6 +875,9 @@ QJpegHandler::QJpegHandler() rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3; } #endif // QT_COMPILER_SUPPORTS_SSSE3 +#if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2) + rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_mips_dspr2_asm; +#endif // QT_COMPILER_SUPPORTS_DSPR2 } QJpegHandler::~QJpegHandler() diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h index 265771ce1b..065cbb0e57 100644 --- a/src/gui/opengl/qopenglextensions_p.h +++ b/src/gui/opengl/qopenglextensions_p.h @@ -106,8 +106,6 @@ public: OpenGLExtensions openGLExtensions(); bool hasOpenGLExtension(QOpenGLExtensions::OpenGLExtension extension) const; - void initializeGLExtensions(); - GLvoid *glMapBuffer(GLenum target, GLenum access); GLboolean glUnmapBuffer(GLenum target); diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index aa2b9bea54..7a29bb87b4 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1644,7 +1644,8 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const if (count == 0) return polys; - QList<QRectF> bounds; + QVector<QRectF> bounds; + bounds.reserve(count); for (int i=0; i<count; ++i) bounds += subpaths.at(i).boundingRect(); diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index c0b3769c2d..b661057f64 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -327,17 +327,29 @@ QPen::QPen(const QBrush &brush, qreal width, Qt::PenStyle s, Qt::PenCapStyle c, QPen::QPen(const QPen &p) { d = p.d; - d->ref.ref(); + if (d) + d->ref.ref(); } /*! + \fn QPen::QPen(QPen &&pen) + \since 5.4 + + Constructs a pen that is moved from the given \a pen. + + The moved-from pen can only be assigned to, copied, or + destroyed. Any other operation (prior to assignment) leads to + undefined behavior. +*/ + +/*! Destroys the pen. */ QPen::~QPen() { - if (!d->ref.deref()) + if (d && !d->ref.deref()) delete d; } @@ -373,7 +385,7 @@ void QPen::detach() QPen &QPen::operator=(const QPen &p) { - qAtomicAssign(d, p.d); + QPen(p).swap(*this); return *this; } diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h index c5144f784f..486f699476 100644 --- a/src/gui/painting/qpen.h +++ b/src/gui/painting/qpen.h @@ -72,6 +72,8 @@ public: QPen &operator=(const QPen &pen); #ifdef Q_COMPILER_RVALUE_REFS + inline QPen(QPen &&other) + : d(other.d) { other.d = 0; } inline QPen &operator=(QPen &&other) { qSwap(d, other.d); return *this; } #endif diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp index 10b4a2ee35..7170477e84 100644 --- a/src/gui/util/qgridlayoutengine.cpp +++ b/src/gui/util/qgridlayoutengine.cpp @@ -983,9 +983,10 @@ void QGridLayoutEngine::invalidate() q_cachedEffectiveFirstRows[Ver] = -1; q_cachedEffectiveLastRows[Hor] = -1; q_cachedEffectiveLastRows[Ver] = -1; - q_totalBoxesValid = false; - q_sizeHintValid[Hor] = false; - q_sizeHintValid[Ver] = false; + + q_totalBoxCachedConstraints[Hor] = NotCached; + q_totalBoxCachedConstraints[Ver] = NotCached; + q_cachedSize = QSizeF(); q_cachedConstraintOrientation = UnknownConstraint; } @@ -1530,7 +1531,11 @@ void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGri const QAbstractLayoutStyleInfo *styleInfo) const { const int o = (orientation == Qt::Vertical ? Ver : Hor); - if (q_sizeHintValid[o] && !colPositions && !colSizes) { + const int cc = columnCount(orientation); + + const qreal constraint = (colPositions && colSizes && hasDynamicConstraint()) ? (colPositions[cc - 1] + colSizes[cc - 1]) : qreal(CachedWithNoConstraint); + qreal &cachedConstraint = q_totalBoxCachedConstraints[o]; + if (cachedConstraint == constraint) { if (totalBox != &q_totalBoxes[o]) *totalBox = q_totalBoxes[o]; return; @@ -1541,10 +1546,10 @@ void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGri rowData->distributeMultiCells(rowInfo); *totalBox = rowData->totalBox(0, rowCount(orientation)); - if (!colPositions && !colSizes) { + if (totalBox != &q_totalBoxes[o]) q_totalBoxes[o] = *totalBox; - q_sizeHintValid[o] = true; - } + + cachedConstraint = constraint; } /** @@ -1593,10 +1598,9 @@ Qt::Orientation QGridLayoutEngine::constraintOrientation() const void QGridLayoutEngine::ensureGeometries(const QSizeF &size, const QAbstractLayoutStyleInfo *styleInfo) const { - if (!styleInfo->hasChanged() && q_totalBoxesValid && q_cachedSize == size) + if (!styleInfo->hasChanged() && q_cachedSize == size) return; - q_totalBoxesValid = true; q_cachedSize = size; q_xx.resize(columnCount()); @@ -1606,7 +1610,7 @@ void QGridLayoutEngine::ensureGeometries(const QSizeF &size, q_descents.resize(rowCount()); if (constraintOrientation() != Qt::Horizontal) { - //We might have items whose width depends on their height + //We might have items whose height depends on their width (HFW) ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo); //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as //constraints to find the row heights @@ -1617,7 +1621,7 @@ void QGridLayoutEngine::ensureGeometries(const QSizeF &size, q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); } else { - //We have items whose height depends on their width + //We have items whose width depends on their height (WFH) ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as //constraints to find the column widths diff --git a/src/gui/util/qgridlayoutengine_p.h b/src/gui/util/qgridlayoutengine_p.h index 9650e7fffe..bbc94bd51f 100644 --- a/src/gui/util/qgridlayoutengine_p.h +++ b/src/gui/util/qgridlayoutengine_p.h @@ -450,15 +450,21 @@ private: mutable int q_cachedEffectiveLastRows[NOrientations]; mutable quint8 q_cachedConstraintOrientation : 3; + // this is useful to cache + mutable QGridLayoutBox q_totalBoxes[NOrientations]; + enum { + NotCached = -2, // Cache is empty. Happens when the engine is invalidated. + CachedWithNoConstraint = -1 // cache has a totalBox without any HFW/WFH constraints. + // >= 0 // cache has a totalBox with this specific constraint. + }; + mutable qreal q_totalBoxCachedConstraints[NOrientations]; // holds the constraint used for the cached totalBox + // Layout item input mutable QGridLayoutRowData q_columnData; mutable QGridLayoutRowData q_rowData; - mutable QGridLayoutBox q_totalBoxes[NOrientations]; // Output mutable QSizeF q_cachedSize; - mutable bool q_totalBoxesValid; - mutable bool q_sizeHintValid[NOrientations]; mutable QVector<qreal> q_xx; mutable QVector<qreal> q_yy; mutable QVector<qreal> q_widths; |