diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/activeqt/container/container.pro | 40 | ||||
-rw-r--r-- | src/activeqt/control/control.pro | 30 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qhash.cpp | 4 | ||||
-rw-r--r-- | src/gui/dialogs/qfiledialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/dialogs/qfilesystemmodel_p.h | 12 | ||||
-rw-r--r-- | src/gui/dialogs/qmessagebox.cpp | 1 | ||||
-rw-r--r-- | src/gui/image/qpixmapcache.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qaction.cpp | 47 | ||||
-rw-r--r-- | src/gui/kernel/qaction_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qshortcut.cpp | 20 | ||||
-rw-r--r-- | src/gui/kernel/qshortcutmap.cpp | 9 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 5 | ||||
-rw-r--r-- | src/gui/painting/qblendfunctions.cpp | 161 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 92 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 36 | ||||
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 73 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_win.cpp | 12 | ||||
-rw-r--r-- | src/gui/util/qcompleter.cpp | 2 | ||||
-rw-r--r-- | src/src.pro | 2 |
21 files changed, 281 insertions, 285 deletions
diff --git a/src/activeqt/container/container.pro b/src/activeqt/container/container.pro index ceedacf..d654f92 100644 --- a/src/activeqt/container/container.pro +++ b/src/activeqt/container/container.pro @@ -21,25 +21,21 @@ LIBS += -lole32 -loleaut32 !wince*:LIBS += -luser32 -lgdi32 -ladvapi32 win32-g++:LIBS += -luuid -contains(QT_EDITION, OpenSource|Console) { - message( "You are not licensed to use ActiveQt." ) -} else { - HEADERS = ../control/qaxaggregated.h \ - qaxbase.h \ - qaxwidget.h \ - qaxobject.h \ - qaxscript.h \ - qaxselect.h \ - ../shared/qaxtypes.h - - SOURCES = qaxbase.cpp \ - qaxdump.cpp \ - qaxwidget.cpp \ - qaxobject.cpp \ - qaxscript.cpp \ - qaxscriptwrapper.cpp \ - qaxselect.cpp \ - ../shared/qaxtypes.cpp - - FORMS = qaxselect.ui -} +HEADERS = ../control/qaxaggregated.h \ + qaxbase.h \ + qaxwidget.h \ + qaxobject.h \ + qaxscript.h \ + qaxselect.h \ + ../shared/qaxtypes.h + +SOURCES = qaxbase.cpp \ + qaxdump.cpp \ + qaxwidget.cpp \ + qaxobject.cpp \ + qaxscript.cpp \ + qaxscriptwrapper.cpp \ + qaxselect.cpp \ + ../shared/qaxtypes.cpp + +FORMS = qaxselect.ui diff --git a/src/activeqt/control/control.pro b/src/activeqt/control/control.pro index 65b0251..bf3647e 100644 --- a/src/activeqt/control/control.pro +++ b/src/activeqt/control/control.pro @@ -24,20 +24,16 @@ win32-borland:DEFINES += QT_NEEDS_QMAIN LIBS += -luser32 -lole32 -loleaut32 -lgdi32 win32-g++:LIBS += -luuid -contains(QT_EDITION, OpenSource|Console) { - message( "You are not licensed to use ActiveQt." ) -} else { - HEADERS = qaxaggregated.h \ - qaxbindable.h \ - qaxfactory.h \ - ../shared/qaxtypes.h - - SOURCES = qaxserver.cpp \ - qaxserverbase.cpp \ - qaxbindable.cpp \ - qaxfactory.cpp \ - qaxservermain.cpp \ - qaxserverdll.cpp \ - qaxmain.cpp \ - ../shared/qaxtypes.cpp -} +HEADERS = qaxaggregated.h \ + qaxbindable.h \ + qaxfactory.h \ + ../shared/qaxtypes.h + +SOURCES = qaxserver.cpp \ + qaxserverbase.cpp \ + qaxbindable.cpp \ + qaxfactory.cpp \ + qaxservermain.cpp \ + qaxserverdll.cpp \ + qaxmain.cpp \ + ../shared/qaxtypes.cpp diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index f058b36..9298b49 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2276,9 +2276,9 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); | QT_MODULE_GRAPHICSVIEW \ | QT_MODULE_HELP \ | QT_MODULE_TEST \ - | QT_MODULE_DBUS) -#define QT_EDITION_DESKTOP (QT_EDITION_OPENSOURCE \ + | QT_MODULE_DBUS \ | QT_MODULE_ACTIVEQT) +#define QT_EDITION_DESKTOP (QT_EDITION_OPENSOURCE) #define QT_EDITION_UNIVERSAL QT_EDITION_DESKTOP #define QT_EDITION_ACADEMIC QT_EDITION_DESKTOP #define QT_EDITION_EDUCATIONAL QT_EDITION_DESKTOP diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 540f43d..21d98b5 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -91,7 +91,7 @@ static uint hash(const QChar *p, int n) uint qHash(const QByteArray &key) { - return hash(reinterpret_cast<const uchar *>(key.data()), key.size()); + return hash(reinterpret_cast<const uchar *>(key.constData()), key.size()); } uint qHash(const QString &key) @@ -107,7 +107,7 @@ uint qHash(const QStringRef &key) uint qHash(const QBitArray &bitArray) { int m = bitArray.d.size() - 1; - uint result = hash(reinterpret_cast<const uchar *>(bitArray.d.data()), qMax(0, m)); + uint result = hash(reinterpret_cast<const uchar *>(bitArray.d.constData()), qMax(0, m)); // deal with the last 0 to 7 bits manually, because we can't trust that // the padding is initialized to 0 in bitArray.d diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index f70669c..9935a80 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -1437,6 +1437,8 @@ void QFileDialog::setIconProvider(QFileIconProvider *provider) { Q_D(QFileDialog); d->model->setIconProvider(provider); + //It forces the refresh of all entries in the side bar, then we can get new icons + d->qFileDialogUi->sidebar->setUrls(d->qFileDialogUi->sidebar->urls()); } /*! diff --git a/src/gui/dialogs/qfilesystemmodel_p.h b/src/gui/dialogs/qfilesystemmodel_p.h index 77c35a2..0a1265a 100644 --- a/src/gui/dialogs/qfilesystemmodel_p.h +++ b/src/gui/dialogs/qfilesystemmodel_p.h @@ -163,7 +163,11 @@ public: info->icon = iconProvider->icon(QFileInfo(path)); QHash<QString, QFileSystemNode *>::const_iterator iterator; for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) { - iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); + //On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/) + if (!path.isEmpty()) + iterator.value()->updateIcon(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); + else + iterator.value()->updateIcon(iconProvider, iterator.value()->fileName); } } @@ -172,7 +176,11 @@ public: info->displayType = iconProvider->type(QFileInfo(path)); QHash<QString, QFileSystemNode *>::const_iterator iterator; for(iterator = children.constBegin() ; iterator != children.constEnd() ; ++iterator) { - iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); + //On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/) + if (!path.isEmpty()) + iterator.value()->retranslateStrings(iconProvider, path + QLatin1Char('/') + iterator.value()->fileName); + else + iterator.value()->retranslateStrings(iconProvider, iterator.value()->fileName); } } diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 1ddb8f4..456b480 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -1717,6 +1717,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) "to comply with the terms of the GNU GPL version 3.0.</p>" "<p>Please see <a href=\"http://www.qtsoftware.com/products/licensing\">www.qtsoftware.com/products/licensing</a> " "for an overview of Qt licensing.</p>" + "<p>Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).</p>" "<p>Qt is a Nokia product. See <a href=\"http://www.qtsoftware.com/qt/\">www.qtsoftware.com/qt</a> " "for more information.</p>" ).arg(QLatin1String(QT_VERSION_STR)); diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 4253f8d..eedb6a3 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -275,7 +275,8 @@ bool QPixmapCache::insert(const QString &key, const QPixmap &pm) /*! Returns the cache limit (in kilobytes). - The default cache limit is 2048 KB for Embedded, 10240 KB for Desktops. + The default cache limit is 2048 KB for Embedded, 10240 KB for + Desktops. \sa setCacheLimit() */ @@ -288,7 +289,8 @@ int QPixmapCache::cacheLimit() /*! Sets the cache limit to \a n kilobytes. - The default setting is 1024 kilobytes. + The default setting is 2048 KB for Embedded, 10240 KB for + Desktops. \sa cacheLimit() */ diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index c6addc1..921be22 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -136,25 +136,27 @@ void QActionPrivate::redoGrab(QShortcutMap &map) void QActionPrivate::redoGrabAlternate(QShortcutMap &map) { Q_Q(QAction); - foreach (int id, alternateShortcutIds) - if (id) + for (int i = 0; i < alternateShortcutIds.size(); ++i) + if (int id = alternateShortcutIds.at(i)) map.removeShortcut(id, q); alternateShortcutIds.clear(); if (alternateShortcuts.isEmpty()) return; - foreach (const QKeySequence& alternate, alternateShortcuts) { + for (int i = 0; i < alternateShortcuts.size(); ++i) { + const QKeySequence &alternate = alternateShortcuts.at(i); if (!alternate.isEmpty()) alternateShortcutIds.append(map.addShortcut(q, alternate, shortcutContext)); else alternateShortcutIds.append(0); } + if (!enabled) { - foreach (int id, alternateShortcutIds) - map.setShortcutEnabled(false, id, q); + for (int i = 0; i < alternateShortcutIds.size(); ++i) + map.setShortcutEnabled(false, alternateShortcutIds.at(i), q); } if (!autorepeat) { - foreach (int id, alternateShortcutIds) - map.setShortcutAutoRepeat(false, id, q); + for (int i = 0; i < alternateShortcutIds.size(); ++i) + map.setShortcutAutoRepeat(false, alternateShortcutIds.at(i), q); } } @@ -163,10 +165,26 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) Q_Q(QAction); if (shortcutId) map.setShortcutEnabled(enable, shortcutId, q); - foreach (int id, alternateShortcutIds) - if (id) + for (int i = 0; i < alternateShortcutIds.size(); ++i) + if (int id = alternateShortcutIds.at(i)) map.setShortcutEnabled(enable, id, q); } + +void QActionPrivate::removeAll(QShortcutMap &map) +{ + Q_Q(QAction); + if (shortcutId) { + map.removeShortcut(shortcutId, q); + shortcutId = 0; + } + + for (int i = 0; i < alternateShortcutIds.size(); ++i) + if (int id = alternateShortcutIds.at(i)) + map.removeShortcut(id, q); + + alternateShortcutIds.clear(); +} + #endif // QT_NO_SHORTCUT @@ -615,8 +633,8 @@ QAction::~QAction() #ifndef QT_NO_SHORTCUT if (d->shortcutId && qApp) { qApp->d_func()->shortcutMap.removeShortcut(d->shortcutId, this); - foreach (int id, d->alternateShortcutIds) - qApp->d_func()->shortcutMap.removeShortcut(id, this); + for (int i = 0; i < d->alternateShortcutIds.size(); ++i) + qApp->d_func()->shortcutMap.removeShortcut(d->alternateShortcutIds.at(i), this); } #endif } @@ -1049,7 +1067,12 @@ void QAction::setVisible(bool b) d->visible = b; d->enabled = b && !d->forceDisabled && (!d->group || d->group->isEnabled()) ; #ifndef QT_NO_SHORTCUT - d->setShortcutEnabled(d->enabled, qApp->d_func()->shortcutMap); + if (b) { + d->redoGrab(qApp->d_func()->shortcutMap); + d->redoGrabAlternate(qApp->d_func()->shortcutMap); + } else { + d->removeAll(qApp->d_func()->shortcutMap); + } #endif d->sendDataChanged(); } diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h index 0617ef5..a5b3731 100644 --- a/src/gui/kernel/qaction_p.h +++ b/src/gui/kernel/qaction_p.h @@ -111,6 +111,7 @@ public: void redoGrab(QShortcutMap &map); void redoGrabAlternate(QShortcutMap &map); void setShortcutEnabled(bool enable, QShortcutMap &map); + void removeAll(QShortcutMap &map); static QShortcutMap *globalMap; #endif // QT_NO_SHORTCUT diff --git a/src/gui/kernel/qshortcut.cpp b/src/gui/kernel/qshortcut.cpp index 50b6e59..f3c93c6 100644 --- a/src/gui/kernel/qshortcut.cpp +++ b/src/gui/kernel/qshortcut.cpp @@ -385,19 +385,21 @@ bool QShortcut::event(QEvent *e) { Q_D(QShortcut); bool handled = false; - if (d->sc_enabled && e->type() == QEvent::Shortcut) { + if (e->type() == QEvent::Shortcut) { QShortcutEvent *se = static_cast<QShortcutEvent *>(e); if (se->shortcutId() == d->sc_id && se->key() == d->sc_sequence){ + if (d->sc_enabled) { #ifndef QT_NO_WHATSTHIS - if (QWhatsThis::inWhatsThisMode()) { - QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis); - handled = true; - } else + if (QWhatsThis::inWhatsThisMode()) { + QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis); + handled = true; + } else #endif - if (se->isAmbiguous()) - emit activatedAmbiguously(); - else - emit activated(); + if (se->isAmbiguous()) + emit activatedAmbiguously(); + else + emit activated(); + } handled = true; } } diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index ed9654b..9766a69 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -370,9 +370,8 @@ bool QShortcutMap::tryShortcutEvent(QObject *o, QKeyEvent *e) default: break; } - // If nextState is QKeySequence::ExactMatch && identicals.count == 0 - // we've only found disabled shortcuts - return identicalMatches > 0 || result == QKeySequence::PartialMatch; + + return true; } /*! \internal @@ -494,9 +493,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e) // We don't need partials, if we have identicals if (d->identicals.size()) break; - // We only care about enabled partials, so we don't consume - // key events when all partials are disabled! - partialFound |= (*it).enabled; + partialFound = true; } } ++it; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 3e25ffc..9f5f18d 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2234,9 +2234,10 @@ WId QWidget::effectiveWinId() const The style sheet contains a textual description of customizations to the widget's style, as described in the \l{Qt Style Sheets} document. - \note Qt style sheets are currently not supported for QMacStyle - (the default style on Mac OS X). We plan to address this in some future - release. + Since Qt 4.5, Qt style sheets fully supports Mac OS X. + + \warning Qt style sheets are currently not supported for custom QStyle + subclasses. We plan to address this in some future release. \sa setStyle(), QApplication::styleSheet, {Qt Style Sheets} */ diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index ec05f12..013fc1e 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4612,8 +4612,11 @@ void QWidgetPrivate::setModal_sys() if (windowParent && q->windowModality() == Qt::WindowModal){ // Window should be window-modal, which implies a sheet. - if (!alreadySheet) + if (!alreadySheet) { + // NB: the following call will call setModal_sys recursivly: recreateMacWindow(); + windowRef = qt_mac_window_for(q); + } if ([windowRef isKindOfClass:[NSPanel class]]){ // If the primary window of the sheet parent is a child of a modal dialog, // the sheet parent should not be modally shaddowed. diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 6589439..dd7b016 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -44,19 +44,6 @@ QT_BEGIN_NAMESPACE - -// This ifdef is made with the best of intention. GCC fails to -// optimzie the code properly so the bytemul approach is the fastest -// it gets. Both on ARM and on MSVC the code is optimized to be better -// than the bytemul approach... On the other hand... This code is -// almost never run on i386 so it may be downright silly to have this -// piece of code here... -#if defined (Q_CC_GNU) && (defined (QT_ARCH_I386) || defined (QT_ARCH_X86_64)) -# define QT_BLEND_USE_BYTEMUL -#endif - -// #define QT_DEBUG_DRAW - static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; struct SourceOnlyAlpha @@ -286,7 +273,7 @@ static void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl, int const_alpha) { #ifdef QT_DEBUG_DRAW - printf("qt_blend_argb16_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n", + printf("qt_blend_rgb16_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n", dst, dbpl, src, sbpl, w, h, const_alpha); #endif @@ -347,11 +334,6 @@ template <typename T> void qt_blend_argb24_on_rgb16(uchar *destPixels, int dbpl, if (alpha == 255) { *dst = spix; } else if (alpha != 0) { -#ifdef QT_BLEND_USE_BYTEMUL - // truncate green channel to avoid overflow - *dst = (alphaFunc.bytemul(spix) & 0xffdf) - + (quint16) qrgb565(*dst).byte_mul(qrgb565::ialpha(alpha)); -#else quint16 dpix = *dst; quint32 sia = 255 - alpha; @@ -363,12 +345,11 @@ template <typename T> void qt_blend_argb24_on_rgb16(uchar *destPixels, int dbpl, quint32 siag = dg * sia; quint32 siab = db * sia; - quint32 rr = ((siar + (siar>>8) + (0x80 << 11)) >> 8) & 0xf800; - quint32 rg = ((siag + (siag>>8) + (0x80 << 5)) >> 8) & 0x07e0; - quint32 rb = ((siab + (siab>>8) + (0x80 >> 3)) >> 8); + quint32 rr = ((siar + (siar>>8) + (0x80 << 8)) >> 8) & 0xf800; + quint32 rg = ((siag + (siag>>8) + (0x80 << 3)) >> 8) & 0x07e0; + quint32 rb = ((siab + (siab>>8) + (0x80 >> 3)) >> 8) & 0x001f; *dst = alphaFunc.bytemul(spix) + rr + rg + rb; -#endif } ++dst; @@ -435,113 +416,45 @@ static void qt_blend_argb32_on_rgb16(uchar *destPixels, int dbpl, } quint16 *dst = (quint16 *) destPixels; - int dstExtraStride = dbpl / 2 - w; - - const quint32 *src = (const quint32 *) srcPixels; - int srcExtraStride = sbpl / 4 - w; + quint32 *src = (quint32 *) srcPixels; for (int y=0; y<h; ++y) { - int length = w; - const int dstAlign = ((quintptr)dst) & 0x3; - if (dstAlign) { - const quint8 alpha = qAlpha(*src); - if (alpha) { - quint16 s = convert_argb32_to_rgb16(*src); - if (alpha < 255) - s += BYTE_MUL_RGB16(*dst, 255 - alpha); - *dst = s; - } - ++dst; - ++src; - --length; - } + for (int x=0; x<w; ++x) { - const int length32 = length >> 1; - const int srcAlign = ((quintptr)src) & 0x3; - if (length32) { - if (srcAlign) { - for (int i = 0; i < length32; ++i) { - quint32 *dest32 = reinterpret_cast<quint32*>(dst); - const quint8 a1 = qAlpha(src[0]); - const quint8 a2 = qAlpha(src[1]); - quint32 s; - - if (!a1 && !a2) { - src += 2; - dst +=2; - continue; - } - - s = convert_argb32_to_rgb16(src[0]) - | (convert_argb32_to_rgb16(src[1]) << 16); - - if (a1 == a2) { - if (a1 < 255) { - const quint8 sa = ((255 - a1)+1) >> 3; - s += BYTE_MUL_RGB16_32(*dest32, sa); - } - } else { - if (a1 < 255) - s += BYTE_MUL_RGB16(dst[0], 255 - a1); - if (a2 < 255) - s += BYTE_MUL_RGB16(dst[1], 255 - a2) << 16; - } - - *dest32 = s; - src += 2; - dst += 2; - } - } else { - for (int i = 0; i < length32; ++i) { - quint32 *dest32 = reinterpret_cast<quint32*>(dst); - const quint8 a1 = qAlpha(src[0]); - const quint8 a2 = qAlpha(src[1]); - quint32 s; - - if (!a1 && !a2) { - src += 2; - dst +=2; - continue; - } - - const quint64 *src64 = - reinterpret_cast<const quint64*>(src); - s = qConvertRgb32To16x2(*src64); - - if (a1 == a2) { - if (a1 < 255) { - const quint8 sa = ((255 - a1)+1) >> 3; - s += BYTE_MUL_RGB16_32(*dest32, sa); - } - } else { - if (a1 < 255) - s += BYTE_MUL_RGB16(dst[0], 255 - a1); - if (a2 < 255) - s += BYTE_MUL_RGB16(dst[1], 255 - a2) << 16; - } - - *dest32 = s; - src += 2; - dst += 2; - } - } - } - const int tail = length & 0x1; - if (tail) { - const quint8 alpha = qAlpha(*src); - if (alpha) { - quint16 s = convert_argb32_to_rgb16(*src); - if (alpha < 255) - s += BYTE_MUL_RGB16(*dst, 255 - alpha); - *dst = s; + quint32 spix = src[x]; + quint32 alpha = spix >> 24; + + if (alpha == 255) { + dst[x] = convert_argb32_to_rgb16(spix); + } else if (alpha != 0) { + quint32 dpix = dst[x]; + + quint32 sia = 255 - alpha; + + quint32 sr = (spix >> 8) & 0xf800; + quint32 sg = (spix >> 5) & 0x07e0; + quint32 sb = (spix >> 3) & 0x001f; + + quint32 dr = (dpix & 0x0000f800); + quint32 dg = (dpix & 0x000007e0); + quint32 db = (dpix & 0x0000001f); + + quint32 siar = dr * sia; + quint32 siag = dg * sia; + quint32 siab = db * sia; + + quint32 rr = sr + ((siar + (siar>>8) + (0x80 << 8)) >> 8); + quint32 rg = sg + ((siag + (siag>>8) + (0x80 << 3)) >> 8); + quint32 rb = sb + ((siab + (siab>>8) + (0x80 >> 3)) >> 8); + + dst[x] = (rr & 0xf800) + | (rg & 0x07e0) + | (rb); } - ++dst; - ++src; } - dst += dstExtraStride; - src += srcExtraStride; + dst = (quint16 *) (((uchar *) dst) + dbpl); + src = (quint32 *) (((uchar *) src) + sbpl); } - } diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 63e14ca..ec4737c 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -311,7 +311,7 @@ Q_STATIC_TEMPLATE_FUNCTION void QT_FASTCALL destStore(QRasterBuffer *rasterBuffe const uint *buffer, int length) { DST *dest = reinterpret_cast<DST*>(rasterBuffer->scanLine(y)) + x; - const quint32 *src = reinterpret_cast<const quint32*>(buffer); + const quint32p *src = reinterpret_cast<const quint32p*>(buffer); while (length--) *dest++ = DST(*src++); } @@ -4517,7 +4517,7 @@ void QT_FASTCALL blendUntransformed(int count, const QSpan *spans, void *userDat static void blend_untransformed_rgb888(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_RGB888) @@ -4530,7 +4530,7 @@ static void blend_untransformed_rgb888(int count, const QSpan *spans, static void blend_untransformed_argb6666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -4545,7 +4545,7 @@ static void blend_untransformed_argb6666(int count, const QSpan *spans, static void blend_untransformed_rgb666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -4560,7 +4560,7 @@ static void blend_untransformed_rgb666(int count, const QSpan *spans, static void blend_untransformed_argb8565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -4575,7 +4575,7 @@ static void blend_untransformed_argb8565(int count, const QSpan *spans, static void blend_untransformed_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -4590,7 +4590,7 @@ static void blend_untransformed_rgb565(int count, const QSpan *spans, static void blend_untransformed_argb8555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -4605,7 +4605,7 @@ static void blend_untransformed_argb8555(int count, const QSpan *spans, static void blend_untransformed_rgb555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -4620,7 +4620,7 @@ static void blend_untransformed_rgb555(int count, const QSpan *spans, static void blend_untransformed_argb4444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -4635,7 +4635,7 @@ static void blend_untransformed_argb4444(int count, const QSpan *spans, static void blend_untransformed_rgb444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -4826,7 +4826,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTiled(int count, const QSpan *spans, void * static void blend_tiled_rgb888(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_RGB888) @@ -4838,7 +4838,7 @@ static void blend_tiled_rgb888(int count, const QSpan *spans, void *userData) static void blend_tiled_argb6666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -4852,7 +4852,7 @@ static void blend_tiled_argb6666(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -4866,7 +4866,7 @@ static void blend_tiled_rgb666(int count, const QSpan *spans, void *userData) static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -4880,7 +4880,7 @@ static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -4894,7 +4894,7 @@ static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) static void blend_tiled_argb8555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -4908,7 +4908,7 @@ static void blend_tiled_argb8555(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -4922,7 +4922,7 @@ static void blend_tiled_rgb555(int count, const QSpan *spans, void *userData) static void blend_tiled_argb4444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -4936,7 +4936,7 @@ static void blend_tiled_argb4444(int count, const QSpan *spans, void *userData) static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5330,7 +5330,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan static void blend_transformed_bilinear_rgb888(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_RGB888) @@ -5342,7 +5342,7 @@ static void blend_transformed_bilinear_rgb888(int count, const QSpan *spans, voi static void blend_transformed_bilinear_argb6666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5356,7 +5356,7 @@ static void blend_transformed_bilinear_argb6666(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5370,7 +5370,7 @@ static void blend_transformed_bilinear_rgb666(int count, const QSpan *spans, voi static void blend_transformed_bilinear_argb8565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5385,7 +5385,7 @@ static void blend_transformed_bilinear_argb8565(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_RGB16) @@ -5399,7 +5399,7 @@ static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, static void blend_transformed_bilinear_argb8555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5413,7 +5413,7 @@ static void blend_transformed_bilinear_argb8555(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -5427,7 +5427,7 @@ static void blend_transformed_bilinear_rgb555(int count, const QSpan *spans, voi static void blend_transformed_bilinear_argb4444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5441,7 +5441,7 @@ static void blend_transformed_bilinear_argb4444(int count, const QSpan *spans, v static void blend_transformed_bilinear_rgb444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -5914,7 +5914,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformed(int count, const QSpan *spans, static void blend_transformed_rgb888(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_RGB888) @@ -5927,7 +5927,7 @@ static void blend_transformed_rgb888(int count, const QSpan *spans, static void blend_transformed_argb6666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5942,7 +5942,7 @@ static void blend_transformed_argb6666(int count, const QSpan *spans, static void blend_transformed_rgb666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -5957,7 +5957,7 @@ static void blend_transformed_rgb666(int count, const QSpan *spans, static void blend_transformed_argb8565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5972,7 +5972,7 @@ static void blend_transformed_argb8565(int count, const QSpan *spans, static void blend_transformed_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5987,7 +5987,7 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, static void blend_transformed_argb8555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6002,7 +6002,7 @@ static void blend_transformed_argb8555(int count, const QSpan *spans, static void blend_transformed_rgb555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6017,7 +6017,7 @@ static void blend_transformed_rgb555(int count, const QSpan *spans, static void blend_transformed_argb4444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6032,7 +6032,7 @@ static void blend_transformed_argb4444(int count, const QSpan *spans, static void blend_transformed_rgb444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6327,7 +6327,7 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedTiled(int count, const QSpan *sp static void blend_transformed_tiled_rgb888(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_24) +#if defined(QT_QWS_DEPTH_24) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_RGB888) @@ -6340,7 +6340,7 @@ static void blend_transformed_tiled_rgb888(int count, const QSpan *spans, static void blend_transformed_tiled_argb6666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6355,7 +6355,7 @@ static void blend_transformed_tiled_argb6666(int count, const QSpan *spans, static void blend_transformed_tiled_rgb666(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_18) +#if defined(QT_QWS_DEPTH_18) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) @@ -6370,7 +6370,7 @@ static void blend_transformed_tiled_rgb666(int count, const QSpan *spans, static void blend_transformed_tiled_argb8565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6385,7 +6385,7 @@ static void blend_transformed_tiled_argb8565(int count, const QSpan *spans, static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) +#if defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6400,7 +6400,7 @@ static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, static void blend_transformed_tiled_argb8555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6415,7 +6415,7 @@ static void blend_transformed_tiled_argb8555(int count, const QSpan *spans, static void blend_transformed_tiled_rgb555(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_15) +#if defined(QT_QWS_DEPTH_15) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) @@ -6430,7 +6430,7 @@ static void blend_transformed_tiled_rgb555(int count, const QSpan *spans, static void blend_transformed_tiled_argb4444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) @@ -6445,7 +6445,7 @@ static void blend_transformed_tiled_argb4444(int count, const QSpan *spans, static void blend_transformed_tiled_rgb444(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_12) +#if defined(QT_QWS_DEPTH_12) QSpanData *data = reinterpret_cast<QSpanData *>(userData); if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 8e3d822..d2b1ed7 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1144,6 +1144,33 @@ void QRasterPaintEnginePrivate::updateMatrixData(QSpanData *spanData, const QBru } } +// #define QT_CLIPPING_RATIOS + +#ifdef QT_CLIPPING_RATIOS +int rectClips; +int regionClips; +int totalClips; + +static void checkClipRatios(QRasterPaintEnginePrivate *d) +{ + if (d->clip()->hasRectClip) + rectClips++; + if (d->clip()->hasRegionClip) + regionClips++; + totalClips++; + + if ((totalClips % 5000) == 0) { + printf("Clipping ratio: rectangular=%f%%, region=%f%%, complex=%f%%\n", + rectClips * 100.0 / (qreal) totalClips, + regionClips * 100.0 / (qreal) totalClips, + (totalClips - rectClips - regionClips) * 100.0 / (qreal) totalClips); + totalClips = 0; + rectClips = 0; + regionClips = 0; + } + +} +#endif /*! \internal @@ -1245,6 +1272,10 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) d->solid_color_filler.clip = d->clip(); d->solid_color_filler.adjustSpanMethods(); + +#ifdef QT_CLIPPING_RATIOS + checkClipRatios(d); +#endif } @@ -1319,6 +1350,11 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) d->solid_color_filler.clip = d->clip(); d->solid_color_filler.adjustSpanMethods(); + + +#ifdef QT_CLIPPING_RATIOS + checkClipRatios(d); +#endif } /*! diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index d5ce8df..be80d37 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1780,7 +1780,46 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, case CE_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { drawControl(CE_TabBarTabShape, tab, p, widget); - drawControl(CE_TabBarTabLabel, tab, p, widget); + + QStyleOptionTabV3 tabV3(*tab); + QRect labelRect = tabV3.rect; + QSize &left= tabV3.leftButtonSize; + QSize &right = tabV3.rightButtonSize; + const int spacing = 6 + 2; + + // left widget + if (!left.isEmpty()) { + if (tabV3.shape == QTabBar::RoundedEast || tabV3.shape == QTabBar::TriangularEast ) + labelRect.setTop(labelRect.top() + spacing + left.height()); + else if (tabV3.shape == QTabBar::RoundedWest|| tabV3.shape == QTabBar::TriangularWest) + labelRect.setBottom(labelRect.bottom() - spacing - left.height()); + else + labelRect.setLeft(labelRect.left() + spacing + left.width()); + } + + // right widget + if (!right.isEmpty()) { + if (tabV3.shape == QTabBar::RoundedEast || tabV3.shape == QTabBar::TriangularEast ) + labelRect.setBottom(labelRect.bottom() - spacing - right.height()); + else if (tabV3.shape == QTabBar::RoundedWest|| tabV3.shape == QTabBar::TriangularWest) + labelRect.setTop(labelRect.top() + spacing + right.height()); + else + labelRect.setRight(labelRect.right() - spacing - right.width()); + } + + tabV3.rect = visualRect(opt->direction, opt->rect, labelRect); + drawControl(CE_TabBarTabLabel, &tabV3, p, widget); + if (tabV3.state & State_HasFocus) { + const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); + int x1, x2; + x1 = tab->rect.left(); + x2 = tab->rect.right() - 1; + QStyleOptionFocusRect fropt; + fropt.QStyleOption::operator=(*tab); + fropt.rect.setRect(x1 + 1 + OFFSET, tab->rect.y() + OFFSET, + x2 - x1 - 2*OFFSET, tab->rect.height() - 2*OFFSET); + drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); + } } break; case CE_TabBarTabShape: @@ -1982,12 +2021,8 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, (tabV2.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); - int offset = 4; + int offset = 6; int left = opt->rect.left(); - if (tabV2.leftButtonSize.isEmpty()) - offset += 2; - else - left += tabV2.leftButtonSize.width() + (6 + 2) + 2; QRect iconRect = QRect(left + offset, tr.center().y() - tabIcon.height() / 2, tabIconSize.width(), tabIconSize.height()); if (!verticalTabs) @@ -1998,20 +2033,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText); if (verticalTabs) p->restore(); - - if (tabV2.state & State_HasFocus) { - const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); - - int x1, x2; - x1 = tabV2.rect.left(); - x2 = tabV2.rect.right() - 1; - - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*tab); - fropt.rect.setRect(x1 + 1 + OFFSET, tabV2.rect.y() + OFFSET, - x2 - x1 - 2*OFFSET, tabV2.rect.height() - 2*OFFSET); - drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); - } } break; #endif // QT_NO_TABBAR @@ -2859,12 +2880,6 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, tr.setRight(tr.right() - horizontalShift); } - // left widget - if (!tabV2.leftButtonSize.isEmpty()) { - tr.setLeft(tr.left() + 6 + 2 + - (verticalTabs ? tabV2.leftButtonSize.height() : tabV2.leftButtonSize.width())); - } - // icon if (!tabV2.icon.isNull()) { QSize iconSize = tabV2.iconSize; @@ -2886,12 +2901,6 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, tr.setLeft(tr.left() + tabIconSize.width() + offset + 2); } - // right widget - if (!tabV2.rightButtonSize.isEmpty()) { - tr.setRight(tr.right() - 6 - 2 - - (verticalTabs ? tabV2.rightButtonSize.height() : tabV2.rightButtonSize.width())); - } - if (!verticalTabs) tr = visualRect(opt->direction, opt->rect, tr); r = tr; diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp index c9f5586..780ae28 100644 --- a/src/gui/text/qfontdatabase_win.cpp +++ b/src/gui/text/qfontdatabase_win.cpp @@ -699,6 +699,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ } bool stockFont = false; + bool preferClearTypeAA = false; HFONT hfont = 0; @@ -799,10 +800,12 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ #endif if (request.styleStrategy & QFont::PreferAntialias) { - if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP) + if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP) { qual = 5; // == CLEARTYPE_QUALITY; - else + preferClearTypeAA = true; + } else { qual = ANTIALIASED_QUALITY; + } } else if (request.styleStrategy & QFont::NoAntialias) { qual = NONANTIALIASED_QUALITY; } @@ -884,6 +887,9 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ } QFontEngineWin *few = new QFontEngineWin(font_name, hfont, stockFont, lf); + if (preferClearTypeAA) + few->glyphFormat = QFontEngineGlyphCache::Raster_RGBMask; + // Also check for OpenType tables when using complex scripts // ### TODO: This only works for scripts that require OpenType. More generally // for scripts that do not require OpenType we should just look at the list of @@ -1134,7 +1140,7 @@ static void getFamiliesAndSignatures(const QByteArray &fontData, QFontDatabasePr signature.fsUsb[1] = qFromBigEndian<quint32>(table + 46); signature.fsUsb[2] = qFromBigEndian<quint32>(table + 50); signature.fsUsb[3] = qFromBigEndian<quint32>(table + 54); - + signature.fsCsb[0] = qFromBigEndian<quint32>(table + 78); signature.fsCsb[1] = qFromBigEndian<quint32>(table + 82); } diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index 7571dfe..a622385 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -1080,7 +1080,7 @@ void QCompleter::setPopup(QAbstractItemView *popup) popup->hide(); popup->setParent(0, Qt::Popup); - Qt::FocusPolicy origPolicy; + Qt::FocusPolicy origPolicy = Qt::NoFocus; if (d->widget) origPolicy = d->widget->focusPolicy(); popup->setFocusPolicy(Qt::NoFocus); diff --git a/src/src.pro b/src/src.pro index fb28882..f40c6ad 100644 --- a/src/src.pro +++ b/src/src.pro @@ -13,7 +13,7 @@ wince*:{ contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_tools_uic3 } } -win32:!contains(QT_EDITION, OpenSource|Console): { +win32:{ SRC_SUBDIRS += src_activeqt !wince*: SRC_SUBDIRS += src_tools_idc } |