From: Jay Freeman (saurik) Date: Sun, 24 Aug 2008 23:53:20 +0000 (+0000) Subject: This version works. X-Git-Tag: v0.9.2591~4 X-Git-Url: https://git.saurik.com/veency.git/commitdiff_plain/8d35bbb12b253fa3759d42ef4bdddd0a4092a4fe This version works. --- diff --git a/iphonevnc/iPhoneVNC.mm b/iphonevnc/iPhoneVNC.mm index eac7e0f..aef6fc9 100644 --- a/iphonevnc/iPhoneVNC.mm +++ b/iphonevnc/iPhoneVNC.mm @@ -5,7 +5,7 @@ #include #include -extern "C" UIImage *UIGetScreenImage(); +extern "C" CGImageRef UIGetScreenImage(); static const size_t Width = 320; static const size_t Height = 480; @@ -16,6 +16,9 @@ static const size_t Stride = Width * BytesPerPixel; static const size_t Size32 = Width * Height; static const size_t Size8 = Size32 * BytesPerPixel; +extern "C" void *NSPushAutoreleasePool(void *); +extern "C" void NSPopAutoreleasePool(void *); + CGContextRef CreateContext() { uint8_t *buffer = (uint8_t *) malloc(Size8); if (buffer == NULL) @@ -53,13 +56,13 @@ int main(int argc, char *argv[]) { uint8_t *buffer1 = (uint8_t *) CGBitmapContextGetData(context1); screen->frameBuffer = (char *) buffer0; - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + void *pool = NSPushAutoreleasePool(0); - UIImageRef *image = UIGetScreenImage(); - CGImageRef ref = [image CGImage]; - CGContextDrawImage(context0, rect, ref); + CGImageRef image = UIGetScreenImage(); + CGContextDrawImage(context0, rect, image); + CFRelease(image); - [pool release]; + NSPopAutoreleasePool(pool); if (memcmp(buffer0, buffer1, Size8) != 0) rfbMarkRectAsModified(screen, 0, 0, Width, Height); diff --git a/iphonevnc/makefile b/iphonevnc/makefile index 71d5a76..77aa29e 100644 --- a/iphonevnc/makefile +++ b/iphonevnc/makefile @@ -11,6 +11,9 @@ iPhoneVNC: iPhoneVNC.mm makefile -lvncserver -lz \ -framework CoreFoundation \ -framework CoreGraphics \ - -framework LayerKit + -framework UIKit \ + -lobjc \ + -framework Foundation + ldid -S iPhoneVNC .PHONY: all clean test