diff options
author | axis <qt-info@nokia.com> | 2009-11-09 08:28:40 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-11-09 08:28:40 (GMT) |
commit | 7fdfa58b958b658feb7b20dd7a7322d235fe4bea (patch) | |
tree | 6c38ed48f7c234ad480aa8ce178b9a00b14d2440 /src/plugins | |
parent | 7ea04bf5c065a037b2db667572e1947f1a1b8b2e (diff) | |
parent | 68409c24211b4639832ce86113c33a247bb68950 (diff) | |
download | Qt-7fdfa58b958b658feb7b20dd7a7322d235fe4bea.zip Qt-7fdfa58b958b658feb7b20dd7a7322d235fe4bea.tar.gz Qt-7fdfa58b958b658feb7b20dd7a7322d235fe4bea.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6-s60
Conflicts:
src/gui/painting/qblendfunctions.cpp
Diffstat (limited to 'src/plugins')
4 files changed, 106 insertions, 86 deletions
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index aa51759..87d81f0 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -256,9 +256,9 @@ QString QAccessibleButton::localizedName(int actionIndex) QStringList QAccessibleButton::keyBindings(int actionIndex) { switch (actionIndex) { -#ifdef QT_NO_SHORTCUT +#ifndef QT_NO_SHORTCUT case 0: - return button()->shortcut().toString(); + return QStringList() << button()->shortcut().toString(); #endif default: return QStringList(); @@ -602,6 +602,44 @@ int QAccessibleDisplay::navigate(RelationFlag rel, int entry, QAccessibleInterfa return QAccessibleWidgetEx::navigate(rel, entry, target); } +/*! \reimp */ +QString QAccessibleDisplay::imageDescription() +{ + return widget()->toolTip(); +} + +/*! \reimp */ +QSize QAccessibleDisplay::imageSize() +{ + QLabel *label = qobject_cast<QLabel *>(widget()); + if (!label) + return QSize(); + const QPixmap *pixmap = label->pixmap(); + if (!pixmap) + return QSize(); + return pixmap->size(); +} + +/*! \reimp */ +QRect QAccessibleDisplay::imagePosition(QAccessible2::CoordinateType coordType) +{ + QLabel *label = qobject_cast<QLabel *>(widget()); + if (!label) + return QRect(); + const QPixmap *pixmap = label->pixmap(); + if (!pixmap) + return QRect(); + + switch (coordType) { + case QAccessible2::RelativeToScreen: + return QRect(label->mapToGlobal(label->pos()), label->size()); + case QAccessible2::RelativeToParent: + return label->geometry(); + } + + return QRect(); +} + #ifndef QT_NO_LINEEDIT /*! \class QAccessibleLineEdit diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h index 0c1cf5e..5182bdd 100644 --- a/src/plugins/accessible/widgets/simplewidgets.h +++ b/src/plugins/accessible/widgets/simplewidgets.h @@ -111,7 +111,7 @@ protected: }; #endif // QT_NO_TOOLBUTTON -class QAccessibleDisplay : public QAccessibleWidgetEx +class QAccessibleDisplay : public QAccessibleWidgetEx, public QAccessibleImageInterface { Q_ACCESSIBLE_OBJECT public: @@ -122,6 +122,11 @@ public: Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const; int navigate(RelationFlag, int entry, QAccessibleInterface **target) const; + + // QAccessibleImageInterface + QString imageDescription(); + QSize imageSize(); + QRect imagePosition(QAccessible2::CoordinateType coordType); }; #ifndef QT_NO_LINEEDIT diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index dd6b0d3..c86af73 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -68,9 +68,11 @@ public: }; enum CompositionModeStatus { - PorterDuff_None = 0x0, - PorterDuff_SupportedBlits = 0x1, - PorterDuff_SupportedPrimitives = 0x2 + PorterDuff_None = 0x00, + PorterDuff_SupportedBlits = 0x01, + PorterDuff_SupportedPrimitives = 0x02, + PorterDuff_SupportedOpaquePrimitives = 0x04, + PorterDuff_Dirty = 0x10 }; enum ClipType { @@ -95,6 +97,7 @@ public: inline void unlock(); static inline void unlock(QDirectFBPaintDevice *device); + inline bool testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color = 0) const; inline bool isSimpleBrush(const QBrush &brush) const; void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos); @@ -404,11 +407,11 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen) return; - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) + if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) || !d->simplePen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush)) { + || !d->isSimpleBrush(brush) + || !d->testCompositionMode(&pen, &brush)) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); @@ -434,11 +437,11 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen) return; - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) + if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) || !d->simplePen || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush)) { + || !d->isSimpleBrush(brush) + || !d->testCompositionMode(&pen, &brush)) { RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); @@ -460,16 +463,16 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) { Q_D(QDirectFBPaintEngine); - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || !d->simplePen - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) { + const QPen &pen = state()->pen; + if (!d->simplePen + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->testCompositionMode(&pen, 0)) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; } - const QPen &pen = state()->pen; if (pen.style() != Qt::NoPen) { d->setDFBColor(pen.color()); CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLine>)(lines, lineCount, state()->matrix, d->surface)); @@ -480,16 +483,16 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) { Q_D(QDirectFBPaintEngine); - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || !d->simplePen - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) { + const QPen &pen = state()->pen; + if (!d->simplePen + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->testCompositionMode(&pen, 0)) { RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; } - const QPen &pen = state()->pen; if (pen.style() != Qt::NoPen) { d->setDFBColor(pen.color()); CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines<QLineF>)(lines, lineCount, state()->matrix, d->surface)); @@ -714,8 +717,8 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) if (d->clipType != QDirectFBPaintEnginePrivate::ComplexClip) { switch (brush.style()) { case Qt::SolidPattern: { - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)) { + if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported + || !d->testCompositionMode(0, &brush)) { break; } const QColor color = brush.color(); @@ -753,9 +756,9 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) if (!color.isValid()) return; Q_D(QDirectFBPaintEngine); - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) { + if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) + || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip + || !d->testCompositionMode(0, 0, &color)) { RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG()); d->lock(); QRasterPaintEngine::fillRect(rect, color); @@ -815,6 +818,36 @@ bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); } +bool QDirectFBPaintEnginePrivate::testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color) const +{ + Q_ASSERT(!pen || pen->style() == Qt::NoPen || pen->style() == Qt::SolidLine); + Q_ASSERT(!brush || brush->style() == Qt::NoBrush || brush->style() == Qt::SolidPattern); + switch (compositionModeStatus & (QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives + |QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)) { + case QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives: + return true; + case QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives: + if (pen && pen->style() == Qt::SolidLine && pen->color().alpha() != 255) + return false; + if (brush) { + if (brush->style() == Qt::SolidPattern && brush->color().alpha() != 255) { + return false; + } + } else if (color && color->alpha() != 255) { + return false; + } + return true; + case QDirectFBPaintEnginePrivate::PorterDuff_None: + return false; + default: + // ### PorterDuff_SupportedOpaquePrimitives|PorterDuff_SupportedPrimitives can't be combined + break; + } + Q_ASSERT(0); + return false; +} + + void QDirectFBPaintEnginePrivate::lock() { // We will potentially get a new pointer to the buffer after a @@ -888,6 +921,7 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m break; case QPainter::CompositionMode_Source: surface->SetPorterDuff(surface, DSPD_SRC); + compositionModeStatus |= PorterDuff_SupportedOpaquePrimitives; break; case QPainter::CompositionMode_SourceOver: compositionModeStatus |= PorterDuff_SupportedPrimitives; @@ -945,6 +979,9 @@ void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) } surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); surface->SetBlittingFlags(surface, blittingFlags); + if (compositionModeStatus & PorterDuff_Dirty) { + setCompositionMode(q->state()->composition_mode); + } } static inline uint ALPHA_MUL(uint x, uint a) @@ -962,6 +999,7 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) surface->SetColor(surface, color.red(), color.green(), color.blue(), alpha); surface->SetPorterDuff(surface, DSPD_NONE); surface->SetDrawingFlags(surface, alpha == 255 ? DSDRAW_NOFX : DSDRAW_BLEND); + compositionModeStatus |= PorterDuff_Dirty; } IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release) diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index c1410a6..1dec9ea 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -271,67 +271,6 @@ int PvrEglScreen::transformation() const #endif -#ifndef QT_NO_QWS_TRANSFORMED - -static const QScreen *parentScreen - (const QScreen *current, const QScreen *lookingFor) -{ - if (!current) - return 0; - switch (current->classId()) { - case QScreen::ProxyClass: - case QScreen::TransformedClass: { - const QScreen *child = - static_cast<const QProxyScreen *>(current)->screen(); - if (child == lookingFor) - return current; - else - return parentScreen(child, lookingFor); - } - // Not reached. - - case QScreen::MultiClass: { - QList<QScreen *> screens = current->subScreens(); - foreach (QScreen *screen, screens) { - if (screen == lookingFor) - return current; - const QScreen *parent = parentScreen(screen, lookingFor); - if (parent) - return parent; - } - } - break; - - default: break; - } - return 0; -} - -int PvrEglScreen::transformation() const -{ - // We need to search for our parent screen, which is assumed to be - // "Transformed". If it isn't, then there is no transformation. - // There is no direct method to get the parent screen so we need - // to search every screen until we find ourselves. - if (!parent && qt_screen != this) - parent = parentScreen(qt_screen, this); - if (!parent) - return 0; - if (parent->classId() != QScreen::TransformedClass) - return 0; - return 90 * static_cast<const QTransformedScreen *>(parent) - ->transformation(); -} - -#else - -int PvrEglScreen::transformation() const -{ - return 0; -} - -#endif - void PvrEglScreen::sync() { // Put code here to synchronize 2D and 3D operations if necessary. |