Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47660

[OS X]: Fix qt_mac_displayColorSpace() so that it correctly checks the display at that point in time

    XMLWordPrintable

Details

    • macOS

    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:

      1. (Generic) Device RGB
        CGColorSpaceCreateDeviceRGB()
        No color accuracy
        No pixel conversion step at backing store upload
      2. A specific color space [which can be sRGB]
        CGColorSpaceCreateWithICCProfile(...)
        Accurate colors [with app cooperation]
        Pixel conversion step at backing store upload
      3. 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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              sorvig Morten Sørvig
              andysh Andy Shaw
              Votes:
              2 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: