【修复】【兼容iOS7】cocos2d-x 2.04 图片加载 Error>: CGBitmapContextCreate

Bug说明:

CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 24 bits/pixel; 3-component color space; kCGImageAlphaNone; 363 bytes/row.


解决方法:

1.找到CCimage.mm 的 

static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAlign, const char * pFontName, int nSize, tImageInfo* pInfo)方法

2.把方法内的

 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

        CGContextRef context = CGBitmapContextCreate(data, dim.width, dim.height, 8, dim.width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);

        CGColorSpaceRelease(colorSpace);

3.改为:

const int _width  = dim.width;

        const int _height = dim.height;

        // draw text

        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

        CGContextRef context =CGBitmapContextCreate(data, _width, _height, 8, _width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);


4.现在再试试,你的游戏是不是已经风骚的跑起来了


你可能感兴趣的:(【修复】【兼容iOS7】cocos2d-x 2.04 图片加载 Error>: CGBitmapContextCreate)