Cherry-pick https://codereview.qt-project.org/#change,69327 to optimize macDisplayColorSpace, improving performance on OS X 10.9.
Fixes #4050