Skip to content

Commit

Permalink
Fix [fe942372aa]: Aqua: XPutImage() swaps red and blue channels. Patc…
Browse files Browse the repository at this point in the history
…h from Christopher Chavez.
  • Loading branch information
fvogelnew1 committed Dec 3, 2023
2 parents 5141d1a + 4ba9a6d commit c0764ea
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions macosx/tkMacOSXImage.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,12 @@ static void ReleaseData(
static CGImageRef
TkMacOSXCreateCGImageWithXImage(
XImage *image,
uint32_t alphaInfo)
uint32_t bitmapInfo)
{
CGImageRef img = NULL;
size_t bitsPerComponent, bitsPerPixel;
size_t len = image->bytes_per_line * image->height;
const CGFloat *decode = NULL;
CGBitmapInfo bitmapInfo;
CGDataProviderRef provider = NULL;
char *data = NULL;
CGDataProviderReleaseDataCallback releaseData = ReleaseData;
Expand Down Expand Up @@ -184,7 +183,6 @@ TkMacOSXCreateCGImageWithXImage(
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
bitsPerComponent = 8;
bitsPerPixel = 32;
bitmapInfo = kCGBitmapByteOrder32Big | alphaInfo;
data = (char *)ckalloc(len);
if (data) {
memcpy(data, image->data + image->xoffset, len);
Expand Down Expand Up @@ -483,8 +481,8 @@ XCreateImage(
*----------------------------------------------------------------------
*/

#define USE_ALPHA kCGImageAlphaLast
#define IGNORE_ALPHA kCGImageAlphaNoneSkipLast
#define USE_ALPHA (kCGImageAlphaLast | kCGBitmapByteOrder32Big)
#define IGNORE_ALPHA (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little)

static int
TkMacOSXPutImage(
Expand Down

0 comments on commit c0764ea

Please sign in to comment.