diff options
author | David Boddie <david.boddie@nokia.com> | 2010-10-20 16:34:45 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2010-10-20 16:34:45 (GMT) |
commit | e4b0fe70c6435bb860df526d615dfdf53dfb5abd (patch) | |
tree | bfe3dd860c1fa2f7df3c79cfd970c10c2133dac2 /src/gui | |
parent | 2ebbfad45ca02ee4e623e592621231d33f1032e5 (diff) | |
parent | c849ddd06371e5a6455c63d67a14171ac06bf9d4 (diff) | |
download | Qt-e4b0fe70c6435bb860df526d615dfdf53dfb5abd.zip Qt-e4b0fe70c6435bb860df526d615dfdf53dfb5abd.tar.gz Qt-e4b0fe70c6435bb860df526d615dfdf53dfb5abd.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-doc-team into 4.7
Diffstat (limited to 'src/gui')
22 files changed, 724 insertions, 1103 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e63acac..2b6aaf5 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3706,6 +3706,8 @@ void QGraphicsItem::setPos(const QPointF &pos) d_ptr->setPosHelper(pos); if (d_ptr->isWidget) static_cast<QGraphicsWidget *>(this)->d_func()->setGeometryFromSetPos(); + if (d_ptr->scenePosDescendants) + d_ptr->sendScenePosChange(); return; } @@ -4388,8 +4390,10 @@ void QGraphicsItem::setTransform(const QTransform &matrix, bool combine) return; // Update and set the new transformation. - if (!(d_ptr->flags & ItemSendsGeometryChanges)) { + if (!(d_ptr->flags & (ItemSendsGeometryChanges | ItemSendsScenePositionChanges))) { d_ptr->setTransformHelper(newTransform); + if (d_ptr->scenePosDescendants) + d_ptr->sendScenePosChange(); return; } diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index ad4b2b5..e43f7fa 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -48,6 +48,7 @@ #include "qgraphicslayoutitem.h" #include "qgraphicslayoutitem_p.h" #include "qwidget.h" +#include "qgraphicswidget.h" #include <QtDebug> @@ -259,6 +260,52 @@ void QGraphicsLayoutItemPrivate::setSizeComponent( q->updateGeometry(); } + +bool QGraphicsLayoutItemPrivate::hasHeightForWidth() const +{ + Q_Q(const QGraphicsLayoutItem); + if (isLayout) { + const QGraphicsLayout *l = static_cast<const QGraphicsLayout *>(q); + for (int i = l->count() - 1; i >= 0; --i) { + if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasHeightForWidth()) + return true; + } + } else if (QGraphicsItem *item = q->graphicsItem()) { + if (item->isWidget()) { + QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); + if (w->layout()) { + return QGraphicsLayoutItemPrivate::get(w->layout())->hasHeightForWidth(); + } + } + } + return q->sizePolicy().hasHeightForWidth(); +} + +bool QGraphicsLayoutItemPrivate::hasWidthForHeight() const +{ + // enable this code when we add QSizePolicy::hasWidthForHeight() (For 4.8) +#if 1 + return false; +#else + Q_Q(const QGraphicsLayoutItem); + if (isLayout) { + const QGraphicsLayout *l = static_cast<const QGraphicsLayout *>(q); + for (int i = l->count() - 1; i >= 0; --i) { + if (QGraphicsLayoutItemPrivate::get(l->itemAt(i))->hasWidthForHeight()) + return true; + } + } else if (QGraphicsItem *item = q->graphicsItem()) { + if (item->isWidget()) { + QGraphicsWidget *w = static_cast<QGraphicsWidget *>(item); + if (w->layout()) { + return QGraphicsLayoutItemPrivate::get(w->layout())->hasWidthForHeight(); + } + } + } + return q->sizePolicy().hasWidthForHeight(); +#endif +} + /*! \class QGraphicsLayoutItem \brief The QGraphicsLayoutItem class can be inherited to allow your custom diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/gui/graphicsview/qgraphicslayoutitem_p.h index 15cc7a5..b752e03 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem_p.h +++ b/src/gui/graphicsview/qgraphicslayoutitem_p.h @@ -65,6 +65,9 @@ class Q_AUTOTEST_EXPORT QGraphicsLayoutItemPrivate public: virtual ~QGraphicsLayoutItemPrivate(); QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *parent, bool isLayout); + static QGraphicsLayoutItemPrivate *get(QGraphicsLayoutItem *q) { return q->d_func();} + static const QGraphicsLayoutItemPrivate *get(const QGraphicsLayoutItem *q) { return q->d_func();} + void init(); QSizeF *effectiveSizeHints(const QSizeF &constraint) const; QGraphicsItem *parentItem() const; @@ -73,6 +76,9 @@ public: enum SizeComponent { Width, Height }; void setSizeComponent(Qt::SizeHint which, SizeComponent component, qreal value); + bool hasHeightForWidth() const; + bool hasWidthForHeight() const; + QSizePolicy sizePolicy; QGraphicsLayoutItem *parent; diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp index ae5bf90..e486b4d 100644 --- a/src/gui/graphicsview/qgridlayoutengine.cpp +++ b/src/gui/graphicsview/qgridlayoutengine.cpp @@ -545,6 +545,24 @@ QSizePolicy::Policy QGridLayoutItem::sizePolicy(Qt::Orientation orientation) con : sizePolicy.verticalPolicy(); } +/* + returns true if the size policy returns true for either hasHeightForWidth() + or hasWidthForHeight() + */ +bool QGridLayoutItem::hasDynamicConstraint() const +{ + return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() + || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); +} + +Qt::Orientation QGridLayoutItem::dynamicConstraintOrientation() const +{ + if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()) + return Qt::Vertical; + else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight()) + return Qt::Horizontal; +} + QSizePolicy::ControlTypes QGridLayoutItem::controlTypes(LayoutSide /* side */) const { return q_layoutItem->sizePolicy().controlType(); @@ -613,7 +631,17 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig qreal cellWidth = width; qreal cellHeight = height; - QSizeF size = effectiveMaxSize().boundedTo(QSizeF(cellWidth, cellHeight)); + + QSizeF size = effectiveMaxSize(QSizeF(-1,-1)); + if (hasDynamicConstraint()) { + if (dynamicConstraintOrientation() == Qt::Vertical) { + if (size.width() > cellWidth) + size = effectiveMaxSize(QSizeF(cellWidth, -1)); + } else if(size.height() > cellHeight) { + size = effectiveMaxSize(QSizeF(-1, cellHeight)); + } + } + size = size.boundedTo(QSizeF(cellWidth, cellHeight)); width = size.width(); height = size.height(); @@ -675,13 +703,13 @@ void QGridLayoutItem::insertOrRemoveRows(int row, int delta, Qt::Orientation ori Note that effectiveSizeHint does not take sizePolicy into consideration, (since it only evaluates the hints, as the name implies) */ -QSizeF QGridLayoutItem::effectiveMaxSize() const +QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const { - QSizeF size; + QSizeF size = constraint; bool vGrow = (sizePolicy(Qt::Vertical) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; bool hGrow = (sizePolicy(Qt::Horizontal) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; if (!vGrow || !hGrow) { - QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize); + QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize, constraint); if (!vGrow) size.setHeight(pref.height()); if (!hGrow) @@ -689,7 +717,7 @@ QSizeF QGridLayoutItem::effectiveMaxSize() const } if (!size.isValid()) { - QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize); + QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, size); if (size.width() == -1) size.setWidth(maxSize.width()); if (size.height() == -1) @@ -1010,6 +1038,7 @@ void QGridLayoutEngine::invalidate() q_cachedEffectiveLastRows[Ver] = -1; q_cachedDataForStyleInfo.invalidate(); q_cachedSize = QSizeF(); + q_cachedConstraintOrientation = UnknownConstraint; } static void visualRect(QRectF *geom, Qt::LayoutDirection dir, const QRectF &contentsRect) @@ -1074,19 +1103,78 @@ QRectF QGridLayoutEngine::cellRect(const QLayoutStyleInfo &styleInfo, } QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, - const QSizeF & /* constraint */) const + const QSizeF &constraint) const { - ensureColumnAndRowData(styleInfo); + QGridLayoutBox sizehint_totalBoxes[NOrientations]; + + if(rowCount() < 1 || columnCount() < 1 || !hasDynamicConstraint()) { + //No items with height for width, so it doesn't matter which order we do these in + if(q_cachedDataForStyleInfo != styleInfo) { + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + } else { + sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; + sizehint_totalBoxes[Ver] = q_totalBoxes[Ver]; + } + } else if(constraintOrientation() == Qt::Vertical) { + //We have items whose width depends on their height + if(q_cachedDataForStyleInfo != styleInfo) + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + else + sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; + QVector<qreal> sizehint_xx; + QVector<qreal> sizehint_widths; + + sizehint_xx.resize(columnCount()); + sizehint_widths.resize(columnCount()); + qreal width = constraint.width(); + if(width < 0) { + /* It's not obvious what the behaviour should be. */ +/* if(which == Qt::MaximumSize) + width = sizehint_totalBoxes[Hor].q_maximumSize; + else if(which == Qt::MinimumSize) + width = sizehint_totalBoxes[Hor].q_minimumSize; + else*/ + width = sizehint_totalBoxes[Hor].q_preferredSize; + } + //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 + q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), + 0, sizehint_totalBoxes[Hor]); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical); + } else { + //We have items whose height depends on their width + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + QVector<qreal> sizehint_yy; + QVector<qreal> sizehint_heights; + + sizehint_yy.resize(rowCount()); + sizehint_heights.resize(rowCount()); + qreal height = constraint.height(); + if(height < 0) { +/* if(which == Qt::MaximumSize) + height = sizehint_totalBoxes[Ver].q_maximumSize; + else if(which == Qt::MinimumSize) + height = sizehint_totalBoxes[Ver].q_minimumSize; + else*/ + height = sizehint_totalBoxes[Ver].q_preferredSize; + } + //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 + q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), + 0, sizehint_totalBoxes[Ver]); + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Vertical); + } switch (which) { case Qt::MinimumSize: - return QSizeF(q_totalBoxes[Hor].q_minimumSize, q_totalBoxes[Ver].q_minimumSize); + return QSizeF(sizehint_totalBoxes[Hor].q_minimumSize, sizehint_totalBoxes[Ver].q_minimumSize); case Qt::PreferredSize: - return QSizeF(q_totalBoxes[Hor].q_preferredSize, q_totalBoxes[Ver].q_preferredSize); + return QSizeF(sizehint_totalBoxes[Hor].q_preferredSize, sizehint_totalBoxes[Ver].q_preferredSize); case Qt::MaximumSize: - return QSizeF(q_totalBoxes[Hor].q_maximumSize, q_totalBoxes[Ver].q_maximumSize); + return QSizeF(sizehint_totalBoxes[Hor].q_maximumSize, sizehint_totalBoxes[Ver].q_maximumSize); case Qt::MinimumDescent: - return QSizeF(-1.0, q_totalBoxes[Hor].q_minimumDescent); // ### doesn't work + return QSizeF(-1.0, sizehint_totalBoxes[Hor].q_minimumDescent); // ### doesn't work default: break; } @@ -1262,6 +1350,7 @@ void QGridLayoutEngine::insertOrRemoveRows(int row, int delta, Qt::Orientation o } void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutStyleInfo &styleInfo, + qreal *colPositions, qreal *colSizes, Qt::Orientation orientation) const { const int ButtonMask = QSizePolicy::ButtonBox | QSizePolicy::PushButton; @@ -1375,7 +1464,21 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt box = &multiCell.q_box; multiCell.q_stretch = itemStretch; } - box->combine(item->box(orientation)); + // Items with constraints need to be passed the constraint + if (colSizes && colPositions && item->hasDynamicConstraint() && orientation == item->dynamicConstraintOrientation()) { + /* Get the width of the item by summing up the widths of the columns that it spans. + * We need to have already calculated the widths of the columns by calling + * q_columns->calculateGeometries() before hand and passing the value in the colSizes + * and colPositions parameters. + * The variable name is still colSizes even when it actually has the row sizes + */ + qreal length = colSizes[item->lastColumn(orientation)]; + if (item->columnSpan(orientation) != 1) + length += colPositions[item->lastColumn(orientation)] - colPositions[item->firstColumn(orientation)]; + box->combine(item->box(orientation, length)); + } else { + box->combine(item->box(orientation)); + } if (effectiveRowSpan == 1) { QSizePolicy::ControlTypes controls = item->controlTypes(top); @@ -1512,44 +1615,99 @@ void QGridLayoutEngine::ensureEffectiveFirstAndLastRows() const } } -void QGridLayoutEngine::ensureColumnAndRowData(const QLayoutStyleInfo &styleInfo) const +void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGridLayoutBox *totalBox, + const QLayoutStyleInfo &styleInfo, + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation) const { - if (q_cachedDataForStyleInfo == styleInfo) - return; - - q_columnData.reset(columnCount()); - q_rowData.reset(rowCount()); - - fillRowData(&q_columnData, styleInfo, Qt::Horizontal); - fillRowData(&q_rowData, styleInfo, Qt::Vertical); + rowData->reset(rowCount(orientation)); + fillRowData(rowData, styleInfo, colPositions, colSizes, orientation); + rowData->distributeMultiCells(); + *totalBox = rowData->totalBox(0, rowCount(orientation)); + //We have items whose width depends on their height +} - q_columnData.distributeMultiCells(); - q_rowData.distributeMultiCells(); +/** + returns false if the layout has contradicting constraints (i.e. some items with a horizontal + constraint and other items with a vertical constraint) + */ +bool QGridLayoutEngine::ensureDynamicConstraint() const +{ + if (q_cachedConstraintOrientation == UnknownConstraint) { + for (int i = q_items.count() - 1; i >= 0; --i) { + QGridLayoutItem *item = q_items.at(i); + if (item->hasDynamicConstraint()) { + Qt::Orientation itemConstraintOrientation = item->dynamicConstraintOrientation(); + if (q_cachedConstraintOrientation == UnknownConstraint) { + q_cachedConstraintOrientation = itemConstraintOrientation; + } else if (q_cachedConstraintOrientation != itemConstraintOrientation) { + q_cachedConstraintOrientation = UnfeasibleConstraint; + qWarning("QGridLayoutEngine: Unfeasible, cannot mix horizontal and" + " vertical constraint in the same layout"); + return false; + } + } + } + if (q_cachedConstraintOrientation == UnknownConstraint) + q_cachedConstraintOrientation = NoConstraint; + } + return true; +} - q_totalBoxes[Hor] = q_columnData.totalBox(0, columnCount()); - q_totalBoxes[Ver] = q_rowData.totalBox(0, rowCount()); +bool QGridLayoutEngine::hasDynamicConstraint() const +{ + if (!ensureDynamicConstraint()) + return false; + return q_cachedConstraintOrientation != NoConstraint; +} - q_cachedDataForStyleInfo = styleInfo; +/* + * return value is only valid if hasConstraint() returns true + */ +Qt::Orientation QGridLayoutEngine::constraintOrientation() const +{ + (void)ensureDynamicConstraint(); + return (Qt::Orientation)q_cachedConstraintOrientation; } void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const { - ensureColumnAndRowData(styleInfo); - if (q_cachedSize == size) + if (q_cachedDataForStyleInfo == styleInfo && q_cachedSize == size) return; + q_cachedDataForStyleInfo = styleInfo; + q_cachedSize = size; + q_xx.resize(columnCount()); - q_yy.resize(rowCount()); q_widths.resize(columnCount()); + q_yy.resize(rowCount()); q_heights.resize(rowCount()); q_descents.resize(rowCount()); - q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), - 0, q_totalBoxes[Hor]); - q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), - q_descents.data(), q_totalBoxes[Ver]); - q_cachedSize = size; + if(constraintOrientation() != Qt::Horizontal) { + //We might have items whose width depends on their height + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + //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 + q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), + 0, q_totalBoxes[Hor]); + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, q_xx.data(), q_widths.data(), Qt::Vertical); + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() + q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), + q_descents.data(), q_totalBoxes[Ver]); + } else { + //We have items whose height depends on their width + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + //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 + q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), + q_descents.data(), q_totalBoxes[Ver]); + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, q_yy.data(), q_heights.data(), Qt::Horizontal); + //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() + q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), + 0, q_totalBoxes[Hor]); + } } QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h index 9ac9a8e..02c74b0 100644 --- a/src/gui/graphicsview/qgridlayoutengine_p.h +++ b/src/gui/graphicsview/qgridlayoutengine_p.h @@ -91,6 +91,14 @@ enum LayoutSide { Bottom }; +enum { + NoConstraint, + HorizontalConstraint, // Width depends on the height + VerticalConstraint, // Height depends on the width + UnknownConstraint, // need to update cache + UnfeasibleConstraint // not feasible, it be has some items with Vertical and others with Horizontal constraints +}; + template <typename T> class QLayoutParameter { @@ -270,6 +278,10 @@ public: inline void setAlignment(Qt::Alignment alignment) { q_alignment = alignment; } QSizePolicy::Policy sizePolicy(Qt::Orientation orientation) const; + + bool hasDynamicConstraint() const; + Qt::Orientation dynamicConstraintOrientation() const; + QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; QGridLayoutBox box(Qt::Orientation orientation, qreal constraint = -1.0) const; @@ -280,7 +292,7 @@ public: void setGeometry(const QRectF &rect); void transpose(); void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation = Qt::Vertical); - QSizeF effectiveMaxSize() const; + QSizeF effectiveMaxSize(const QSizeF &constraint) const; #ifdef QT_DEBUG void dump(int indent = 0) const; @@ -372,6 +384,14 @@ public: int column, int rowSpan, int columnSpan) const; QSizeF sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, const QSizeF &constraint) const; + + // heightForWidth / widthForHeight support + QSizeF dynamicallyConstrainedSizeHint(Qt::SizeHint which, const QSizeF &constraint) const; + bool ensureDynamicConstraint() const; + bool hasDynamicConstraint() const; + Qt::Orientation constraintOrientation() const; + + QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; void transpose(); void setVisualDirection(Qt::LayoutDirection direction); @@ -390,9 +410,14 @@ private: void setItemAt(int row, int column, QGridLayoutItem *item); void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation = Qt::Vertical); void fillRowData(QGridLayoutRowData *rowData, const QLayoutStyleInfo &styleInfo, - Qt::Orientation orientation = Qt::Vertical) const; + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation = Qt::Vertical) const; void ensureEffectiveFirstAndLastRows() const; - void ensureColumnAndRowData(const QLayoutStyleInfo &styleInfo) const; + void ensureColumnAndRowData(QGridLayoutRowData *rowData, QGridLayoutBox *totalBox, + const QLayoutStyleInfo &styleInfo, + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation) const; + void ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const; // User input @@ -405,6 +430,7 @@ private: // Lazily computed from the above user input mutable int q_cachedEffectiveFirstRows[NOrientations]; mutable int q_cachedEffectiveLastRows[NOrientations]; + mutable quint8 q_cachedConstraintOrientation : 2; // Layout item input mutable QLayoutStyleInfo q_cachedDataForStyleInfo; diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp index de4f680..1627917 100644 --- a/src/gui/image/qtiffhandler.cpp +++ b/src/gui/image/qtiffhandler.cpp @@ -608,6 +608,7 @@ QVariant QTiffHandler::option(ImageOption option) const TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height); imageSize = QSize(width, height); + TIFFClose(tiff); } device()->seek(pos); if (imageSize.isValid()) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index a552ce7..f759fe0 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -939,10 +939,6 @@ static int qCocoaViewCount = 0; } } #endif //QT_NO_WHEELEVENT - - if (!wheelOK) { - return [super scrollWheel:theEvent]; - } } - (void)tabletProximity:(NSEvent *)tabletEvent diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index f7c795e..9b44f15 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -68,6 +68,7 @@ # include "qt_cocoa_helpers_mac_p.h" # include "qmainwindow.h" # include "qtoolbar.h" +# include <private/qmainwindowlayout_p.h> #endif #if defined(Q_WS_QWS) # include "qwsdisplay_qws.h" @@ -3002,6 +3003,15 @@ bool QWidget::isFullScreen() const */ void QWidget::showFullScreen() { +#ifdef Q_WS_MAC + // If the unified toolbar is enabled, we have to disable it before going fullscreen. + QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); + if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) { + mainWindow->setUnifiedTitleAndToolBarOnMac(false); + QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); + mainLayout->activateUnifiedToolbarAfterFullScreen = true; + } +#endif // Q_WS_MAC ensurePolished(); #ifdef QT3_SUPPORT if (parent()) @@ -3034,6 +3044,18 @@ void QWidget::showMaximized() setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen)) | Qt::WindowMaximized); +#ifdef Q_WS_MAC + // If the unified toolbar was enabled before going fullscreen, we have to enable it back. + QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); + if (mainWindow) + { + QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); + if (mainLayout->activateUnifiedToolbarAfterFullScreen) { + mainWindow->setUnifiedTitleAndToolBarOnMac(true); + mainLayout->activateUnifiedToolbarAfterFullScreen = false; + } + } +#endif // Q_WS_MAC show(); } @@ -3055,6 +3077,18 @@ void QWidget::showNormal() setWindowState(windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)); +#ifdef Q_WS_MAC + // If the unified toolbar was enabled before going fullscreen, we have to enable it back. + QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this); + if (mainWindow) + { + QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout()); + if (mainLayout->activateUnifiedToolbarAfterFullScreen) { + mainWindow->setUnifiedTitleAndToolBarOnMac(true); + mainLayout->activateUnifiedToolbarAfterFullScreen = false; + } + } +#endif // Q_WS_MAC show(); } diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 1e2aa9f..997419b 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2794,19 +2794,38 @@ void QWidgetPrivate::transferChildren() #ifdef QT_MAC_USE_COCOA void QWidgetPrivate::setSubWindowStacking(bool set) { + // This will set/remove a visual relationship between parent and child on screen. + // The reason for doing this is to ensure that a child always stacks infront of + // its parent. Unfortunatly is turns out that [NSWindow addChildWindow] has + // several unwanted side-effects, one of them being the moving of a child when + // moving the parent, which we choose to accept. A way tougher side-effect is + // that Cocoa will hide the parent if you hide the child. And in the case of + // a tool window, since it will normally hide when you deactivate the + // application, Cocoa will hide the parent upon deactivate as well. The result often + // being no more visible windows on screen. So, to make a long story short, we only + // allow parent-child relationships between windows that both are either a plain window + // or a dialog. + Q_Q(QWidget); - if (!q->isWindow() || !q->testAttribute(Qt::WA_WState_Created)) + if (!q->isWindow()) + return; + NSWindow *qwin = [qt_mac_nativeview_for(q) window]; + if (!qwin) + return; + Qt::WindowType qtype = q->windowType(); + if (set && !(qtype == Qt::Window || qtype == Qt::Dialog)) + return; + if (set && ![qwin isVisible]) return; if (QWidget *parent = q->parentWidget()) { - if (parent->testAttribute(Qt::WA_WState_Created)) { + if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) { if (set) { - if (parent->isVisible()) { - NSWindow *childwin = qt_mac_window_for(q); - [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove]; - } + Qt::WindowType ptype = parent->window()->windowType(); + if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow]) + [pwin addChildWindow:qwin ordered:NSWindowAbove]; } else { - [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)]; + [pwin removeChildWindow:qwin]; } } } @@ -2814,12 +2833,15 @@ void QWidgetPrivate::setSubWindowStacking(bool set) QList<QWidget *> widgets = q->findChildren<QWidget *>(); for (int i=0; i<widgets.size(); ++i) { QWidget *child = widgets.at(i); - if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) { - if (set) { - NSWindow *childwin = qt_mac_window_for(child); - [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove]; - } else { - [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)]; + if (child && child->isWindow()) { + if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) { + if (set) { + Qt::WindowType ctype = child->window()->windowType(); + if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow]) + [qwin addChildWindow:cwin ordered:NSWindowAbove]; + } else { + [qwin removeChildWindow:qt_mac_window_for(child)]; + } } } } @@ -3442,7 +3464,6 @@ void QWidgetPrivate::show_sys() #else // sync the opacity value back (in case of a fade). [window setAlphaValue:q->windowOpacity()]; - setSubWindowStacking(true); QWidget *top = 0; if (QApplicationPrivate::tryModalHelper(q, &top)) { @@ -3461,6 +3482,7 @@ void QWidgetPrivate::show_sys() [modalWin orderFront:window]; } } + setSubWindowStacking(true); #endif if (q->windowType() == Qt::Popup) { if (q->focusWidget()) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 9a451ce..5df5e19 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -544,7 +544,7 @@ void QWidgetPrivate::show_sys() id->MakeVisible(true); - if(q->isWindow()) + if(q->isWindow()&&!q->testAttribute(Qt::WA_ShowWithoutActivating)) id->setFocusSafely(true); } diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 793d380..bd37d9f 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -234,13 +234,14 @@ embedded { symbian { - HEADERS += painting/qwindowsurface_s60_p.h + HEADERS += painting/qwindowsurface_s60_p.h \ + painting/qdrawhelper_arm_simd_p.h SOURCES += painting/qwindowsurface_s60.cpp armccIfdefBlock = \ "$${LITERAL_HASH}if defined(ARMV6)" \ + "MACRO QT_HAVE_ARM_SIMD" \ "SOURCEPATH painting" \ - "SOURCE qblendfunctions_armv6_rvct.s" \ - "SOURCE qdrawhelper_armv6_rvct.s" \ + "SOURCE qdrawhelper_arm_simd.cpp" \ "$${LITERAL_HASH}endif" MMP_RULES += armccIfdefBlock diff --git a/src/gui/painting/qblendfunctions_armv6_rvct.s b/src/gui/painting/qblendfunctions_armv6_rvct.s deleted file mode 100644 index 1e3faa9..0000000 --- a/src/gui/painting/qblendfunctions_armv6_rvct.s +++ /dev/null @@ -1,222 +0,0 @@ -;**************************************************************************** -;** -;** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -;** All rights reserved. -;** Contact: Nokia Corporation (qt-info@nokia.com) -;** -;** This file is part of the QtGui module of the Qt Toolkit. -;** -;** $QT_BEGIN_LICENSE:LGPL$ -;** No Commercial Usage -;** This file contains pre-release code and may not be distributed. -;** You may use this file in accordance with the terms and conditions -;** contained in the Technology Preview License Agreement accompanying -;** this package. -;** -;** 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 as published by the Free Software -;** Foundation and appearing in the file LICENSE.LGPL included in the -;** packaging of this file. Please review the following information to -;** ensure the GNU Lesser General Public License version 2.1 requirements -;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -;** -;** In addition, as a special exception, Nokia gives you certain additional -;** rights. These rights are described in the Nokia Qt LGPL Exception -;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -;** -;** If you have questions regarding the use of this file, please contact -;** Nokia at qt-info@nokia.com. -;** -;** -;** -;** -;** -;** -;** -;** -;** $QT_END_LICENSE$ -;** -;**************************************************************************** - -; -; W A R N I N G -; ------------- -; -; This file is not part of the Qt API. It exists purely as an -; implementation detail. This header file may change from version to -; version without notice, or even be removed. -; -; We mean it. -; - - - ARM - PRESERVE8 - - INCLUDE qdrawhelper_armv6_rvct.inc - - -;----------------------------------------------------------------------------- -; qt_blend_rgb32_on_rgb32_arm -; -; @brief -; -; @param dest Destination pixels (r0) -; @param dbpl Destination bytes per line (r1) -; @param src Source pixels (r2) -; @param sbpl Source bytes per line (r3) -; @param w Width (s0 -> r4) -; @param h Height (s1 -> r5) -; @param const_alpha Constant alpha (s2 -> r6) -; -;--------------------------------------------------------------------------- -qt_blend_rgb32_on_rgb32_armv6 Function - stmfd sp!, {r4-r12, r14} - - ; read arguments off the stack - add r8, sp, #10 * 4 - ldmia r8, {r9-r11} - - ; Reorganize registers - - mov r4, r10 - mov r5, r1 - mov r6, r3 - - mov r1, r2 - mov r2, r9 - mov r3, r11 - - ; Now we have registers - ; @param dest Destination pixels (r0) - ; @param src Source pixels (r1) - ; @param w Width (r2) - ; @param const_alpha Constant alpha (r3) - ; @param h Height (r4) - ; @param dbpl Destination bytes per line (r5) - ; @param sbpl Source bytes per line (r6) - - cmp r3, #256 ; test if we have fully opaque constant alpha value - bne rgb32_blend_const_alpha ; branch if not - -rgb32_blend_loop - - subs r4, r4, #1 - bmi rgb32_blend_exit ; while(h--) - -rgb321 PixCpySafe r0, r1, r2 - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b rgb32_blend_loop - - -rgb32_blend_const_alpha - - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - sub r3, r3, #1 ; const_alpha -= 1; - -rgb32_blend_loop_const_alpha - - subs r4, r4, #1 - bmi rgb32_blend_exit ; while(h--) - -rgb322 BlendRowSafe PixelSourceOverConstAlpha - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b rgb32_blend_loop_const_alpha - -rgb32_blend_exit - - ldmfd sp!, {r4-r12, pc} ; pop and return - - - -;----------------------------------------------------------------------------- -; qt_blend_argb32_on_argb32_arm -; -; @brief -; -; @param dest Destination pixels (r0) -; @param dbpl Destination bytes per line (r1) -; @param src Source pixels (r2) -; @param sbpl Source bytes per line (r3) -; @param w Width (s0 -> r4) -; @param h Height (s1 -> r5) -; @param const_alpha Constant alpha (s2 -> r6) -; -;--------------------------------------------------------------------------- -qt_blend_argb32_on_argb32_armv6 Function - stmfd sp!, {r4-r12, r14} - - ; read arguments off the stack - add r8, sp, #10 * 4 - ldmia r8, {r9-r11} - - ; Reorganize registers - - mov r4, r10 - mov r5, r1 - mov r6, r3 - - mov r1, r2 - mov r2, r9 - mov r3, r11 - - ; Now we have registers - ; @param dest Destination pixels (r0) - ; @param src Source pixels (r1) - ; @param w Width (r2) - ; @param const_alpha Constant alpha (r3) - ; @param h Height (r4) - ; @param dbpl Destination bytes per line (r5) - ; @param sbpl Source bytes per line (r6) - - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - cmp r3, #256 ; test if we have fully opaque constant alpha value - bne argb32_blend_const_alpha ; branch if not - -argb32_blend_loop - - subs r4, r4, #1 - bmi argb32_blend_exit ; while(h--) - -argb321 BlendRowSafe PixelSourceOver - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b argb32_blend_loop - -argb32_blend_const_alpha - - sub r3, r3, #1 ; const_alpha -= 1; - -argb32_blend_loop_const_alpha - - subs r4, r4, #1 - bmi argb32_blend_exit ; while(h--) - -argb322 BlendRowSafe PixelSourceOverConstAlpha - - add r0, r0, r5 ; dest = dest + dbpl - add r1, r1, r6 ; src = src + sbpl - - b argb32_blend_loop_const_alpha - -argb32_blend_exit - - ldmfd sp!, {r4-r12, pc} ; pop and return - - - END ; File end diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 5f190ba..a4ab278 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -43,7 +43,7 @@ #include <private/qpaintengine_raster_p.h> #include <private/qpainter_p.h> #include <private/qdrawhelper_x86_p.h> -#include <private/qdrawhelper_armv6_p.h> +#include <private/qdrawhelper_arm_simd_p.h> #include <private/qdrawhelper_neon_p.h> #include <private/qmath_p.h> #include <qmath.h> @@ -7678,96 +7678,6 @@ static void qt_memfill16_setup(quint16 *dest, quint16 value, int count); qt_memfill32_func qt_memfill32 = qt_memfill32_setup; qt_memfill16_func qt_memfill16 = qt_memfill16_setup; -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) -// Move these to qdrawhelper_arm.c when all -// functions are implemented using arm assembly. -static CompositionFunctionSolid qt_functionForModeSolid_ARMv6[numCompositionFunctions] = { - comp_func_solid_SourceOver, - comp_func_solid_DestinationOver, - comp_func_solid_Clear, - comp_func_solid_Source, - comp_func_solid_Destination, - comp_func_solid_SourceIn, - comp_func_solid_DestinationIn, - comp_func_solid_SourceOut, - comp_func_solid_DestinationOut, - comp_func_solid_SourceAtop, - comp_func_solid_DestinationAtop, - comp_func_solid_XOR, - comp_func_solid_Plus, - comp_func_solid_Multiply, - comp_func_solid_Screen, - comp_func_solid_Overlay, - comp_func_solid_Darken, - comp_func_solid_Lighten, - comp_func_solid_ColorDodge, - comp_func_solid_ColorBurn, - comp_func_solid_HardLight, - comp_func_solid_SoftLight, - comp_func_solid_Difference, - comp_func_solid_Exclusion, - rasterop_solid_SourceOrDestination, - rasterop_solid_SourceAndDestination, - rasterop_solid_SourceXorDestination, - rasterop_solid_NotSourceAndNotDestination, - rasterop_solid_NotSourceOrNotDestination, - rasterop_solid_NotSourceXorDestination, - rasterop_solid_NotSource, - rasterop_solid_NotSourceAndDestination, - rasterop_solid_SourceAndNotDestination -}; - -static CompositionFunction qt_functionForMode_ARMv6[numCompositionFunctions] = { - comp_func_SourceOver_armv6, - comp_func_DestinationOver, - comp_func_Clear, - comp_func_Source_armv6, - comp_func_Destination, - comp_func_SourceIn, - comp_func_DestinationIn, - comp_func_SourceOut, - comp_func_DestinationOut, - comp_func_SourceAtop, - comp_func_DestinationAtop, - comp_func_XOR, - comp_func_Plus, - comp_func_Multiply, - comp_func_Screen, - comp_func_Overlay, - comp_func_Darken, - comp_func_Lighten, - comp_func_ColorDodge, - comp_func_ColorBurn, - comp_func_HardLight, - comp_func_SoftLight, - comp_func_Difference, - comp_func_Exclusion, - rasterop_SourceOrDestination, - rasterop_SourceAndDestination, - rasterop_SourceXorDestination, - rasterop_NotSourceAndNotDestination, - rasterop_NotSourceOrNotDestination, - rasterop_NotSourceXorDestination, - rasterop_NotSource, - rasterop_NotSourceAndDestination, - rasterop_SourceAndNotDestination -}; - -static void qt_blend_color_argb_armv6(int count, const QSpan *spans, void *userData) -{ - QSpanData *data = reinterpret_cast<QSpanData *>(userData); - - CompositionFunctionSolid func = qt_functionForModeSolid_ARMv6[data->rasterBuffer->compositionMode]; - while (count--) { - uint *target = ((uint *)data->rasterBuffer->scanLine(spans->y)) + spans->x; - func(target, spans->len, data->solid.color, spans->coverage); - ++spans; - } -} - -#endif // Q_CC_RVCT && QT_HAVE_ARMV6 - - void qInitDrawhelperAsm() { @@ -7938,46 +7848,39 @@ void qInitDrawhelperAsm() } #endif // IWMMXT -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) - functionForModeAsm = qt_functionForMode_ARMv6; - functionForModeSolidAsm = qt_functionForModeSolid_ARMv6; +#if defined(QT_HAVE_ARM_SIMD) + qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_arm_simd; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_arm_simd; + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_arm_simd; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_arm_simd; +#elif defined(QT_HAVE_NEON) + if (features & NEON) { + qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; + qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; + qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; + + qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; + qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; - qt_memfill32 = qt_memfill32_armv6; + qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon; + qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon; - qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_armv6; + qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_armv6; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_armv6; -#elif defined(QT_HAVE_NEON) - if (features & NEON) { - qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; - qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; - qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; - - qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; - qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; - - qTransformFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_transform_image_argb32_on_rgb16_neon; - qTransformFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_transform_image_rgb16_on_rgb16_neon; - - qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; - - functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; - functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; - functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; - destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; - destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; - - qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; - qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; - qt_memfill32 = qt_memfill32_neon; - } + functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; + functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; + functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; + destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; + destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; + + qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; + qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; + qt_memfill32 = qt_memfill32_neon; + } #endif if (functionForModeSolidAsm) { diff --git a/src/gui/painting/qdrawhelper_arm_simd.cpp b/src/gui/painting/qdrawhelper_arm_simd.cpp new file mode 100644 index 0000000..61dac5e --- /dev/null +++ b/src/gui/painting/qdrawhelper_arm_simd.cpp @@ -0,0 +1,313 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdrawhelper_arm_simd_p.h" + +#include <private/qpaintengine_raster_p.h> +#include <private/qblendfunctions_p.h> + +#ifdef QT_HAVE_ARM_SIMD + +#if defined(Q_OS_SYMBIAN) +#include <u32std.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) +__asm void qt_blend_argb32_on_argb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ +#ifndef __ARMCC__ + __SWITCH_TO_ARM; +#else + CODE32 +#endif // __ARMCC__ + + stmfd sp!, {r4-r12, r14} + + // read arguments off the stack + add r8, sp, #10 * 4 + ldmia r8, {r4-r6} + + // adjust dbpl and sbpl + mov r14, #4 + mul r14, r4, r14 + sub r1, r1, r14 + sub r3, r3, r14 + + // load 0xFF00FF00 to r12 + mov r12, #0xFF000000 + add r12, r12, #0xFF00 + + // load 0x800080 to r14 + mov r14, #0x800000 + add r14, r14, #0x80 + + /* + Registers: + r0 dst + r1 dbpl + r2 src + r3 sbpl + r4 w + r5 h + r6 const_alpha + r12 0xFF0000 + r14 0x800080 + */ + + cmp r6, #256 //test if we have fully opaque constant alpha value + bne argb32constalpha // branch if not + +argb32_next_row + + mov r7, r4 + +argb32_next_pixel + + ldr r8, [r2], #4 // load src pixel + + // Negate r8 and extract src alpha + mvn r11, r8 // bitwise not + uxtb r11, r11, ror #24 + + cmp r11, #0 // test for full src opacity (negated) + beq argb32_no_blend + + cmp r11, #255 // test for full src transparency (negated) + addeq r0, #4 + beq argb32_nop + + ldr r9, [r0] // load dst pixel + + // blend + uxtb16 r10, r9 + uxtb16 r6, r9, ror #8 + mla r10, r11, r10, r14 + mla r9, r6, r11, r14 + uxtab16 r10, r10, r10, ror #8 + uxtab16 r9, r9, r9, ror #8 + and r9, r9, r12 + uxtab16 r10, r9, r10, ror #8 + + uqadd8 r8, r10, r8 + +argb32_no_blend + + str r8, [r0], #4 + +argb32_nop + + subs r7, r7, #1 + bgt argb32_next_pixel + + add r0, r0, r1 // dest = dest + dbpl + add r2, r2, r3 // src = src + sbpl + + subs r5, r5, #1 + bgt argb32_next_row + + b argb32_blend_exit + +argb32constalpha + + cmp r6, #0 + beq argb32_blend_exit + + ; const_alpha = (const_alpha * 255) >> 8; + mov r11, #255 + mul r6, r6, r11 + mov r11, r6, lsr #8 + +argb32constalpha_next_row + + mov r7, r4 + +argb32constalpha_next_pixel + + ldr r9, [r2], #4 // load src pixel + + // blend + uxtb16 r10, r9 + uxtb16 r6, r9, ror #8 + mla r10, r11, r10, r14 + mla r9, r6, r11, r14 + uxtab16 r10, r10, r10, ror #8 + uxtab16 r9, r9, r9, ror #8 + and r9, r9, r12 + uxtab16 r8, r9, r10, ror #8 + + ldr r9, [r0] // load dst pixel + + // blend + uxtb16 r10, r9 + uxtb16 r6, r9, ror #8 + + // Negate r11 and extract src alpha + mvn r9, r11 // bitwise not + uxtb r9, r9, ror #24 + + mla r10, r9, r10, r14 + mla r9, r6, r9, r14 + uxtab16 r10, r10, r10, ror #8 + uxtab16 r9, r9, r9, ror #8 + and r9, r9, r12 + uxtab16 r10, r9, r10, ror #8 + + uqadd8 r8, r10, r8 + + str r8, [r0], #4 + + subs r7, r7, #1 + bgt argb32constalpha_next_pixel + + add r0, r0, r1 // dest = dest + dbpl + add r2, r2, r3 // src = src + sbpl + + subs r5, r5, #1 + bgt argb32constalpha_next_row + +argb32_blend_exit + + // Restore registers + ldmfd sp!, {r4-r12, lr} + bx lr + + __END_ARM +} + +void qt_blend_rgb32_on_rgb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + if (const_alpha != 256) { + qt_blend_argb32_on_argb32_arm_simd(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + return; + } + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (w <= 64) { + for (int y=0; y<h; ++y) { + qt_memconvert(dst, src, w); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else { + int len = w * 4; + for (int y=0; y<h; ++y) { + memcpy(dst, src, len); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} + +#else // defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) + +// TODO: add GNU assembler instructions and support for other platforms. +// Default to C code for now + +void qt_blend_argb32_on_argb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (const_alpha == 256) { + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint s = src[x]; + if (s >= 0xff000000) + dst[x] = s; + else if (s != 0) + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else if (const_alpha != 0) { + const_alpha = (const_alpha * 255) >> 8; + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint s = BYTE_MUL(src[x], const_alpha); + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} + +void qt_blend_rgb32_on_rgb32_arm_simd(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ + if (const_alpha != 256) { + qt_blend_argb32_on_argb32_arm_simd(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + return; + } + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (w <= 64) { + for (int y=0; y<h; ++y) { + qt_memconvert(dst, src, w); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else { + int len = w * 4; + for (int y=0; y<h; ++y) { + memcpy(dst, src, len); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} + +#endif + +#endif // QT_HAVE_ARMV_SIMD diff --git a/src/gui/painting/qdrawhelper_armv6_p.h b/src/gui/painting/qdrawhelper_arm_simd_p.h index e58f8bb..6c96a84 100644 --- a/src/gui/painting/qdrawhelper_armv6_p.h +++ b/src/gui/painting/qdrawhelper_arm_simd_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QDRAWHELPER_ARMV6_P_H -#define QDRAWHELPER_ARMV6_P_H +#ifndef QDRAWHELPER_ARM_SIMD_P_H +#define QDRAWHELPER_ARM_SIMD_P_H // // W A R N I N G @@ -57,25 +57,20 @@ QT_BEGIN_NAMESPACE -#if defined(Q_CC_RVCT) && defined(QT_HAVE_ARMV6) +#if defined(QT_HAVE_ARM_SIMD) -extern "C" void qt_blend_rgb32_on_rgb32_armv6(uchar *destPixels, int dbpl, +void qt_blend_argb32_on_argb32_arm_simd(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, int const_alpha); -extern "C" void qt_blend_argb32_on_argb32_armv6(uchar *destPixels, int dbpl, +void qt_blend_rgb32_on_rgb32_arm_simd(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, int w, int h, int const_alpha); -extern "C" void qt_memfill32_armv6(quint32 *dest, quint32 value, int count); - -extern "C" void comp_func_Source_armv6(uint *dest, const uint *src, int length, uint const_alpha); -extern "C" void comp_func_SourceOver_armv6(uint *dest, const uint *src, int length, uint const_alpha); - -#endif // QT_HAVE_ARMV6 +#endif // QT_HAVE_ARM_SIMD QT_END_NAMESPACE -#endif // QDRAWHELPER_ARMV6_P_H +#endif // QDRAWHELPER_ARM_SIMD_P_H diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.inc b/src/gui/painting/qdrawhelper_armv6_rvct.inc deleted file mode 100644 index 8c6d803..0000000 --- a/src/gui/painting/qdrawhelper_armv6_rvct.inc +++ /dev/null @@ -1,496 +0,0 @@ -;**************************************************************************** -;** -;** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -;** All rights reserved. -;** Contact: Nokia Corporation (qt-info@nokia.com) -;** -;** This file is part of the QtGui module of the Qt Toolkit. -;** -;** $QT_BEGIN_LICENSE:LGPL$ -;** No Commercial Usage -;** This file contains pre-release code and may not be distributed. -;** You may use this file in accordance with the terms and conditions -;** contained in the Technology Preview License Agreement accompanying -;** this package. -;** -;** 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 as published by the Free Software -;** Foundation and appearing in the file LICENSE.LGPL included in the -;** packaging of this file. Please review the following information to -;** ensure the GNU Lesser General Public License version 2.1 requirements -;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -;** -;** In addition, as a special exception, Nokia gives you certain additional -;** rights. These rights are described in the Nokia Qt LGPL Exception -;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -;** -;** If you have questions regarding the use of this file, please contact -;** Nokia at qt-info@nokia.com. -;** -;** -;** -;** -;** -;** -;** -;** -;** $QT_END_LICENSE$ -;** -;**************************************************************************** - -; -; W A R N I N G -; ------------- -; -; This file is not part of the Qt API. It exists purely as an -; implementation detail. This header file may change from version to -; version without notice, or even be removed. -; -; We mean it. -; - -;----------------------------------------------------------------------------- -; Globals. -; Earch marcro expects that caller has loaded 0x800080 to r14. -;----------------------------------------------------------------------------- - -ComponentHalf EQU 0x800080 - -;----------------------------------------------------------------------------- -; ARM assembly implementations of accelerated graphics operations. -; -; Conventions: -; -; - r0 = Target buffer pointer -; - r1 = Source buffer pointer -; - r2 = Length of the buffer to blend -; - r3 = Constant alpha for source buffer -; -;----------------------------------------------------------------------------- - -; A macro for transparently defining ARM functions - MACRO -$func Function - AREA Function_$func, CODE - GLOBAL $func - ALIGN 4 - CODE32 -$func - MEND - - -;----------------------------------------------------------------------------- -; Armv6 boosted implementation of BYTE_MUL(...) function found in qdrawhelper_p.h. -; -; @param dst Destination register where to store the result -; @param x Value to multiply -; @param a Multiplicator byte -; @param r14 Component half 0x800080 -; -; @note Trashes x, r8 -;----------------------------------------------------------------------------- - MACRO - ByteMul $dst, $x, $a - - ; static inline uint BYTE_MUL(uint x, uint a) - - ; uint r8 = (x & 0xff00ff) * a + 0x800080 - uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF - mla r8, r8, $a, r14 - - ; x = ((r >> 8) & 0xff00ff) * a + 0x800080 - uxtb16 $x, $x, ror #8 - mla $x, $x, $a, r14 - - - ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 - ; r8 &= 0xff00ff - uxtab16 r8, r8, r8, ror #8 - uxtb16 r8, r8, ror #8 - - ; x = x + ((x >>8) & 0xff00ff) - uxtab16 $x, $x, $x, ror #8 - - ; x &= 0xff00ff00 - ; x |= r8 - uxtb16 $x, $x, ror #8 - orr $dst, r8, $x, lsl #8 - - MEND - -;----------------------------------------------------------------------------- -; Armv6 boosted implementation of INTERPOLATE_PIXEL_255(...) function found in -; qdrawhelper_p.h. -; -; @param dst Destination register where to store the result -; @param x First value to multiply -; @param a Multiplicator byte for first value -; @param y Second value to multiply -; @param b Multiplicator byte for second value -; @param r14 Component half 0x800080 -; -; -; @note Trashes x, r8, r14 -;----------------------------------------------------------------------------- - MACRO - InterpolatePixel255 $dst, $x, $a, $y, $b - - ; static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) - - ; First calculate the parts where we need 0x800080 - - ; uint r8 = (((x & 0xff00ff) * a) + 0x800080) - uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF - mla r8, r8, $a, r14 - - ; x = ((((x >> 8) & 0xff00ff) * a) + 0x800080) - uxtb16 $x, $x, ror #8 - mla $x, $x, $a, r14 - - ; Now we are trashing r14 to free it for other purposes - - ; uint r14 = (y & 0xff00ff) * b - uxtb16 r14, $y ; r14 = y & 0x00FF00FF - mul r14, r14, $b - - ; r8 = r8 + r14 - add r8, r8, r14 - - ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8 - ; r8 &= 0xff00ff - uxtab16 r8, r8, r8, ror #8 - uxtb16 r8, r8, ror #8 - - ; r14 = ((y >> 8) & 0xff00ff) * b - uxtb16 r14, $y, ror #8 ; r14 = ((y >> 8) & 0xFF00FF) - mul r14, r14, $b - - ; x = x + r14 - add $x, $x, r14 - - ; x = x + ((x >>8) & 0xff00ff) - uxtab16 $x, $x, $x, ror #8 - - ; x &= 0xff00ff00 - ; x |= r8 - uxtb16 $x, $x, ror #8 - orr $dst, r8, $x, lsl #8 - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend4Pixels $BlendPixel - - ; Blend first 4 pixels - - ldmia r1!, {r4-r7} - ldm r0, {r9-r12} - -b4p1_$label $BlendPixel r9, r4, r3 -b4p2_$label $BlendPixel r10, r5, r3 -b4p3_$label $BlendPixel r11, r6, r3 -b4p4_$label $BlendPixel r12, r7, r3 - - stmia r0!, {r9-r12} - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend8Pixels $BlendPixel - -b8p1_$label Blend4Pixels $BlendPixel -b8p2_$label Blend4Pixels $BlendPixel - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend16Pixels $BlendPixel - -b16p1_$label Blend8Pixels $BlendPixel -b16p2_$label Blend8Pixels $BlendPixel - - MEND - -;----------------------------------------------------------------------------- -; -;----------------------------------------------------------------------------- - MACRO -$label Blend32Pixels $BlendPixel - -b32p1_$label Blend16Pixels $BlendPixel -b32p2_$label Blend16Pixels $BlendPixel - - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results -; to destination buffer. -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) -; -; @note Advances r0, r1 -; @note Trashes r2, r4-r12 -;----------------------------------------------------------------------------- - MACRO -$label BlendRow $BlendPixel - - pld [r1] - -bloop_$label - ; Blend 32 pixels per loop iteration - subs r2, r2, #32 - bmi b_remaining_$label - -brp1_$label Blend32Pixels $BlendPixel - - b bloop_$label - -b_remaining_$label - - ; Remaining 31 pixels - - addmi r2, r2, #32 - - ; Blend 16 pixels - tst r2, #16 - beq b_remaining8_$label - -brp2_$label Blend16Pixels $BlendPixel - -b_remaining8_$label - - ; Blend 8 pixels - tst r2, #8 - beq b_remaining4_$label - -brp3_$label Blend8Pixels $BlendPixel - -b_remaining4_$label - - ; Blend 4 pixels - tst r2, #4 - beq b_remaining3_$label - -brp4_$label Blend4Pixels $BlendPixel - -b_remaining3_$label - - ; Remaining 3 pixels - - tst r2, #2 - beq b_last_$label - - ldmia r1!, {r4-r5} - ldm r0, {r9-r10} - -brp5_$label $BlendPixel r9, r4, r3 -brp6_$label $BlendPixel r10, r5, r3 - - stmia r0!, {r9-r10} - -b_last_$label - - tst r2, #1 - beq bexit_$label - - ldr r4, [r1] - ldr r9, [r0] - -bpl_$label $BlendPixel r9, r4, r3 - - str r9, [r0] - -bexit_$label - - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one row of pixels and saving the results -; to destination buffer. Restores all registers. -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; @param r14 Component Half (0x800080) (r14) -; -; @note Advances r0, r1 -; @note Trashes r2, r4-r12 -;----------------------------------------------------------------------------- - MACRO -$label BlendRowSafe $BlendPixel - - stmfd sp!, {r0-r6} ; Preserves registers only up to r6 - -brs_$label BlendRow $BlendPixel - - ldmfd sp!, {r0-r6} - - MEND - - -;----------------------------------------------------------------------------- -; Pix Copy. -; NOTE! Cache line size of ARM1136JF-S and ARM1136J-S is 32 bytes (8 pixels). -; -; @param dst Destination pixels (r0) -; @param src Source pixels (r1) -; @param len Length (r2) -; -; @note Trashes r3-r10 -;----------------------------------------------------------------------------- - MACRO -$label PixCpy $dst, $src, $len - - pld [$src] - -pcpy_loop_$label - ; Copy 8 pixels per loop iteration - pld [$src, #96] - subs $len, $len, #8 - ldmgeia $src!, {r3-r10} - stmgeia $dst!, {r3-r10} - bgt pcpy_loop_$label - -pcpy_remaining_$label - - ; Copy up to 7 remaining pixels - - ; Copy 4 pixels - tst $len, #4 - ldmneia $src!, {r3-r6} - stmneia $dst!, {r3-r6} - - tst $len, #2 - ldmneia $src!, {r3-r4} - stmneia $dst!, {r3-r4} - - tst $len, #1 - ldrne r3, [$src] - strne r3, [$dst] - - MEND - -;----------------------------------------------------------------------------- -; General Pix Copy. Maximum 8 pixels at time. Restores all registers. -; -; @param dst Destination pixels (r0) -; @param src Source pixels (r1) -; @param len Length (r2) -; -; @note Trashes r3-r10 -;----------------------------------------------------------------------------- - MACRO -$label PixCpySafe $dst, $src, $len - - stmfd sp!, {r0-r6} ; Preserves registers only up to r6 - -pcs_$label PixCpy $dst, $src, $len - - ldmfd sp!, {r0-r6} ; pop - - MEND - - -;----------------------------------------------------------------------------- -; A macro for source over compositing one pixel and saving the result to -; dst register. -; -; @param dst Destination register, must contain destination pixel upon entry -; @param src Source register, must contain source pixel upon entry -; @param const_alpha Constant source alpha -; @param r14 Component half 0x800080 -; -; @note Trashes const_alpha, r8 -;----------------------------------------------------------------------------- - MACRO -$label PixelSourceOver $dst, $src, $const_alpha - - ; Negate src and extract alpha - mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); - - ;cmp $const_alpha, #255 ; test for full transparency ( negated ) - ;beq exit_$label - cmp $const_alpha, #0 ; test for full opacity ( negated ) - moveq $dst, $src - beq exit_$label - - ByteMul $dst, $dst, $const_alpha - add $dst, $src, $dst - -exit_$label - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one pixel and saving the result to -; dst register. -; -; @param dst Destination register, must contain destination pixel upon entry -; @param src Source register, must contain source pixel upon entry -; @param const_alpha Constant source alpha -; @param r14 Component half 0x800080 -; -; @note Trashes src, const_alpha, r8 -;----------------------------------------------------------------------------- - MACRO -$label PixelSourceOverConstAlpha $dst, $src, $const_alpha - - ; store alpha because we are going to trash it - stmfd sp!, {$const_alpha} - - ByteMul $src, $src, $const_alpha - - ; Negate src and extract alpha - mvn $const_alpha, $src ; bitwise not - uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24); - - ByteMul $dst, $dst, $const_alpha - - add $dst, $src, $dst - - ; recover alpha - ldmfd sp!, {$const_alpha} - - MEND - -;----------------------------------------------------------------------------- -; A macro for source over compositing one pixel and saving the result to -; a register. -; -; @param dst Destination register, must contain destination pixel upon entry -; @param src Source register, must contain source pixel upon entry -; @param const_alpha Constant source alpha -; @param r14 Component half 0x800080 -; -; @note Trashes src, r8 -;----------------------------------------------------------------------------- - MACRO -$label PixelSourceConstAlpha $dst, $src, $const_alpha - - ; store r2 and r14 because we are going to trash them - stmfd sp!, {r2, r14} - - rsb r2, $const_alpha, #255 - InterpolatePixel255 $dst, $src, $const_alpha, $dst, r2 - - ; recover r2 and r14 - ldmfd sp!, {r2, r14} - - MEND - - END ; File end diff --git a/src/gui/painting/qdrawhelper_armv6_rvct.s b/src/gui/painting/qdrawhelper_armv6_rvct.s deleted file mode 100644 index 180980a..0000000 --- a/src/gui/painting/qdrawhelper_armv6_rvct.s +++ /dev/null @@ -1,177 +0,0 @@ -;**************************************************************************** -;** -;** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -;** All rights reserved. -;** Contact: Nokia Corporation (qt-info@nokia.com) -;** -;** This file is part of the QtGui module of the Qt Toolkit. -;** -;** $QT_BEGIN_LICENSE:LGPL$ -;** No Commercial Usage -;** This file contains pre-release code and may not be distributed. -;** You may use this file in accordance with the terms and conditions -;** contained in the Technology Preview License Agreement accompanying -;** this package. -;** -;** 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 as published by the Free Software -;** Foundation and appearing in the file LICENSE.LGPL included in the -;** packaging of this file. Please review the following information to -;** ensure the GNU Lesser General Public License version 2.1 requirements -;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -;** -;** In addition, as a special exception, Nokia gives you certain additional -;** rights. These rights are described in the Nokia Qt LGPL Exception -;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -;** -;** If you have questions regarding the use of this file, please contact -;** Nokia at qt-info@nokia.com. -;** -;** -;** -;** -;** -;** -;** -;** -;** $QT_END_LICENSE$ -;** -;**************************************************************************** - -; -; W A R N I N G -; ------------- -; -; This file is not part of the Qt API. It exists purely as an -; implementation detail. This header file may change from version to -; version without notice, or even be removed. -; -; We mean it. -; - - ARM - PRESERVE8 - - INCLUDE qdrawhelper_armv6_rvct.inc - -;----------------------------------------------------------------------------- -; qt_memfill32_armv6 -; -; @brief Not yet in use! -; -; @param dest Destination buffer (r0) -; @param value Value (r1) -; @param count Count (r2) -; -;--------------------------------------------------------------------------- -qt_memfill32_armv6 Function - stmfd sp!, {r4-r12, r14} - - mov r3, r1 - mov r4, r1 - mov r5, r1 - mov r6, r1 - mov r7, r1 - mov r8, r1 - mov r9, r1 - -mfill_loop - ; Fill 32 pixels per loop iteration - subs r2, r2, #32 - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmgeia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - bgt mfill_loop - -mfill_remaining - - ; Fill up to 31 remaining pixels - - ; Fill 16 pixels - tst r2, #16 - stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - - ; Fill 8 pixels - tst r2, #8 - stmneia r0!, {r1, r3, r4, r5, r6, r7, r8, r9} - - ; Fill 4 pixels - tst r2, #4 - stmneia r0!, {r1, r3, r4, r5} - - ; Fill 2 pixels - tst r2, #2 - stmneia r0!, {r1, r3} - - ; Fill last one - tst r2, #1 - strne r1, [r0] - - ldmfd sp!, {r4-r12, pc} ; pop and return - -;----------------------------------------------------------------------------- -; comp_func_Source_arm -; -; @brief -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; -;--------------------------------------------------------------------------- -comp_func_Source_armv6 Function - stmfd sp!, {r4-r12, r14} - - cmp r3, #255 ; if(r3 == 255) - bne src2 ; branch if not - -src1 PixCpy r0, r1, r2 - - ldmfd sp!, {r4-r12, pc} ; pop and return - -src2 - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - -src22 BlendRow PixelSourceConstAlpha - - ldmfd sp!, {r4-r12, pc} ; pop and return - -;----------------------------------------------------------------------------- -; comp_func_SourceOver_arm -; -; @brief -; -; @param dest Destination buffer (r0) -; @param src Source buffer (r1) -; @param length Length (r2) -; @param const_alpha Constant alpha (r3) -; -;--------------------------------------------------------------------------- -comp_func_SourceOver_armv6 Function - stmfd sp!, {r4-r12, r14} - - ;ldr r14, =ComponentHalf ; load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - cmp r3, #255 ; if(r3 == 255) - bne srcovr2 ; branch if not - -srcovr1 BlendRow PixelSourceOver - - ldmfd sp!, {r4-r12, pc} ; pop and return - -srcovr2 - -srcovr22 BlendRow PixelSourceOverConstAlpha - - ldmfd sp!, {r4-r12, pc} ; pop and return - - - END ; File end diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 1e32bd8..50e8a5b 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2620,6 +2620,8 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); break; } + if (!sz.isValid()) + sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); return sz; } diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index e718212..bcd601b 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -782,7 +782,8 @@ QMatchData QUnsortedModelEngine::filter(const QString& part, const QModelIndex& /////////////////////////////////////////////////////////////////////////////// QCompleterPrivate::QCompleterPrivate() : widget(0), proxy(0), popup(0), cs(Qt::CaseSensitive), role(Qt::EditRole), column(0), - maxVisibleItems(7), sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true) + maxVisibleItems(7), sorting(QCompleter::UnsortedModel), wrap(true), eatFocusOut(true), + hiddenBecauseNoMatch(false) { } @@ -921,12 +922,14 @@ void QCompleterPrivate::showPopup(const QRect& rect) void QCompleterPrivate::_q_fileSystemModelDirectoryLoaded(const QString &path) { Q_Q(QCompleter); -#ifndef QT_NO_LINEEDIT - QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget); - //the path given by QFileSystemModel does not end with / - if (lineEdit && !lineEdit->text().isEmpty() && !q->completionPrefix().isEmpty() && q->completionPrefix() != path + QLatin1Char('/')) + // Slot called when QFileSystemModel has finished loading. + // If we hide the popup because there was no match because the model was not loaded yet, + // we re-start the completion when we get the results + if (hiddenBecauseNoMatch + && prefix.startsWith(path) && prefix != (path + '/') + && widget) { q->complete(); -#endif + } } /*! @@ -1200,6 +1203,7 @@ bool QCompleter::eventFilter(QObject *o, QEvent *e) Q_D(QCompleter); if (d->eatFocusOut && o == d->widget && e->type() == QEvent::FocusOut) { + d->hiddenBecauseNoMatch = false; if (d->popup && d->popup->isVisible()) return true; } @@ -1378,6 +1382,7 @@ void QCompleter::complete(const QRect& rect) { Q_D(QCompleter); QModelIndex idx = d->proxy->currentIndex(false); + d->hiddenBecauseNoMatch = false; if (d->mode == QCompleter::InlineCompletion) { if (idx.isValid()) d->_q_complete(idx, true); @@ -1389,6 +1394,7 @@ void QCompleter::complete(const QRect& rect) || (d->mode == QCompleter::UnfilteredPopupCompletion && d->proxy->rowCount() == 0)) { if (d->popup) d->popup->hide(); // no suggestion, hide + d->hiddenBecauseNoMatch = true; return; } diff --git a/src/gui/util/qcompleter_p.h b/src/gui/util/qcompleter_p.h index 8f00793..19b76e5 100644 --- a/src/gui/util/qcompleter_p.h +++ b/src/gui/util/qcompleter_p.h @@ -93,6 +93,7 @@ public: bool eatFocusOut; QRect popupRect; + bool hiddenBecauseNoMatch; void showPopup(const QRect&); void _q_complete(QModelIndex, bool = false); diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 1183be6..d971f61 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -78,6 +78,7 @@ public: : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) #ifdef Q_WS_MAC , useHIToolBar(false) + , activateUnifiedToolbarAfterFullScreen(false) #endif #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) , hasOldCursor(false) , cursorAdjusted(false) @@ -89,6 +90,7 @@ public: Qt::ToolButtonStyle toolButtonStyle; #ifdef Q_WS_MAC bool useHIToolBar; + bool activateUnifiedToolbarAfterFullScreen; #endif void init(); QList<int> hoverSeparator; @@ -1501,8 +1503,6 @@ bool QMainWindow::event(QEvent *event) \i Before Qt 4.5, if you called showFullScreen() on the main window, the QToolbar would disappear since it is considered to be part of the title bar. Qt 4.5 and up will now work around this by pulling the toolbars out and back into the regular toolbar and vice versa when you swap out. - However, a good practice would be that turning off the unified toolbar before you call - showFullScreen() and restoring it after you call showNormal(). \endlist Setting this back to false will remove these restrictions. diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h index e1b981c..3e1a95d 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/gui/widgets/qmainwindowlayout_p.h @@ -335,6 +335,7 @@ public: void cleanUpMacToolbarItems(); void fixSizeInUnifiedToolbar(QToolBar *tb) const; bool useHIToolBar; + bool activateUnifiedToolbarAfterFullScreen; void syncUnifiedToolbarVisibility(); bool blockVisiblityCheck; #endif |