changeset 1713:c836c6c33d8e

Create an internal _dw_icon_load() which does not resize the image on Mac. Found that I was using dw_icon_load() internally in dw_window_set_bitmap() which had the effect of resizing images that shouldn't have been.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 07 May 2012 13:56:14 +0000
parents daa59fc8d6e5
children df5f0857f765
files mac/dw.m
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Mon May 07 13:29:51 2012 +0000
+++ b/mac/dw.m	Mon May 07 13:56:14 2012 +0000
@@ -6838,6 +6838,16 @@
     }
 }
 
+/* Internal version that does not resize the image */
+HICN _dw_icon_load(unsigned long resid)
+{
+    NSBundle *bundle = [NSBundle mainBundle];
+    NSString *respath = [bundle resourcePath];
+    NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid];
+    NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath];
+    return image;
+}
+
 /*
  * Obtains an icon from a module (or header in GTK).
  * Parameters:
@@ -6848,10 +6858,7 @@
  */
 HICN API dw_icon_load(unsigned long module, unsigned long resid)
 {
-    NSBundle *bundle = [NSBundle mainBundle];
-    NSString *respath = [bundle resourcePath];
-    NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid];
-    NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath];
+    NSImage *image = _dw_icon_load(resid);
     _icon_resize(image);
     return image;
 }
@@ -8901,7 +8908,7 @@
         }
         else if(resid > 0 && resid < 65536)
         {
-            bitmap = dw_icon_load(0, resid);
+            bitmap = _dw_icon_load(resid);
         }
 
         if(bitmap)