summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-27 13:08:38 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-27 13:08:38 +0200
commitafac8dac580b5e6524f03c252c27b7f2353bace9 (patch)
tree49b729086ff7f337cd1a5f9ee1f8be3aef736214
parentf2f1a93c58b6cb88f3cd0655e95ccd5ad99286d0 (diff)
parentb3dc0c13e88f3bd859c96144a9d4280c675665bc (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: src/gui/painting/qdrawhelper.cpp src/gui/painting/qdrawhelper_p.h src/gui/painting/qdrawhelper_sse2.cpp src/gui/painting/qdrawhelper_x86_p.h Change-Id: I83256bb38ab3a705776e353bc0629315b6c59a0f
-rw-r--r--qmake/generators/projectgenerator.cpp2
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp15
-rw-r--r--qmake/option.cpp9
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--src/gui/painting/qbackingstore.cpp5
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.mm31
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm15
7 files changed, 46 insertions, 35 deletions
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index ef34955eb1..19acc09e85 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -36,7 +36,7 @@
QT_BEGIN_NAMESPACE
-QString project_builtin_regx() //calculate the builtin regular expression..
+static QString project_builtin_regx() //calculate the builtin regular expression..
{
QString ret;
QStringList builtin_exts;
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 38253e3a8f..506229a7f4 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -1567,21 +1567,12 @@ bool VCLinkerTool::parseOption(const char* option)
const char* str = option+6;
if (*str == 'S')
ShowProgress = linkProgressAll;
-#ifndef Q_OS_WIN
- else if (strncasecmp(str, "pginstrument", 12))
+ else if (qstricmp(str, "pginstrument") == 0)
LinkTimeCodeGeneration = optLTCGInstrument;
- else if (strncasecmp(str, "pgoptimize", 10))
+ else if (qstricmp(str, "pgoptimize") == 0)
LinkTimeCodeGeneration = optLTCGOptimize;
- else if (strncasecmp(str, "pgupdate", 8 ))
+ else if (qstricmp(str, "pgupdate") == 0)
LinkTimeCodeGeneration = optLTCGUpdate;
-#else
- else if (_stricmp(str, "pginstrument"))
- LinkTimeCodeGeneration = optLTCGInstrument;
- else if (_stricmp(str, "pgoptimize"))
- LinkTimeCodeGeneration = optLTCGOptimize;
- else if (_stricmp(str, "pgupdate"))
- LinkTimeCodeGeneration = optLTCGUpdate;
-#endif
}
} else {
AdditionalOptions.append(option);
diff --git a/qmake/option.cpp b/qmake/option.cpp
index dcebeadcb8..626a2cec0d 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -122,7 +122,6 @@ static QString detectProjectFile(const QString &path)
return ret;
}
-QString project_builtin_regx();
bool usage(const char *a0)
{
fprintf(stdout, "Usage: %s [mode] [options] [files]\n"
@@ -134,9 +133,9 @@ bool usage(const char *a0)
"\n"
"Mode:\n"
" -project Put qmake into project file generation mode%s\n"
- " In this mode qmake interprets files as files to\n"
- " be built,\n"
- " defaults to %s\n"
+ " In this mode qmake interprets [files] as files to\n"
+ " be added to the .pro file. By default, all files with\n"
+ " known source extensions are added.\n"
" Note: The created .pro file probably will \n"
" need to be edited. For example add the QT variable to \n"
" specify what modules are required.\n"
@@ -184,7 +183,7 @@ bool usage(const char *a0)
" -nomoc Don't generate moc targets [makefile mode only]\n"
" -nopwd Don't look for files in pwd [project mode only]\n"
,a0,
- default_mode(a0) == Option::QMAKE_GENERATE_PROJECT ? " (default)" : "", project_builtin_regx().toLatin1().constData(),
+ default_mode(a0) == Option::QMAKE_GENERATE_PROJECT ? " (default)" : "",
default_mode(a0) == Option::QMAKE_GENERATE_MAKEFILE ? " (default)" : ""
);
return false;
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index b3ea553b51..b25685923c 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -1199,10 +1199,10 @@ static int qt_compare_strings(QLatin1String lhs, QStringView rhs, Qt::CaseSensit
static int qt_compare_strings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
{
- if (cs == Qt::CaseInsensitive)
- return qstrnicmp(lhs.data(), lhs.size(), rhs.data(), rhs.size());
if (lhs.isEmpty())
return lencmp(0, rhs.size());
+ if (cs == Qt::CaseInsensitive)
+ return qstrnicmp(lhs.data(), lhs.size(), rhs.data(), rhs.size());
const auto l = std::min(lhs.size(), rhs.size());
int r = qstrncmp(lhs.data(), rhs.data(), l);
return r ? r : lencmp(lhs.size(), rhs.size());
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 3240b83451..b0393aff95 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -95,6 +95,11 @@ public:
QBackingStore::QBackingStore(QWindow *window)
: d_ptr(new QBackingStorePrivate(window))
{
+ if (window->handle()) {
+ // Create platform backingstore up front if we have a platform window,
+ // otherwise delay the creation until absolutely necessary.
+ handle();
+ }
}
/*!
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
index 5c36ce00f7..5550f0586b 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
@@ -75,6 +75,37 @@ QCFType<CGColorSpaceRef> QCocoaBackingStore::colorSpace() const
QNSWindowBackingStore::QNSWindowBackingStore(QWindow *window)
: QCocoaBackingStore(window)
{
+ // Choose an appropriate window depth based on the requested surface format.
+ // On deep color displays the default bit depth is 16-bit, so unless we need
+ // that level of precision we opt out of it (and the expensive RGB32 -> RGB64
+ // conversions that come with it if our backingstore depth does not match).
+
+ NSWindow *nsWindow = static_cast<QCocoaWindow *>(window->handle())->view().window;
+ auto colorSpaceName = NSColorSpaceFromDepth(nsWindow.depthLimit);
+
+ static const int kDefaultBitDepth = 8;
+ auto surfaceFormat = window->requestedFormat();
+ auto bitsPerSample = qMax(kDefaultBitDepth, qMax(surfaceFormat.redBufferSize(),
+ qMax(surfaceFormat.greenBufferSize(), surfaceFormat.blueBufferSize())));
+
+ // NSBestDepth does not seem to guarantee a window depth deep enough for the
+ // given bits per sample, even if documented as such. For example, requesting
+ // 10 bits per sample will not give us a 16-bit format, even if that's what's
+ // available. Work around this by manually bumping the bit depth.
+ bitsPerSample = !(bitsPerSample & (bitsPerSample - 1))
+ ? bitsPerSample : qNextPowerOfTwo(bitsPerSample);
+
+ auto bestDepth = NSBestDepth(colorSpaceName, bitsPerSample, 0, NO, nullptr);
+
+ // Disable dynamic depth limit, otherwise our depth limit will be overwritten
+ // by AppKit if the window moves to a screen with a different depth. We call
+ // this before setting the depth limit, as the call will reset the depth to 0.
+ [nsWindow setDynamicDepthLimit:NO];
+
+ qCDebug(lcQpaBackingStore) << "Using" << NSBitsPerSampleFromDepth(bestDepth)
+ << "bit window depth for" << nsWindow;
+
+ nsWindow.depthLimit = bestDepth;
}
QNSWindowBackingStore::~QNSWindowBackingStore()
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index bda8183167..db4bc12210 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1660,21 +1660,6 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
applyContentBorderThickness(nsWindow);
- // Prevent CoreGraphics RGB32 -> RGB64 backing store conversions on deep color
- // displays by forcing 8-bit components, unless a deep color format has been
- // requested. This conversion uses significant CPU time.
- QSurface::SurfaceType surfaceType = QPlatformWindow::window()->surfaceType();
- bool usesCoreGraphics = surfaceType == QSurface::RasterSurface || surfaceType == QSurface::RasterGLSurface;
- QSurfaceFormat surfaceFormat = QPlatformWindow::window()->format();
- bool usesDeepColor = surfaceFormat.redBufferSize() > 8 ||
- surfaceFormat.greenBufferSize() > 8 ||
- surfaceFormat.blueBufferSize() > 8;
- bool usesLayer = view().layer;
- if (usesCoreGraphics && !usesDeepColor && !usesLayer) {
- [nsWindow setDynamicDepthLimit:NO];
- [nsWindow setDepthLimit:NSWindowDepthTwentyfourBitRGB];
- }
-
if (format().colorSpace() == QSurfaceFormat::sRGBColorSpace)
nsWindow.colorSpace = NSColorSpace.sRGBColorSpace;