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

[Mac] CGBitmapContextCreate: unsupported parameter combination warnings in console

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.1, 5.12.2
    • GUI: Painting
    • None
    • macOS 10.13 with Xcode 10
    • macOS

    Description

      To reproduce this problem, build and run the code below using Qt 5.12.1 or 5.12.2 on macOS. This will cause a bunch of runtime warnings to be dumped to the console. For example:

      2019-03-18 14:41:05.304026-0700 project[46136:14509714] [com.yourcompany.project] CGBitmapContextCreate: unsupported parameter combination: set CGBITMAP_CONTEXT_LOG_ERRORS environmental variable to see the details
      2019-03-18 14:41:05.304050-0700 project[46136:14509714] [com.yourcompany.project] CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
      2019-03-18 14:41:05.304060-0700 project[46136:14509714] [com.yourcompany.project] CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
      2019-03-18 14:41:05.304067-0700 project[46136:14509714] [com.yourcompany.project] CGContextScaleCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

       

       

      #include <QApplication>
      #include <qdebug.h>
      #include <QFrame>
      #include <QStyle>
      #include <QStyleOptionFrame>
      #include <QPainter>
      #include <QWidget>
      
      int main(int argc, char *argv[])
      {
      	QApplication a(argc, argv);
      
      	QWidget * ourwidget = new QWidget();
      	QStyleOptionFrame option;
      	option.initFrom(ourwidget);
      
      	QImage image(option.rect.size(), QImage::Format_ARGB32);
      	QPainter imagepainter(&image);
      
      	ourwidget->style()->drawPrimitive(QStyle::PE_FrameGroupBox, &option, &imagepainter, NULL);
      	return a.exec();
      }
      
      

      I cannot reproduce this using the official 5.12.0 build, but can using the official 5.12.2 build. I am also able to reproduce using a self-built version from the 5.12 branch shortly after 5.12.1 was released.

      I haven't confirmed it, but I suspect the commit that introduced this is:

      commit 09e3457541c54b084365bfb77ad58474f0666374
      Author: Tor Arne Vestbø <tor.arne.vestbo@qt.io>, Sun Nov 25 14:09:00 2018 +0100 (4 months ago)
      Committer: Tor Arne Vestbø <tor.arne.vestbo@qt.io>, Wed Nov 28 23:59:17 2018 +0000 (4 months ago)
      Follows: v5.12.0-beta4
      Precedes: v5.12.1
      Branches: <Expand>
      
      macOS: Share code for resolving CGImage bitmapInfor for a QImage
      
      Removes assumptions about QImage format in a few places.
      
      Change-Id: I515701be53190429a48956c31986fa0804806406
      Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
      

      Our application uses code similar to the test case to draw a group box with a colored background. With Qt 5.12.1 or later, the color we set for the background isn't used, so the group box ends up being transparent.

       

      Attachments

        1. QTBUG-74530-CGBitmapContextCreateWarnings.zip
          1 kB
          Adam Light
        2. QTBUG-74530-WidgetNotDrawnCorrectly.zip
          2 kB
          Adam Light
        3. Widget_5_12_0.png
          8 kB
          Adam Light
        4. Widget_5_12_2.png
          7 kB
          Adam Light
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vestbo Tor Arne Vestbø
            aclight Adam Light
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes