summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qiconloader.cpp8
-rw-r--r--src/gui/image/qimage.cpp39
-rw-r--r--src/gui/image/qxpmhandler.cpp2
-rw-r--r--src/gui/kernel/qcursor.cpp6
-rw-r--r--src/gui/kernel/qevent.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.cpp10
-rw-r--r--src/gui/kernel/qoffscreensurface.cpp1
-rw-r--r--src/gui/kernel/qplatformmenu.h2
-rw-r--r--src/gui/kernel/qplatformtheme.cpp6
-rw-r--r--src/gui/kernel/qplatformtheme.h2
-rw-r--r--src/gui/kernel/qplatformtheme_p.h2
-rw-r--r--src/gui/kernel/qsurfaceformat.h6
-rw-r--r--src/gui/kernel/qwindow.cpp2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp2
-rw-r--r--src/gui/painting/qdrawhelper.cpp12
-rw-r--r--src/gui/painting/qdrawhelper_p.h1
-rw-r--r--src/gui/painting/qregion.cpp2
-rw-r--r--src/gui/text/qcssparser.cpp2
-rw-r--r--src/gui/text/qfontengine.cpp59
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/gui/text/qfontengine_p.h7
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtexthtmlparser.cpp3
-rw-r--r--src/gui/text/qtexthtmlparser_p.h2
24 files changed, 117 insertions, 65 deletions
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 0faf8820dd..e61a6bb48e 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -168,7 +168,7 @@ class QIconCacheGtkReader
{
public:
explicit QIconCacheGtkReader(const QString &themeDir);
- QVector<const char *> lookup(const QString &);
+ QVector<const char *> lookup(const QStringRef &);
bool isValid() const { return m_isValid; }
private:
QFile m_file;
@@ -241,7 +241,7 @@ static quint32 icon_name_hash(const char *p)
with this name is present. The char* are pointers to the mapped data.
For example, this would return { "32x32/apps", "24x24/apps" , ... }
*/
-QVector<const char *> QIconCacheGtkReader::lookup(const QString &name)
+QVector<const char *> QIconCacheGtkReader::lookup(const QStringRef &name)
{
QVector<const char *> ret;
if (!isValid())
@@ -394,7 +394,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
const QStringList contentDirs = theme.contentDirs();
- QString iconNameFallback = iconName;
+ QStringRef iconNameFallback(&iconName);
// Iterate through all icon's fallbacks in current theme
while (info.entries.isEmpty()) {
@@ -451,7 +451,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
}
if (!info.entries.isEmpty()) {
- info.iconName = iconNameFallback;
+ info.iconName = iconNameFallback.toString();
break;
}
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 9b14500e7a..8bbcfa612d 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2129,7 +2129,7 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format,
*/
QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags) const
{
- if (d->format == format)
+ if (!d || d->format == format)
return *this;
if (format <= QImage::Format_Indexed8 && depth() == 32) {
@@ -3014,6 +3014,37 @@ template<class T> inline void do_mirror_data(QImageData *dst, QImageData *src,
}
}
+inline void do_flip(QImageData *dst, QImageData *src, int w, int h, int depth)
+{
+ const int data_bytes_per_line = w * (depth / 8);
+ if (dst == src) {
+ uint *srcPtr = reinterpret_cast<uint *>(src->data);
+ uint *dstPtr = reinterpret_cast<uint *>(dst->data + (h - 1) * dst->bytes_per_line);
+ h = h / 2;
+ const int uint_per_line = (data_bytes_per_line + 3) >> 2; // bytes per line must be a multiple of 4
+ for (int y = 0; y < h; ++y) {
+ // This is auto-vectorized, no need for SSE2 or NEON versions:
+ for (int x = 0; x < uint_per_line; x++) {
+ const uint d = dstPtr[x];
+ const uint s = srcPtr[x];
+ dstPtr[x] = s;
+ srcPtr[x] = d;
+ }
+ srcPtr += src->bytes_per_line >> 2;
+ dstPtr -= dst->bytes_per_line >> 2;
+ }
+
+ } else {
+ const uchar *srcPtr = src->data;
+ uchar *dstPtr = dst->data + (h - 1) * dst->bytes_per_line;
+ for (int y = 0; y < h; ++y) {
+ memcpy(dstPtr, srcPtr, data_bytes_per_line);
+ srcPtr += src->bytes_per_line;
+ dstPtr -= dst->bytes_per_line;
+ }
+ }
+}
+
inline void do_mirror(QImageData *dst, QImageData *src, bool horizontal, bool vertical)
{
Q_ASSERT(src->width == dst->width && src->height == dst->height && src->depth == dst->depth);
@@ -3026,6 +3057,12 @@ inline void do_mirror(QImageData *dst, QImageData *src, bool horizontal, bool ve
depth = 8;
}
+ if (vertical && !horizontal) {
+ // This one is simple and common, so do it a little more optimized
+ do_flip(dst, src, w, h, depth);
+ return;
+ }
+
int dstX0 = 0, dstXIncr = 1;
int dstY0 = 0, dstYIncr = 1;
if (horizontal) {
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index 756e31318f..1f1f6b388f 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -80,7 +80,7 @@ static const int xpmRgbTblSize = 657;
static const struct XPMRGBData {
uint value;
- const char *name;
+ const char name[21];
} xpmRgbTbl[] = {
{ QRGB(240,248,255), "aliceblue" },
{ QRGB(250,235,215), "antiquewhite" },
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index dad6a1f382..b7035d47c4 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -374,9 +374,6 @@ QDataStream &operator>>(QDataStream &s, QCursor &c)
because this size is supported on all platforms. Some platforms
also support 16 x 16, 48 x 48, and 64 x 64 cursors.
- \note On Windows CE, the cursor size is fixed. If the pixmap
- is bigger than the system size, it will be scaled.
-
\sa QPixmap::QPixmap(), QPixmap::setMask()
*/
@@ -433,9 +430,6 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
because this size is supported on all platforms. Some platforms
also support 16 x 16, 48 x 48, and 64 x 64 cursors.
- \note On Windows CE, the cursor size is fixed. If the pixmap
- is bigger than the system size, it will be scaled.
-
\sa QBitmap::QBitmap(), QBitmap::setMask()
*/
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 63876479bd..affc4c2526 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3975,6 +3975,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')';
}
break;
+#ifndef QT_NO_SHORTCUT
case QEvent::Shortcut: {
const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e);
dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId();
@@ -3983,6 +3984,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')';
}
break;
+#endif
case QEvent::FocusAboutToChange:
case QEvent::FocusIn:
case QEvent::FocusOut:
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index f1135db307..9a75f4bc83 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -411,7 +411,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
static const struct {
int key;
- const char* name;
+ const char name[25];
} keyname[] = {
//: This and all following "incomprehensible" strings in QShortcut context
//: are key names. Please use the localized names appearing on actual
@@ -693,8 +693,8 @@ static const struct {
{ Qt::Key_TouchpadOn, QT_TRANSLATE_NOOP("QShortcut", "Touchpad On") },
{ Qt::Key_TouchpadOff, QT_TRANSLATE_NOOP("QShortcut", "Touchpad Off") },
- { 0, 0 }
};
+static Q_CONSTEXPR int numKeyNames = sizeof keyname / sizeof *keyname;
/*!
\enum QKeySequence::StandardKey
@@ -1179,7 +1179,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
for (int tran = 0; tran < 2; ++tran) {
if (!nativeText)
++tran;
- for (int i = 0; keyname[i].name; ++i) {
+ for (int i = 0; i < numKeyNames; ++i) {
QString keyName(tran == 0
? QCoreApplication::translate("QShortcut", keyname[i].name)
: QString::fromLatin1(keyname[i].name));
@@ -1318,7 +1318,7 @@ QString QKeySequencePrivate::keyName(int key, QKeySequence::SequenceFormat forma
#if defined(Q_OS_MACX)
NonSymbol:
#endif
- while (keyname[i].name) {
+ while (i < numKeyNames) {
if (key == keyname[i].key) {
p = nativeText ? QCoreApplication::translate("QShortcut", keyname[i].name)
: QString::fromLatin1(keyname[i].name);
@@ -1330,7 +1330,7 @@ NonSymbol:
// fall back on the unicode representation of it...
// Or else characters like Qt::Key_aring may not get displayed
// (Really depends on you locale)
- if (!keyname[i].name) {
+ if (i >= numKeyNames) {
if (!QChar::requiresSurrogates(key)) {
p = QChar(ushort(key)).toUpper();
} else {
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp
index d18847c434..a9535a6ad7 100644
--- a/src/gui/kernel/qoffscreensurface.cpp
+++ b/src/gui/kernel/qoffscreensurface.cpp
@@ -183,6 +183,7 @@ void QOffscreenSurface::create()
if (QThread::currentThread() != qGuiApp->thread())
qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures.");
d->offscreenWindow = new QWindow(d->screen);
+ d->offscreenWindow->setObjectName(QLatin1String("QOffscreenSurface"));
// Remove this window from the global list since we do not want it to be destroyed when closing the app.
// The QOffscreenSurface has to be usable even after exiting the event loop.
QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow);
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index 6eaabd3e08..f08f0ef494 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -83,7 +83,9 @@ public:
virtual void setRole(MenuRole role) = 0;
virtual void setCheckable(bool checkable) = 0;
virtual void setChecked(bool isChecked) = 0;
+#ifndef QT_NO_SHORTCUT
virtual void setShortcut(const QKeySequence& shortcut) = 0;
+#endif
virtual void setEnabled(bool enabled) = 0;
virtual void setIconSize(int size) = 0;
virtual void setNativeContents(WId item) { Q_UNUSED(item); }
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index d80ab8b597..9c140f1d68 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -153,6 +153,7 @@ QT_BEGIN_NAMESPACE
*/
+#ifndef QT_NO_SHORTCUT
// Table of key bindings. It must be sorted on key sequence:
// The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.)
// A priority of 1 indicates that this is the primary key binding when multiple are defined.
@@ -336,6 +337,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = {
};
const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding));
+#endif
QPlatformThemePrivate::QPlatformThemePrivate()
: systemPalette(0)
@@ -591,6 +593,7 @@ static inline int maybeSwapShortcut(int shortcut)
}
#endif
+#ifndef QT_NO_SHORTCUT
// mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler)
struct ByStandardKey {
typedef bool result_type;
@@ -641,6 +644,7 @@ QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) c
return list;
}
+#endif
/*!
Returns the text of a standard \a button.
@@ -738,10 +742,12 @@ unsigned QPlatformThemePrivate::currentKeyPlatforms()
{
const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt();
unsigned result = 1u << keyboardScheme;
+#ifndef QT_NO_SHORTCUT
if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
|| keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
|| keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
result |= KB_X11;
+#endif
return result;
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index a8baca1967..686dbed4b1 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -306,7 +306,9 @@ public:
QPlatformTheme::IconOptions iconOptions = 0) const;
virtual QIconEngine *createIconEngine(const QString &iconName) const;
+#ifndef QT_NO_SHORTCUT
virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const;
+#endif
virtual QString standardButtonText(int button) const;
diff --git a/src/gui/kernel/qplatformtheme_p.h b/src/gui/kernel/qplatformtheme_p.h
index f2777c57b3..73deb890bb 100644
--- a/src/gui/kernel/qplatformtheme_p.h
+++ b/src/gui/kernel/qplatformtheme_p.h
@@ -67,8 +67,10 @@ public:
void initializeSystemPalette();
+#ifndef QT_NO_SHORTCUT
static const QKeyBinding keyBindings[];
static const uint numberOfKeyBindings;
+#endif
static unsigned currentKeyPlatforms();
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index b4e3f68b97..246163609e 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -41,6 +41,7 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/qpair.h>
+#include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE
@@ -50,6 +51,7 @@ class QSurfaceFormatPrivate;
class Q_GUI_EXPORT QSurfaceFormat
{
+ Q_GADGET
public:
enum FormatOption {
StereoBuffers = 0x0001,
@@ -57,6 +59,7 @@ public:
DeprecatedFunctions = 0x0004,
ResetNotification = 0x0008
};
+ Q_ENUM(FormatOption)
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
enum SwapBehavior {
@@ -65,6 +68,7 @@ public:
DoubleBuffer,
TripleBuffer
};
+ Q_ENUM(SwapBehavior)
enum RenderableType {
DefaultRenderableType = 0x0,
@@ -72,12 +76,14 @@ public:
OpenGLES = 0x2,
OpenVG = 0x4
};
+ Q_ENUM(RenderableType)
enum OpenGLContextProfile {
NoProfile,
CoreProfile,
CompatibilityProfile
};
+ Q_ENUM(OpenGLContextProfile)
QSurfaceFormat();
/*implicit*/ QSurfaceFormat(FormatOptions options);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index f061a2bf50..5f71bdaded 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -210,6 +210,8 @@ QWindow::~QWindow()
{
destroy();
QGuiApplicationPrivate::window_list.removeAll(this);
+ if (!QGuiApplicationPrivate::is_app_closing)
+ QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
}
void QWindowPrivate::init()
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 73140b4f6f..7c6bbc26c8 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -236,7 +236,7 @@ bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestam
#else
Q_UNUSED(window)
Q_UNUSED(timestamp)
- Q_UNUSED(key)
+ Q_UNUSED(keyCode)
Q_UNUSED(modifiers)
Q_UNUSED(nativeScanCode)
Q_UNUSED(nativeVirtualKey)
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index a385332d6d..ac11b0f324 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5925,9 +5925,9 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int
dg = gamma[dg];
db = gamma[db];
- int nr = qt_div_255((sr - dr) * mr) + dr;
- int ng = qt_div_255((sg - dg) * mg) + dg;
- int nb = qt_div_255((sb - db) * mb) + db;
+ int nr = qt_div_255(sr * mr + dr * (255 - mr));
+ int ng = qt_div_255(sg * mg + dg * (255 - mg));
+ int nb = qt_div_255(sb * mb + db * (255 - mb));
nr = invgamma[nr];
ng = invgamma[ng];
@@ -5952,9 +5952,9 @@ static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, in
int alpha = coverage;
int ialpha = 255 - alpha;
- int nr = (sr * alpha + ialpha * dr) / 255;
- int ng = (sg * alpha + ialpha * dg) / 255;
- int nb = (sb * alpha + ialpha * db) / 255;
+ int nr = qt_div_255(sr * alpha + dr * ialpha);
+ int ng = qt_div_255(sg * alpha + dg * ialpha);
+ int nb = qt_div_255(sb * alpha + db * ialpha);
nr = invgamma[nr];
ng = invgamma[ng];
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 922ff157e2..664117a730 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -760,6 +760,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) {
return t;
}
+// qt_div_255 is a fast rounded division by 255 using an approximation that is accurate for all positive 16-bit integers
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 1ba6345bf9..0571e1a328 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -89,7 +89,7 @@ QT_BEGIN_NAMESPACE
\section1 Additional License Information
- On Embedded Linux, Windows CE and X11 platforms, parts of this class rely on
+ On Embedded Linux and X11 platforms, parts of this class rely on
code obtained under the following licenses:
\legalese
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 4548b6f8b9..cb19a42688 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -60,7 +60,7 @@ using namespace QCss;
struct QCssKnownValue
{
- const char *name;
+ const char name[28];
quint64 id;
};
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index dbd47151bd..74ea8d15b7 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1046,46 +1046,45 @@ QByteArray QFontEngine::getSfntTable(uint tag) const
return table;
}
-void QFontEngine::clearGlyphCache(const void *key)
+void QFontEngine::clearGlyphCache(const void *context)
{
- for (QLinkedList<GlyphCacheEntry>::iterator it = m_glyphCaches.begin(), end = m_glyphCaches.end(); it != end; ) {
- if (it->context == key)
- it = m_glyphCaches.erase(it);
- else
- ++it;
- }
+ m_glyphCaches.remove(context);
}
-void QFontEngine::setGlyphCache(const void *key, QFontEngineGlyphCache *data)
+void QFontEngine::setGlyphCache(const void *context, QFontEngineGlyphCache *cache)
{
- Q_ASSERT(data);
+ Q_ASSERT(cache);
- GlyphCacheEntry entry;
- entry.context = key;
- entry.cache = data;
- if (m_glyphCaches.contains(entry))
- return;
+ GlyphCaches &caches = m_glyphCaches[context];
+ for (GlyphCaches::const_iterator it = caches.constBegin(), end = caches.constEnd(); it != end; ++it) {
+ if (cache == it->cache.data())
+ return;
+ }
- // Limit the glyph caches to 4. This covers all 90 degree rotations and limits
- // memory use when there is continuous or random rotation
- if (m_glyphCaches.size() == 4)
- m_glyphCaches.removeLast();
+ // Limit the glyph caches to 4 per context. This covers all 90 degree rotations,
+ // and limits memory use when there is continuous or random rotation
+ if (caches.size() == 4)
+ caches.removeLast();
- m_glyphCaches.push_front(entry);
+ GlyphCacheEntry entry;
+ entry.cache = cache;
+ caches.push_front(entry);
}
-QFontEngineGlyphCache *QFontEngine::glyphCache(const void *key, GlyphFormat format, const QTransform &transform) const
+QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat format, const QTransform &transform) const
{
- for (QLinkedList<GlyphCacheEntry>::const_iterator it = m_glyphCaches.constBegin(), end = m_glyphCaches.constEnd(); it != end; ++it) {
- QFontEngineGlyphCache *c = it->cache.data();
- if (key == it->context
- && format == c->glyphFormat()
- && qtransform_equals_no_translate(c->m_transform, transform)) {
- return c;
- }
+ const QHash<const void*, GlyphCaches>::const_iterator caches = m_glyphCaches.constFind(context);
+ if (caches == m_glyphCaches.cend())
+ return Q_NULLPTR;
+
+ for (GlyphCaches::const_iterator it = caches->begin(), end = caches->end(); it != end; ++it) {
+ QFontEngineGlyphCache *cache = it->cache.data();
+ if (format == cache->glyphFormat() && qtransform_equals_no_translate(cache->m_transform, transform))
+ return cache;
}
- return 0;
+
+ return Q_NULLPTR;
}
static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs)
@@ -1565,12 +1564,11 @@ QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
QFontEngine::GlyphCacheEntry::GlyphCacheEntry()
- : context(0)
{
}
QFontEngine::GlyphCacheEntry::GlyphCacheEntry(const GlyphCacheEntry &o)
- : context(o.context), cache(o.cache)
+ : cache(o.cache)
{
}
@@ -1580,7 +1578,6 @@ QFontEngine::GlyphCacheEntry::~GlyphCacheEntry()
QFontEngine::GlyphCacheEntry &QFontEngine::GlyphCacheEntry::operator=(const GlyphCacheEntry &o)
{
- context = o.context;
cache = o.cache;
return *this;
}
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 46f5e6c070..62941b6cac 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -70,7 +70,7 @@
#include FT_CONFIG_OPTIONS_H
#endif
-#if defined(FT_LCD_FILTER_H) && defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING)
+#if defined(FT_LCD_FILTER_H)
#define QT_USE_FREETYPE_LCDFILTER
#endif
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 69331cb0bb..42610e9b70 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -359,12 +359,11 @@ private:
GlyphCacheEntry &operator=(const GlyphCacheEntry &);
- const void *context;
QExplicitlySharedDataPointer<QFontEngineGlyphCache> cache;
- bool operator==(const GlyphCacheEntry &other) const { return context == other.context && cache == other.cache; }
+ bool operator==(const GlyphCacheEntry &other) const { return cache == other.cache; }
};
-
- mutable QLinkedList<GlyphCacheEntry> m_glyphCaches;
+ typedef QLinkedList<GlyphCacheEntry> GlyphCaches;
+ mutable QHash<const void *, GlyphCaches> m_glyphCaches;
private:
QVariant m_userData;
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 75899dec80..07aec6f019 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1315,7 +1315,7 @@ QTextCursor QTextDocument::find(const QString &subString, int from, FindFlags op
//do not include the character given in the position.
if (options & FindBackward) {
--pos ;
- if (pos < subString.size())
+ if (pos < 0)
return QTextCursor();
}
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 7fac3331f1..d4c43b3069 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
// see also tst_qtextdocumentfragment.cpp
#define MAX_ENTITY 258
-static const struct QTextHtmlEntity { const char *name; quint16 code; } entities[MAX_ENTITY]= {
+static const struct QTextHtmlEntity { const char name[9]; quint16 code; } entities[]= {
{ "AElig", 0x00c6 },
{ "AMP", 38 },
{ "Aacute", 0x00c1 },
@@ -320,6 +320,7 @@ static const struct QTextHtmlEntity { const char *name; quint16 code; } entities
{ "zwj", 0x200d },
{ "zwnj", 0x200c }
};
+Q_STATIC_ASSERT(MAX_ENTITY == sizeof entities / sizeof *entities);
#if defined(Q_CC_MSVC) && _MSC_VER < 1600
bool operator<(const QTextHtmlEntity &entity1, const QTextHtmlEntity &entity2)
diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h
index 4ea6e44138..e93d46a59f 100644
--- a/src/gui/text/qtexthtmlparser_p.h
+++ b/src/gui/text/qtexthtmlparser_p.h
@@ -145,7 +145,7 @@ enum QTextHTMLElements {
struct QTextHtmlElement
{
- const char *name;
+ const char name[11];
QTextHTMLElements id;
enum DisplayMode { DisplayBlock, DisplayInline, DisplayTable, DisplayNone } displayMode;
};