Skip to content

Commit

Permalink
Fixed bug 1413 - Cannot load images with ImageIO enabled on Mac OS X
Browse files Browse the repository at this point in the history
The attached diff fixes the library so ImageIO can be used and images are
displayed again without corruption and black screens.

(Based on http://pastebin.com/T3s15UXF and
http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html)

I suspect the matrix passed to CGColorSpaceCreateCalibratedRGB() as implemented
in r292 is invalid and the CoreGraphics framework on 10.5 doesn't reject it,
but later ones do. Unfortunately all the documentation I can find doesn't
actually specify what the valid range of values of the arguments is.
  • Loading branch information
slouken committed Jan 1, 2013
1 parent 39dd552 commit 25b51d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES
@@ -1,4 +1,6 @@
1.2.12:
mscott - 2012-02-06 19:40:23 PST
* Fixed image corruption when using ImageIO framework
Sylvain - Thu Nov 22 13:09:59 PST 2012
* Added extended XPM color table (disabled by default in IMG_xpm.c)
Sam Lantinga - Thu Jan 19 23:18:09 EST 2012
Expand Down
10 changes: 5 additions & 5 deletions IMG_ImageIO.m
Expand Up @@ -217,13 +217,13 @@ static CFDictionaryRef CreateHintDictionary(CFStringRef uti_string_hint)
* libpng loader.
* Thanks to Allegro. :)
*/
CGFloat whitePoint[3] = { 1, 1, 1 };
CGFloat blackPoint[3] = { 0, 0, 0 };
CGFloat whitePoint[3] = { 0.950, 1.000, 1.089 };
CGFloat blackPoint[3] = { 0.000, 0.000, 0.000 };
CGFloat gamma[3] = { 2.2, 2.2, 2.2 };
CGFloat matrix[9] = {
1, 1, 1,
1, 1, 1,
1, 1, 1
0.412, 0.213, 0.019,
0.358, 0.715, 0.119,
0.180, 0.072, 0.950
};
CGColorSpaceRef color_space =
CGColorSpaceCreateCalibratedRGB(
Expand Down

0 comments on commit 25b51d0

Please sign in to comment.