changeset 101329:954e1944ccf2

* nsimage.m (EmacsImage-setPixelAtX:Y:toRed:green:blue:alpha:): Fix color values in onTiger section. * nsterm.m (ns_defined_color): Fix settings of the XColor variable fields: red,green,blue scale to 2-byte, pixel's components to 1-byte. (Bug#1663)
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Wed, 21 Jan 2009 22:28:45 +0000
parents 1fff4a4a0c27
children eca9795f3903
files src/ChangeLog src/nsimage.m src/nsterm.m
diffstat 3 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Jan 21 22:26:32 2009 +0000
+++ b/src/ChangeLog	Wed Jan 21 22:28:45 2009 +0000
@@ -18,9 +18,13 @@
 	(EmacsPrefsController-setPanelFromDefaultValues) New function.
 	(EmacsPrefsController-resetToDefaults:): Use it. (Bug#1801)
 	(ns_font_to_xlfd, ns_fontname_to_xlfd): Remove, unused.
-
-	* nsimage.m (EmacsImage+allocInitFromFile:): Set to ignore DPI.
-	(Bug#1316)
+	(ns_defined_color): Fix settings of the XColor variable fields:
+	red,green,blue scale to 2-byte, pixel's parts to 1-byte. (Bug#1663)
+
+	* nsimage.m (EmacsImage+allocInitFromFile:): Set to ignore image
+	DPI. (Bug#1316)
+	(EmacsImage-setPixelAtX:Y:toRed:green:blue:alpha:): Fix color
+	values in onTiger section.
 
 2009-01-19  Chong Yidong  <cyd@stupidchicken.com>
 
--- a/src/nsimage.m	Wed Jan 21 22:26:32 2009 +0000
+++ b/src/nsimage.m	Wed Jan 21 22:28:45 2009 +0000
@@ -453,7 +453,8 @@
   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];
     }
 }
--- a/src/nsterm.m	Wed Jan 21 22:26:32 2009 +0000
+++ b/src/nsterm.m	Wed Jan 21 22:28:45 2009 +0000
@@ -1610,14 +1610,14 @@
       color_def->pixel = ns_index_color(temp, f); /* [temp retain]; */
 
   [temp getRed: &r green: &g blue: &b alpha: &a];
-  color_def->red   = r * 256;
-  color_def->green = g * 256;
-  color_def->blue  = b * 256;
+  color_def->red   = r * 65535;
+  color_def->green = g * 65535;
+  color_def->blue  = b * 65535;
 
   if (!makeIndex)
     color_def->pixel
-      = ARGB_TO_ULONG((int)(a*256),
-		      color_def->red, color_def->green, color_def->blue);
+      = ARGB_TO_ULONG((int)(a*255),
+		      (int)(r*255), (int)(g*255), (int)(b*255));
 
   return 1;
 }