summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-10 10:11:10 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-10 10:11:11 +0200
commitf035786021e9f7b1d9512b22774bc15553caaedb (patch)
treec46a29ed3657944d9f36d8643a99fad469235bc4 /src/gui
parent72024fd50cdead8d890886dba32fd81ac54ff3ae (diff)
parent916c9d469bd0df227dc3be97fcca27e3cf58144f (diff)
Merge remote-tracking branch 'origin/5.3' into dev
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qicon.cpp3
-rw-r--r--src/gui/image/qimagereader.cpp5
-rw-r--r--src/gui/kernel/qevent.cpp2
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp2
-rw-r--r--src/gui/painting/qpdf.cpp6
-rw-r--r--src/gui/text/qtextengine.cpp6
-rw-r--r--src/gui/text/qtextlayout.cpp11
7 files changed, 25 insertions, 10 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 8172ecbb48..681e7e3f79 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1026,7 +1026,8 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
d->engine->addFile(fileName, size, mode, state);
// Check if a "@2x" file exists and add it.
- if (qApp->devicePixelRatio() > 1.0) {
+ static bool disable2xImageLoading = !qgetenv("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING").isEmpty();
+ if (!disable2xImageLoading && qApp->devicePixelRatio() > 1.0) {
int dotIndex = fileName.lastIndexOf(QLatin1Char('.'));
if (dotIndex != -1) {
QString at2xfileName = fileName;
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index a291df29b6..d3edf40acc 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1246,8 +1246,9 @@ bool QImageReader::read(QImage *image)
}
// successful read; check for "@2x" file name suffix and set device pixel ratio.
- if (QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) {
- image->setDevicePixelRatio(2.0);
+ static bool disable2xImageLoading = !qgetenv("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING").isEmpty();
+ if (!disable2xImageLoading && QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) {
+ image->setDevicePixelRatio(2.0);
}
return true;
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index f76166af18..feb3243a5a 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3561,7 +3561,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
case QEvent::TouchEnd:
n = n ? n : "TouchEnd";
formatTouchEvent(dbg.nospace(), n, *static_cast<const QTouchEvent*>(e));
- return dbg.nospace();
+ return dbg.space();
case QEvent::ChildAdded: n = n ? n : "ChildAdded";
case QEvent::ChildPolished: n = n ? n : "ChildPolished";
case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index 010ddaf228..3335a88cbb 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -160,7 +160,7 @@ void QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(QOpenGLContext *con
A pointer to an object of the class corresponding to the version and
profile of OpenGL in use can be obtained from
- QOpenGLFunctions::versionFunctions(). If obtained in this way, note that
+ QOpenGLContext::versionFunctions(). If obtained in this way, note that
the QOpenGLContext retains ownership of the object. This is so that only
one instance need be created.
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index bda5df3d13..0c888d645d 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -2362,7 +2362,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
data.resize(bytesPerLine * h);
char *rawdata = data.data();
for (int y = 0; y < h; ++y) {
- memcpy(rawdata, image.scanLine(y), bytesPerLine);
+ memcpy(rawdata, image.constScanLine(y), bytesPerLine);
rawdata += bytesPerLine;
}
object = writeImage(data, w, h, d, 0, 0);
@@ -2384,7 +2384,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
softMaskData.resize(w * h);
uchar *sdata = (uchar *)softMaskData.data();
for (int y = 0; y < h; ++y) {
- const QRgb *rgb = (const QRgb *)image.scanLine(y);
+ const QRgb *rgb = (const QRgb *)image.constScanLine(y);
for (int x = 0; x < w; ++x) {
uchar alpha = qAlpha(*rgb);
*sdata++ = alpha;
@@ -2400,7 +2400,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
softMaskData.resize(w * h);
uchar *sdata = (uchar *)softMaskData.data();
for (int y = 0; y < h; ++y) {
- const QRgb *rgb = (const QRgb *)image.scanLine(y);
+ const QRgb *rgb = (const QRgb *)image.constScanLine(y);
if (grayscale) {
for (int x = 0; x < w; ++x) {
*(data++) = qGray(*rgb);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index ef0ae4a146..3b6a988e97 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1292,8 +1292,12 @@ int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *stri
attrs.justification = hbAttrs.justification;
}
- for (quint32 i = 0; i < shaper_item.item.length; ++i)
+ for (quint32 i = 0; i < shaper_item.item.length; ++i) {
+ // Workaround wrong log_clusters for surrogates (i.e. QTBUG-39875)
+ if (shaper_item.log_clusters[i] >= shaper_item.num_glyphs)
+ shaper_item.log_clusters[i] = shaper_item.num_glyphs - 1;
shaper_item.log_clusters[i] += glyph_pos;
+ }
if (kerningEnabled && !shaper_item.kerning_applied)
actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index a48fef7e8b..435ef2637d 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1843,8 +1843,17 @@ void QTextLine::layout_helper(int maxGlyphs)
addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
current, lbh.logClusters, lbh.glyphs);
+ // This is a hack to fix a regression caused by the introduction of the
+ // whitespace flag to non-breakable spaces and will cause the non-breakable
+ // spaces to behave as in previous Qt versions in the line breaking algorithm.
+ // The line breaks do not currently follow the Unicode specs, but fixing this would
+ // require refactoring the code and would cause behavioral regressions.
+ bool isBreakableSpace = lbh.currentPosition < eng->layoutData->string.length()
+ && attributes[lbh.currentPosition].whiteSpace
+ && eng->layoutData->string.at(lbh.currentPosition).decompositionTag() != QChar::NoBreak;
+
if (lbh.currentPosition >= eng->layoutData->string.length()
- || attributes[lbh.currentPosition].whiteSpace
+ || isBreakableSpace
|| attributes[lbh.currentPosition].lineBreak) {
sb_or_ws = true;
break;