project_files/HedgewarsMobile/Classes/UIImageExtra.m
changeset 4356 d1d26f8963a3
parent 3978 9660600e43cb
child 4446 3093791dc620
--- a/project_files/HedgewarsMobile/Classes/UIImageExtra.m	Wed Nov 24 23:35:41 2010 +0100
+++ b/project_files/HedgewarsMobile/Classes/UIImageExtra.m	Thu Nov 25 02:45:52 2010 +0100
@@ -232,16 +232,22 @@
 }
 
 +(UIImage *)whiteImage:(CGSize) ofSize {
-    UIGraphicsBeginImageContext(ofSize);
-    CGContextRef context = UIGraphicsGetCurrentContext();
-    UIGraphicsPushContext(context);
+    CGFloat w = ofSize.width;
+    CGFloat h = ofSize.height;
 
+    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+    CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst);
+
+    CGContextBeginPath(context);
     CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0);
     CGContextFillRect(context,CGRectMake(0,0,ofSize.width,ofSize.height));
 
-    UIGraphicsPopContext();
-    UIImage *bkgImg = UIGraphicsGetImageFromCurrentImageContext();
-    UIGraphicsEndImageContext();
+    CGImageRef image = CGBitmapContextCreateImage(context);
+    CGContextRelease(context);
+    CGColorSpaceRelease(colorSpace);
+
+    UIImage *bkgImg = [UIImage imageWithCGImage:image];
+    CGImageRelease(image);
     return bkgImg;
 }