New in 10.7.4: NSReadPixel from 0,0 yields nil NSColor

Originator:jalkut
Number:rdar://11440527 Date Originated:12-May-2012 07:47 AM
Status:Open Resolved:
Product:Mac OS X Product Version:10.7.4
Classification:Serious Bug Reproducible:Always
 
12-May-2012 07:47 AM Daniel Jalkut:
Starting in 10.7.4, some PNG images that were previously "fine" are drawing transparently, that is, as if they have no image content whatsoever.

I'm attaching three example images from the open source "TunesWindow" from Matt Gemmell, which demonstrate the problem. These images draw fine in 10.7.3 but in 10.7.4 they are shown transparent. They are also shown transparent in e.g. Quicklook and Preview, but if you open them in an app such as Acorn their content is visible.

The ramifications of this are great especially when such images are used to compose a user interface, as they are in TunesWindow, which is code that many different apps share.


12-May-2012 07:47 AM Daniel Jalkut:
'FlatTopImages.zip' was successfully uploaded

12-May-2012 07:53 AM Daniel Jalkut:
Nobody panic - I may be losing my mind :) Now the images are showing up fine in Preview. May have jumped to conclusions. Investigating.

11-May-2012 08:27 PM Daniel Jalkut:
OK - I am on to something changed in AppKit, but it's not what I first assumed. 

The attached project demonstrates that 

[topMiddle lockFocus];
NSColor *bgColor = NSReadPixel(NSMakePoint(0, 0));
[topMiddle unlockFocus];

Yields a nil color (even though the pixel is present), while:

[topMiddle lockFocus];
NSColor *bgColor = NSReadPixel(NSMakePoint(1, 1));
[topMiddle unlockFocus];

Yields a valid color.

The bug in this case actually is based not on inability to draw the specified images, but in failure to set up the background color for the window to match the images.


11-May-2012 08:27 PM Daniel Jalkut:
'NSGetColorTest.zip' was successfully uploaded

Comments

About the attached images

The attached images are from TunesWindow's resources:

flat_top_left.png flat_top_middle.png flat_top_right.png

TunesWindow can be downloaded here, for reference:

http://mattgemmell.com/source/


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!