]> code.delx.au - gnu-emacs/blobdiff - src/nsimage.m
xdisp.c (CHAR_COMPOSED_P): New arg END_CHARPOS. Callers changed.
[gnu-emacs] / src / nsimage.m
index f99a9d2a03eb9b3c1812251b4b1b33e1e26fb4ea..09a78e2080959170abd1996f355c26860c6f7919 100644 (file)
@@ -1,5 +1,5 @@
 /* Image support for the NeXT/Open/GNUstep and MacOSX window system.
-   Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009
+   Copyright (C) 1989, 1992, 1993, 1994, 2005, 2006, 2008, 2009, 2010
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -28,6 +28,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 /* This should be the first include, as it may set up #defines affecting
    interpretation of even the system includes. */
 #include "config.h"
+#include <setjmp.h>
 
 #include "lisp.h"
 #include "dispextern.h"
@@ -93,7 +94,7 @@ ns_load_image (struct frame *f, struct image *img,
     }
   else
     {
-      NSData *data = [NSData dataWithBytes: XSTRING (spec_data)->data
+      NSData *data = [NSData dataWithBytes: SDATA (spec_data)
                                     length: SBYTES (spec_data)];
       eImg = [[EmacsImage alloc] initWithData: data];
       [eImg setPixmapData];
@@ -329,7 +330,7 @@ static EmacsImage *ImageList = nil;
   NSSize s = [self size];
   int len = (int) s.width * s.height;
   unsigned char *planes[5];
-  float r, g, b, a;
+  CGFloat r, g, b, a;
   NSColor *rgbColor;
 
   if (bmRep == nil || color == nil)
@@ -400,6 +401,12 @@ static EmacsImage *ImageList = nil;
 
           if ([bmRep numberOfPlanes] >= 3)
               [bmRep getBitmapDataPlanes: pixmapData];
+
+          /* The next two lines cause the DPI of the image to be ignored.
+             This seems to be the behavior users expect. */
+          [self setScalesWhenResized: YES];
+          [self setSize: NSMakeSize([bmRep pixelsWide], [bmRep pixelsHigh])];
+
           break;
         }
     }
@@ -425,7 +432,7 @@ static EmacsImage *ImageList = nil;
   else if (onTiger)
     {
       NSColor *color = [bmRep colorAtX: x y: y];
-      float r, g, b, a;
+      CGFloat r, g, b, a;
       [color getRed: &r green: &g blue: &b alpha: &a];
       return ((int)(a * 255.0) << 24)
         | ((int)(r * 255.0) << 16) | ((int)(g * 255.0) << 8)
@@ -453,7 +460,8 @@ static EmacsImage *ImageList = nil;
   else if (onTiger)
     {
       [bmRep setColor:
-               [NSColor colorWithCalibratedRed: r green: g blue: b alpha: a]
+               [NSColor colorWithCalibratedRed: (r/255.0) green: (g/255.0)
+                                          blue: (b/255.0) alpha: (a/255.0)]
                   atX: x y: y];
     }
 }