Once I run application on iPad I see crash of application within the initWithImage function. It does not happen on simulator.
@implementation CCTexture2D (Image)
- (id) initWithImage:(UIImage *)uiImage
...
// Create the bitmap graphics context
switch(pixelFormat) {
case kCCTexture2DPixelFormat_RGBA8888:
case kCCTexture2DPixelFormat_RGBA4444:
case kCCTexture2DPixelFormat_RGB5A1:
colorSpace = CGColorSpaceCreateDeviceRGB();
data = malloc(POTHigh * POTWide * 4);
info = hasAlpha ? kCGImageAlphaPremultipliedLast : kCGImageAlphaNoneSkipLast;
// info = kCGImageAlphaPremultipliedLast; // issue #886. This patch breaks BMP images.
context = CGBitmapContextCreate(data, POTWide, POTHigh, 8, 4 * POTWide, colorSpace, info | kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace);
break;
case kCCTexture2DPixelFormat_RGB565:
colorSpace = CGColorSpaceCreateDeviceRGB();
data = malloc(POTHigh * POTWide * 4);
info = kCGImageAlphaNoneSkipLast;
context = CGBitmapContextCreate(data, POTWide, POTHigh, 8, 4 * POTWide, colorSpace, info | kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace);
break;
case kCCTexture2DPixelFormat_A8:
data = malloc(POTHigh * POTWide);
info = kCGImageAlphaOnly;
context = CGBitmapContextCreate(data, POTWide, POTHigh, 8, POTWide, NULL, info);
break;
default:
[NSException raise:NSInternalInconsistencyException format:@"Invalid pixel format"];
}
CGContextClearRect(context, CGRectMake(0, 0, POTWide, POTHigh));
CGContextTranslateCTM(context, 0, POTHigh - imageSize.height);
===================
crash here
---> CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(CGImage), CGImageGetHeight(CGImage)), CGImage);
This file is loaded with LevelHelper (png file was created with SpriteHelper). It works fine once loaded for the first time. It breakes on nect attempt after the memory warning is handled (and the texture cache is cleaned). Could you please help with the next steps of investigations?