emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105344: Fix image fg and bg colors o


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105344: Fix image fg and bg colors on NS (Bug#9175).
Date: Thu, 28 Jul 2011 14:29:09 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105344
author: Alp Aker <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Thu 2011-07-28 14:29:09 -0400
message:
  Fix image fg and bg colors on NS (Bug#9175).
  
  * nsfns.m (x_set_foreground_color): Set f->foreground_pixel when
  setting frame foreground color.
  (x_set_background_color): Likewise.
modified:
  src/ChangeLog
  src/nsfns.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-07-28 18:26:29 +0000
+++ b/src/ChangeLog     2011-07-28 18:29:09 +0000
@@ -1,4 +1,10 @@
-2011-07-26  Alp Aker  <address@hidden>
+2011-07-28  Alp Aker  <address@hidden>
+
+       * nsfns.m (x_set_foreground_color): Set f->foreground_pixel when
+       setting frame foreground color (Bug#9175).
+       (x_set_background_color): Likewise.
+
+2011-07-28  Alp Aker  <address@hidden>
 
        Implement strike-through and overline on NextStep (Bug#8863).
 

=== modified file 'src/nsfns.m'
--- a/src/nsfns.m       2011-07-08 15:39:40 +0000
+++ b/src/nsfns.m       2011-07-28 18:29:09 +0000
@@ -321,6 +321,7 @@
 x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   NSColor *col;
+  CGFloat r, g, b, alpha;
 
   if (ns_lisp_to_color (arg, &col))
     {
@@ -332,6 +333,10 @@
   [f->output_data.ns->foreground_color release];
   f->output_data.ns->foreground_color = col;
 
+  [col getRed: &r green: &g blue: &b alpha: &alpha];
+  FRAME_FOREGROUND_PIXEL (f) =
+    ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff), 
(int)(b*0xff));
+
   if (FRAME_NS_VIEW (f))
     {
       update_face_from_frame_parameter (f, Qforeground_color, arg);
@@ -348,7 +353,7 @@
   struct face *face;
   NSColor *col;
   NSView *view = FRAME_NS_VIEW (f);
-  float alpha;
+  CGFloat r, g, b, alpha;
 
   if (ns_lisp_to_color (arg, &col))
     {
@@ -364,10 +369,14 @@
   [col retain];
   [f->output_data.ns->background_color release];
   f->output_data.ns->background_color = col;
+
+  [col getRed: &r green: &g blue: &b alpha: &alpha];
+  FRAME_BACKGROUND_PIXEL (f) =
+    ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff), 
(int)(b*0xff));
+
   if (view != nil)
     {
       [[view window] setBackgroundColor: col];
-      alpha = [col alphaComponent];
 
       if (alpha != 1.0)
           [[view window] setOpaque: NO];


reply via email to

[Prev in Thread] Current Thread [Next in Thread]