CGBitmapContextCreate on the iPhone/iPad

前端 未结 8 425

I have a method that needs to parse through a bunch of large PNG images pixel by pixel (the PNGs are 600x600 pixels each). It seems to work great on the Simulator, but on th

8条回答
  •  一生所求
    2021-01-12 17:50

    Maybe replace

    CGColorSpaceRelease(colorSpace);
    CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef);
    

    with

    CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef);
    CGColorSpaceRelease(colorSpace);
    

    as the color space ref might still be needed somehow? Just a random guess... And maybe even put it behind the release of the context?

    // cleanup
    CGContextRelease(context);
    CGColorSpaceRelease(colorSpace);
    

提交回复
热议问题