Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.5.0, 5.9.0 Beta 2
-
OS X 10.10
Description
[OS X]: Fix qt_mac_displayColorSpace() so that it correctly checks the display at that point in time. Currently it only checks the main display and this is also cached which means if the color space changed after previously being accessed then it will be wrong.
Options for Colorspace support
We need to declare the color space of our RGB values when converting the backing store QImage to a CGImage for display. We have several options:
- (
Generic) Device RGB
CGColorSpaceCreateDeviceRGB()
No color accuracy
No pixel conversion step at backing store upload - A specific color space [which can be sRGB]
CGColorSpaceCreateWithICCProfile(...)
Accurate colors [with app cooperation]
Pixel conversion step at backing store upload - The target display’s color space
CGDisplayCopyColorSpace(...)
Accurate colors [with app cooperation]
No pixel conversion at backing store upload
Notes:
QImage does not support carrying color space information. This means that in the short term selecting between the options is an application-wide setting.
Options 2) and 3) can provide correct colors, but this requires that the application is aware of color spaces and (somehow) places correct RGB values in the Qt backing store. For 3) that includes knowing the target display.
Option 2) requires API for letting the application declare what color space it is using. Using sRGB here could be a good default, sine most image data is in sRGB. It is likely that this will lead to correct colors.
Option 3) is useful as a fast / “don’t care” option, since it omits any color conversion steps.
Update: Since 10.8, CGColorSpaceCreateDeviceRGB is equivalent to sRGB, and is closer to option 2)
Qt 5.5 currently uses 3), but with the main display color space only.
OpenGL and Qt Quick
"Best Practices for Color Management in OS X and iOS" has a section on OpenGL color correctness. Suggestions include:
- Setting a color space on the NSWindow: [myWindow setColorSpace: ...]
- Writing a fragment shader that color corrects, using data from API in ColorSyncTransform.h
Reference
Previous color-space related performance regression: QTBUG-34358
Attachments
Issue Links
- is required for
-
QTBUG-49827 Qt on macOS Graphics/integration update
- Closed
- relates to
-
QTBUG-51057 Wrong MacOS colormanagement handling
- Closed
For Gerrit Dashboard: QTBUG-47660 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
143354,2 | WIP: OS X: Use the DeviceRGB color space by default | dev | qt/qtbase | Status: ABANDONED | -2 | 0 |
201420,5 | macOS: remove existing color-profile handling code | dev | qt/qtbase | Status: MERGED | -2 | 0 |
201421,4 | WIP: macOS: Add API for setting color profiles | dev | qt/qtbase | Status: ABANDONED | -2 | 0 |
203006,3 | macOS: Add option for bypassing color management | dev | qt/qtbase | Status: ABANDONED | 0 | 0 |
210401,5 | Cocoa: optimize backingstore flush on 10-bit displays | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |
268614,3 | macOS: Respect color space set on NSWindow when flushing backingstore | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 |
268825,3 | macOS: Respect QSurfaceFormat color space when creating NSWindow | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 |