From e45a75f2f65871c429b771fe44a77b658f59d766 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Mon, 29 Oct 2012 23:16:01 +0000 Subject: [PATCH] - minor optimization in iOS image loader native code git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9916 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/ios/jme-ios.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/src/ios/jme-ios.m b/engine/src/ios/jme-ios.m index e53a7b2a8..d62bb01e8 100644 --- a/engine/src/ios/jme-ios.m +++ b/engine/src/ios/jme-ios.m @@ -64,17 +64,16 @@ Java_com_jme3_system_ios_IosImageLoader_loadImageData(JNIEnv* e, jclass obj, job CGImageRef inImage = [inputImage CGImage]; int ht = CGImageGetWidth(inImage); int wdth = CGImageGetHeight(inImage); - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); // NewDirectByteBuffer seems to fail? -> Creating ByteBuffer in java jobject nativeBuffer = (*e)->CallStaticObjectMethod(e, bufferUtilsClass, newBufferMethod, ht*wdth*4); if (checkJNIException(e)) { - CGColorSpaceRelease(colorSpace); [inData release]; return nil; } void *rawData = (*e)->GetDirectBufferAddress(e, nativeBuffer); NSUInteger bytesPerRowImg = CGImageGetBytesPerRow(inImage); NSUInteger bitsPerComponentImg = CGImageGetBitsPerComponent(inImage); + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(rawData,ht,wdth,bitsPerComponentImg,bytesPerRowImg,colorSpace,kCGImageAlphaPremultipliedLast| kCGBitmapByteOrder32Big); CGColorSpaceRelease(colorSpace); CGContextDrawImage(context,CGRectMake(0,0,wdth,ht), inImage);