Tk Source Code

View Ticket
Login
Ticket UUID: 7f37514e0e45a9f9e5b22a08872975be020e6852
Title: Aqua: compiler warning in tkMacOSXImage.c
Type: Bug Version: core-9-0-branch
Submitter: chrstphrchvz Created on: 2025-09-08 03:43:20
Subsystem: 83. Mac OS X Build Assigned To: chrstphrchvz
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2025-09-30 17:04:37
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2025-09-30 17:04:37
Description:

There is currently this compiler warning (at least for sufficiently recent Xcode clang or SDK):

macosx/tkMacOSXImage.c:692:7: warning: implicit conversion from enumeration type 'CGImageAlphaInfo' (aka 'enum CGImageAlphaInfo') to different enumeration type 'CGBitmapInfo' (aka 'enum CGBitmapInfo') [-Wenum-conversion]
  687 |             cg_context = CGBitmapContextCreate(NULL, width, height,
      |                          ~~~~~~~~~~~~~~~~~~~~~
  688 |                     CGImageGetBitsPerComponent(cg_image),
  689 |                     //CGImageGetBytesPerRow(cg_image), // wastes space?
  690 |                     CGImageGetBitsPerPixel(cg_image) * width / 8,
  691 |                     colorspace,
  692 |                     CGImageGetAlphaInfo(cg_image));
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

The use of CGImageGetAlphaInfo(cg_image) came from the example from which I had adapted this code. To eliminate the warning, I think it would be okay or possibly better to use CGImageGetBitmapInfo(cg_image) instead.

User Comments: jan.nijtmans added on 2025-09-30 17:04:37:

Fixed [cd63d694753c0e81|here]


jan.nijtmans added on 2025-09-12 21:05:07:

Proposed [cd88fa9e3bcc6e60|fix] looks good to me.

Thanks!