changeset 1318:ebd67be26f43

Fixed some issues and deprecations building with Xcode 4.2 on Mac. Also in dw_pixmap_grab() the representation neededed to be flipped.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 05 Nov 2011 14:30:04 +0000
parents 52de99e55f5f
children 03f0bc85e7be
files mac/dw.m
diffstat 1 files changed, 28 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Sat Nov 05 02:21:56 2011 +0000
+++ b/mac/dw.m	Sat Nov 05 14:30:04 2011 +0000
@@ -4263,8 +4263,8 @@
 
         for(z=0;z<count;z++)
         {
-            NSString *nstr = [ NSString stringWithUTF8String:text[z] ];
-            NSArray *newrow = [[NSArray alloc] arrayWithObject:nstr];
+            NSString *nstr = [NSString stringWithUTF8String:text[z]];
+            NSArray *newrow = [NSArray arrayWithObjects:nstr,nil];
 
             [cont addRow:newrow];
         }
@@ -6752,13 +6752,32 @@
     NSBundle *bundle = [NSBundle mainBundle];
     NSString *respath = [bundle resourcePath];
     NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid];
-    NSBitmapImageRep *image = [[NSBitmapImageRep alloc] initWithContentsOfFile:filepath];
-    NSSize size = [image size];
-    pixmap->width = size.width;
-    pixmap->height = size.height;
-    pixmap->image = image;
-    pixmap->handle = handle;
-    return pixmap;
+    NSImage *temp = [[NSImage alloc] initWithContentsOfFile:filepath];
+    
+    if(temp)
+    {
+        NSSize size = [temp size];
+        NSBitmapImageRep *image = [[NSBitmapImageRep alloc]
+                                   initWithBitmapDataPlanes:NULL
+                                   pixelsWide:size.width
+                                   pixelsHigh:size.height
+                                   bitsPerSample:8
+                                   samplesPerPixel:4
+                                   hasAlpha:YES
+                                   isPlanar:NO
+                                   colorSpaceName:NSDeviceRGBColorSpace
+                                   bytesPerRow:0
+                                   bitsPerPixel:0];
+        _flip_image(temp, image, size);
+        pixmap->width = size.width;
+        pixmap->height = size.height;
+        pixmap->image = image;
+        pixmap->handle = handle;
+        [temp release];
+        return pixmap;
+    }
+    free(pixmap);
+    return NULL;
 }
 
 /*