[Gridflow-cvs] [svn] commit: r5464 - /trunk/src/quartz.m

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Fri Apr 16 01:39:05 EDT 2010


Author: matju
Date: Fri Apr 16 01:39:05 2010
New Revision: 5464

Log:
undo most of last changes...

Modified:
    trunk/src/quartz.m

Modified: trunk/src/quartz.m
==============================================================================
--- trunk/src/quartz.m (original)
+++ trunk/src/quartz.m Fri Apr 16 01:39:05 2010
@@ -42,7 +42,6 @@
 	uint8 *imdata;
 	int imwidth;
 	int imheight;
-	CGImageRef image;
   @public
 	FormatQuartz *boss;
 }
@@ -138,29 +137,32 @@
 	CLEAR(imdata,size);
 	NSSize s = {w,h};
 	[[self window] setContentSize: s];
+	return self;
+}
+
+- (id) initWithFrame: (NSRect)r {
+	[super initWithFrame: r];
+	imdata=0; imwidth=-1; imheight=-1;
+	[self imageHeight: 240 width: 320];
+	return self;
+}	
+
+- (id) drawRect: (NSRect)rect {
+	[super drawRect: rect];
+	//if (![self lockFocusIfCanDraw]) return self;
+	CGContextRef g = (CGContextRef)
+		[[NSGraphicsContext graphicsContextWithWindow: [self window]]
+			graphicsPort];
 	CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
-	CGDataProviderRef dp = CGDataProviderCreateWithData(NULL, imdata, imheight*imwidth*4, NULL);
+	CGDataProviderRef dp = CGDataProviderCreateWithData(
+		NULL, imdata, imheight*imwidth*4, NULL);
 	CGImageRef image = CGImageCreate(imwidth, imheight, 8, 32, imwidth*4, 
 		cs, kCGImageAlphaFirst, dp, NULL, 0, kCGRenderingIntentDefault);
 	CGDataProviderRelease(dp);
 	CGColorSpaceRelease(cs);
-	return self;
-}
-
-- (id) initWithFrame: (NSRect)r {
-	[super initWithFrame: r];
-	image=0; imdata=0; imwidth=-1; imheight=-1;
-	[self imageHeight: 240 width: 320];
-	return self;
-}	
-
-- (id) drawRect: (NSRect)rect {
-	[super drawRect: rect];
-	//if (![self lockFocusIfCanDraw]) return self;
-	CGContextRef g = (CGContextRef) [[NSGraphicsContext graphicsContextWithWindow: [self window]] graphicsPort];
 	CGRect rectangle = CGRectMake(0,0,imwidth,imheight);
-	if (image) CGContextDrawImage(g,rectangle,image);
-	//CGImageRelease(image);
+	CGContextDrawImage(g,rectangle,image);
+	CGImageRelease(image);
 	//[self unlockFocus];
 	return self;
 }



More information about the Gridflow-cvs mailing list