[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/ns/testing f7ada2d 2/6: Further cleanup of NS color code
From: |
Alan Third |
Subject: |
scratch/ns/testing f7ada2d 2/6: Further cleanup of NS color code |
Date: |
Tue, 31 Aug 2021 15:51:14 -0400 (EDT) |
branch: scratch/ns/testing
commit f7ada2d33978664ffd79fb178d6d17644590941b
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>
Further cleanup of NS color code
* src/dispextern.h (FACE_COLOR_TO_PIXEL): Remove define and fix all
callers.
* src/nsterm.h (struct nsfont_info): Remove color_table.
* src/nsterm.m ([NSColor colorWithUnsignedLong:]): Always assume the
input contains the correct alpha value.
(ns_lookup_indexed_color):
(ns_index_color):
(ns_color_index_to_rgba): Remove functions and fix all callers.
(ns_query_color): No longer set pixel to the lookup table index,
always just set it to the ARGB integer value.
(ns_defined_color): Ignore makeindex as we no longer set pixel to the
lookup table index.
(ns_initialize_display_info):
(ns_redisplay_interface): Remove lookup table.
(ns_term_init): Fix the alpha setting.
---
src/dispextern.h | 5 --
src/image.c | 4 +-
src/nsfns.m | 6 +--
src/nsfont.m | 6 +--
src/nsgui.h | 3 --
src/nsterm.h | 11 +---
src/nsterm.m | 149 ++++++++++++++++++-------------------------------------
src/xdisp.c | 6 +--
8 files changed, 59 insertions(+), 131 deletions(-)
diff --git a/src/dispextern.h b/src/dispextern.h
index 33fcaa4..6dbd545 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -123,15 +123,10 @@ typedef HDC Emacs_Pix_Context;
#ifdef HAVE_NS
#include "nsgui.h"
-#define FACE_COLOR_TO_PIXEL(face_color, frame) (FRAME_NS_P (frame) \
- ? ns_color_index_to_rgba
(face_color, frame) \
- : face_color)
/* Following typedef needed to accommodate the MSDOS port, believe it or not.
*/
typedef struct ns_display_info Display_Info;
typedef Emacs_Pixmap Emacs_Pix_Container;
typedef Emacs_Pixmap Emacs_Pix_Context;
-#else
-#define FACE_COLOR_TO_PIXEL(face_color, frame) face_color
#endif
#ifdef HAVE_WINDOW_SYSTEM
diff --git a/src/image.c b/src/image.c
index 6d00f15..c1bc38a 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2437,8 +2437,8 @@ lookup_image (struct frame *f, Lisp_Object spec, int
face_id)
face_id = DEFAULT_FACE_ID;
struct face *face = FACE_FROM_ID (f, face_id);
- unsigned long foreground = FACE_COLOR_TO_PIXEL (face->foreground, f);
- unsigned long background = FACE_COLOR_TO_PIXEL (face->background, f);
+ unsigned long foreground = face->foreground;
+ unsigned long background = face->background;
int font_size = face->font->pixel_size;
char *font_family = SSDATA (face->lface[LFACE_FAMILY_INDEX]);
diff --git a/src/nsfns.m b/src/nsfns.m
index 9e75d53..f4b25b9 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -300,9 +300,9 @@ ns_set_background_color (struct frame *f, Lisp_Object arg,
Lisp_Object oldval)
face = FRAME_DEFAULT_FACE (f);
if (face)
{
- col = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f);
- face->background = ns_index_color
- ([col colorWithAlphaComponent: alpha], f);
+ col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)];
+ face->background = [[col colorWithAlphaComponent: alpha]
+ unsignedLong];
update_face_from_frame_parameter (f, Qbackground_color, arg);
}
diff --git a/src/nsfont.m b/src/nsfont.m
index 5a9cdfe..c48db7f 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -1070,7 +1070,7 @@ nsfont_draw (struct glyph_string *s, int from, int to,
int x, int y,
if (!s->face->stipple)
[(NS_FACE_BACKGROUND (face) != 0
- ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f)
+ ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
: FRAME_BACKGROUND_COLOR (s->f)) set];
else
{
@@ -1085,12 +1085,12 @@ nsfont_draw (struct glyph_string *s, int from, int to,
int x, int y,
r.origin.y = y;
col = (NS_FACE_FOREGROUND (face) != 0
- ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f)
+ ? [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)]
: FRAME_FOREGROUND_COLOR (s->f));
bgCol = (flags != NS_DUMPGLYPH_FOREGROUND ? nil
: (NS_FACE_BACKGROUND (face) != 0
- ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f)
+ ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
: FRAME_BACKGROUND_COLOR (s->f)));
/* render under GNUstep using DPS */
diff --git a/src/nsgui.h b/src/nsgui.h
index e4038d3..e79fcab 100644
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -58,9 +58,6 @@ typedef struct _XCharStruct
int descent;
} XCharStruct;
-/* Used in xdisp.c when comparing faces and frame colors. */
-extern unsigned long ns_color_index_to_rgba(int idx, struct frame *f);
-
#ifdef __OBJC__
typedef id Emacs_Pixmap;
#else
diff --git a/src/nsterm.h b/src/nsterm.h
index a10e108..215e8e4 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -356,6 +356,7 @@ typedef id instancetype;
@interface NSColor (EmacsColor)
+ (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green
blue:(CGFloat)blue alpha:(CGFloat)alpha;
++ (NSColor *)colorWithUnsignedLong:(unsigned long)c;
- (NSColor *)colorUsingDefaultColorSpace;
- (unsigned long)unsignedLong;
@end
@@ -819,12 +820,6 @@ struct ns_display_info
ptrdiff_t bitmaps_size;
ptrdiff_t bitmaps_last;
-#ifdef __OBJC__
- NSMutableArray *color_table;
-#else
- void *color_table;
-#endif
-
/* DPI resolution of this screen */
double resx, resy;
@@ -1094,13 +1089,9 @@ ns_defined_color (struct frame *f,
const char *name,
Emacs_Color *color_def, bool alloc,
bool makeIndex);
-extern void
-ns_query_color (void *col, Emacs_Color *color_def, bool setPixel);
#ifdef __OBJC__
extern int ns_lisp_to_color (Lisp_Object color, NSColor **col);
-extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f);
-extern unsigned long ns_index_color (NSColor *color, struct frame *f);
extern const char *ns_get_pending_menu_title (void);
#endif
diff --git a/src/nsterm.m b/src/nsterm.m
index 4059e82..ede6626 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -166,15 +166,13 @@ char const * nstrace_fullscreen_type_name (int fs_type)
}
+ (NSColor *)colorWithUnsignedLong:(unsigned long)c
- hasAlpha:(BOOL)alpha
{
EmacsCGFloat a = (double)((c >> 24) & 0xff) / 255.0;
EmacsCGFloat r = (double)((c >> 16) & 0xff) / 255.0;
EmacsCGFloat g = (double)((c >> 8) & 0xff) / 255.0;
EmacsCGFloat b = (double)(c & 0xff) / 255.0;
- return [NSColor colorForEmacsRed:r green:g blue:b
- alpha:(alpha ? a : (EmacsCGFloat)1.0)];
+ return [NSColor colorForEmacsRed:r green:g blue:b alpha:a];
}
- (unsigned long)unsignedLong
@@ -1974,35 +1972,6 @@ ns_fullscreen_hook (struct frame *f)
==========================================================================
*/
-NSColor *
-ns_lookup_indexed_color (unsigned long idx, struct frame *f)
-{
- NSMutableArray *color_table = FRAME_DISPLAY_INFO (f)->color_table;
- if (idx < 1 || idx >= [color_table count])
- return nil;
- return [color_table objectAtIndex:idx];
-}
-
-
-unsigned long
-ns_index_color (NSColor *color, struct frame *f)
-{
- NSMutableArray *color_table = FRAME_DISPLAY_INFO (f)->color_table;
-
- /* An index of 0 appears to be special in some way, so insert a
- dummy object. */
- if ([color_table count] == 0)
- [color_table addObject:[NSNull null]];
-
- /* Do we already have this color? */
- if ([color_table containsObject:color])
- return [color_table indexOfObject:color];
-
- [color_table addObject:color];
- return [color_table count] - 1;
-}
-
-
static int
ns_get_color (const char *name, NSColor **col)
/* --------------------------------------------------------------------------
@@ -2127,25 +2096,11 @@ ns_lisp_to_color (Lisp_Object color, NSColor **col)
return 1;
}
-/* Convert an index into the color table into an RGBA value. Used in
- xdisp.c:extend_face_to_end_of_line when comparing faces and frame
- color values. */
-
-unsigned long
-ns_color_index_to_rgba(int idx, struct frame *f)
-{
- NSColor *col;
- col = ns_lookup_indexed_color (idx, f);
-
- return [col unsignedLong];
-}
-
void
-ns_query_color(void *col, Emacs_Color *color_def, bool setPixel)
+ns_query_color(void *col, Emacs_Color *color_def)
/* --------------------------------------------------------------------------
- Get ARGB values out of NSColor col and put them into color_def.
- If setPixel, set the pixel to a concatenated version.
- and set color_def pixel to the resulting index.
+ Get ARGB values out of NSColor col and put them into color_def
+ and set color_def pixel to the ARGB color.
--------------------------------------------------------------------------
*/
{
EmacsCGFloat r, g, b, a;
@@ -2155,8 +2110,7 @@ ns_query_color(void *col, Emacs_Color *color_def, bool
setPixel)
color_def->green = g * 65535;
color_def->blue = b * 65535;
- if (setPixel == YES)
- color_def->pixel = [(NSColor *)col unsignedLong];
+ color_def->pixel = [(NSColor *)col unsignedLong];
}
bool
@@ -2164,12 +2118,9 @@ ns_defined_color (struct frame *f,
const char *name,
Emacs_Color *color_def,
bool alloc,
- bool makeIndex)
+ bool _makeIndex)
/* --------------------------------------------------------------------------
Return true if named color found, and set color_def rgb accordingly.
- If makeIndex and alloc are nonzero put the color in the color_table,
- and set color_def pixel to the resulting index.
- If makeIndex is zero, set color_def pixel to ARGB.
Return false if not found.
--------------------------------------------------------------------------
*/
{
@@ -2182,9 +2133,7 @@ ns_defined_color (struct frame *f,
unblock_input ();
return 0;
}
- if (makeIndex && alloc)
- color_def->pixel = ns_index_color (col, f);
- ns_query_color (col, color_def, !makeIndex);
+ ns_query_color (col, color_def);
unblock_input ();
return 1;
}
@@ -2195,7 +2144,7 @@ ns_query_frame_background_color (struct frame *f,
Emacs_Color *bgcolor)
External (hook): Store F's background color into *BGCOLOR
--------------------------------------------------------------------------
*/
{
- ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, true);
+ ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor);
}
static void
@@ -2612,8 +2561,8 @@ ns_clear_frame (struct frame *f)
block_input ();
ns_focus (f, &r, 1);
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND
- (FACE_FROM_ID (f, DEFAULT_FACE_ID)), f) set];
+ [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
+ (FACE_FROM_ID (f, DEFAULT_FACE_ID))] set];
NSRectFill (r);
ns_unfocus (f);
@@ -2642,7 +2591,7 @@ ns_clear_frame_area (struct frame *f, int x, int y, int
width, int height)
r = NSIntersectionRect (r, [view frame]);
ns_focus (f, &r, 1);
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
+ [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
NSRectFill (r);
@@ -2746,7 +2695,7 @@ ns_clear_under_internal_border (struct frame *f)
return;
ns_focus (f, NULL, 1);
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
+ [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
for (int i = 0; i < 4 ; i++)
{
NSDivideRect (frame_rect, &edge_rect, &frame_rect, border_width,
edge[i]);
@@ -2798,7 +2747,7 @@ ns_after_update_window_line (struct window *w, struct
glyph_row *desired_row)
NSRect r = NSMakeRect (0, y, FRAME_PIXEL_WIDTH (f), height);
ns_focus (f, &r, 1);
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
+ [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
NSRectFill (NSMakeRect (0, y, width, height));
NSRectFill (NSMakeRect (FRAME_PIXEL_WIDTH (f) - width,
y, width, height));
@@ -2966,7 +2915,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row
*row,
{
NSTRACE_RECT ("clearRect", clearRect);
- [ns_lookup_indexed_color(face->background, f) set];
+ [[NSColor colorWithUnsignedLong:face->background] set];
NSRectFill (clearRect);
}
@@ -2983,9 +2932,9 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row
*row,
[bmp transformUsingAffineTransform:transform];
if (!p->cursor_p)
- bm_color = ns_lookup_indexed_color(face->foreground, f);
+ bm_color = [NSColor colorWithUnsignedLong:face->foreground];
else if (p->overlay_p)
- bm_color = ns_lookup_indexed_color(face->background, f);
+ bm_color = [NSColor colorWithUnsignedLong:face->background];
else
bm_color = f->output_data.ns->cursor_color;
@@ -3083,9 +3032,9 @@ ns_draw_window_cursor (struct window *w, struct glyph_row
*glyph_row,
face = FACE_FROM_ID_OR_NULL (f, phys_cursor_glyph->face_id);
if (face && NS_FACE_BACKGROUND (face)
- == ns_index_color (FRAME_CURSOR_COLOR (f), f))
+ == [FRAME_CURSOR_COLOR (f) unsignedLong])
{
- [ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), f) set];
+ [[NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)] set];
hollow_color = FRAME_CURSOR_COLOR (f);
}
else
@@ -3144,7 +3093,7 @@ ns_draw_vertical_window_border (struct window *w, int x,
int y0, int y1)
ns_focus (f, &r, 1);
if (face)
- [ns_lookup_indexed_color(face->foreground, f) set];
+ [[NSColor colorWithUnsignedLong:face->foreground] set];
NSRectFill(r);
ns_unfocus (f);
@@ -3180,29 +3129,29 @@ ns_draw_window_divider (struct window *w, int x0, int
x1, int y0, int y1)
/* A vertical divider, at least three pixels wide: Draw first and
last pixels differently. */
{
- [ns_lookup_indexed_color(color_first, f) set];
+ [[NSColor colorWithUnsignedLong:color_first] set];
NSRectFill(NSMakeRect (x0, y0, 1, y1 - y0));
- [ns_lookup_indexed_color(color, f) set];
+ [[NSColor colorWithUnsignedLong:color] set];
NSRectFill(NSMakeRect (x0 + 1, y0, x1 - x0 - 2, y1 - y0));
- [ns_lookup_indexed_color(color_last, f) set];
+ [[NSColor colorWithUnsignedLong:color_last] set];
NSRectFill(NSMakeRect (x1 - 1, y0, 1, y1 - y0));
}
else if ((x1 - x0 > y1 - y0) && (y1 - y0 >= 3))
/* A horizontal divider, at least three pixels high: Draw first and
last pixels differently. */
{
- [ns_lookup_indexed_color(color_first, f) set];
+ [[NSColor colorWithUnsignedLong:color_first] set];
NSRectFill(NSMakeRect (x0, y0, x1 - x0, 1));
- [ns_lookup_indexed_color(color, f) set];
+ [[NSColor colorWithUnsignedLong:color] set];
NSRectFill(NSMakeRect (x0, y0 + 1, x1 - x0, y1 - y0 - 2));
- [ns_lookup_indexed_color(color_last, f) set];
+ [[NSColor colorWithUnsignedLong:color_last] set];
NSRectFill(NSMakeRect (x0, y1 - 1, x1 - x0, 1));
}
else
{
/* In any other case do not draw the first and last pixels
differently. */
- [ns_lookup_indexed_color(color, f) set];
+ [[NSColor colorWithUnsignedLong:color] set];
NSRectFill(divider);
}
@@ -3312,7 +3261,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct
face *face,
if (face->underline_defaulted_p)
[defaultCol set];
else
- [ns_lookup_indexed_color (face->underline_color, s->f) set];
+ [[NSColor colorWithUnsignedLong:face->underline_color] set];
ns_draw_underwave (s, width, x);
}
@@ -3388,7 +3337,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct
face *face,
if (face->underline_defaulted_p)
[defaultCol set];
else
- [ns_lookup_indexed_color (face->underline_color, s->f) set];
+ [[NSColor colorWithUnsignedLong:face->underline_color] set];
NSRectFill (r);
}
}
@@ -3402,7 +3351,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct
face *face,
if (face->overline_color_defaulted_p)
[defaultCol set];
else
- [ns_lookup_indexed_color (face->overline_color, s->f) set];
+ [[NSColor colorWithUnsignedLong:face->overline_color] set];
NSRectFill (r);
}
@@ -3428,7 +3377,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct
face *face,
if (face->strike_through_color_defaulted_p)
[defaultCol set];
else
- [ns_lookup_indexed_color (face->strike_through_color, s->f) set];
+ [[NSColor colorWithUnsignedLong:face->strike_through_color] set];
NSRectFill (r);
}
}
@@ -3486,7 +3435,7 @@ ns_draw_relief (NSRect outer, int hthickness, int
vthickness, char raised_p,
if (s->face->use_box_color_for_shadows_p)
{
- newBaseCol = ns_lookup_indexed_color (s->face->box_color, s->f);
+ newBaseCol = [NSColor colorWithUnsignedLong:s->face->box_color];
}
/* else if (s->first_glyph->type == IMAGE_GLYPH
&& s->img->pixmap
@@ -3496,7 +3445,7 @@ ns_draw_relief (NSRect outer, int hthickness, int
vthickness, char raised_p,
} */
else
{
- newBaseCol = ns_lookup_indexed_color (s->face->background, s->f);
+ newBaseCol = [NSColor colorWithUnsignedLong:s->face->background];
}
if (newBaseCol == nil)
@@ -3623,7 +3572,7 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s)
if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color)
{
ns_draw_box (r, abs (hthickness), abs (vthickness),
- ns_lookup_indexed_color (face->box_color, s->f),
+ [NSColor colorWithUnsignedLong:face->box_color],
left_p, right_p);
}
else
@@ -3668,7 +3617,7 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s,
char force_p)
face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
if (!face->stipple)
[(NS_FACE_BACKGROUND (face) != 0
- ? ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f)
+ ? [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)]
: FRAME_BACKGROUND_COLOR (s->f)) set];
else
{
@@ -3734,7 +3683,7 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
else
face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
- [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f) set];
+ [[NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)] set];
if (bg_height > s->slice.height || s->img->hmargin || s->img->vmargin
|| s->img->mask || s->img->pixmap == 0 || s->width !=
s->background_width)
@@ -3805,18 +3754,18 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
{
[FRAME_CURSOR_COLOR (s->f) set];
if (s->w->phys_cursor_type == FILLED_BOX_CURSOR)
- tdCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f);
+ tdCol = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)];
else
/* Currently on NS img->mask is always 0. Since
get_window_cursor_type specifies a hollow box cursor when on
a non-masked image we never reach this clause. But we put it
in, in anticipation of better support for image masks on
NS. */
- tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f);
+ tdCol = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)];
}
else
{
- tdCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f);
+ tdCol = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)];
}
/* Draw underline, overline, strike-through. */
@@ -3885,8 +3834,8 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
else
face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
- bgCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f);
- fgCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f);
+ bgCol = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND (face)];
+ fgCol = [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND (face)];
glyphRect = NSMakeRect (s->x, s->y, s->background_width, s->height);
@@ -4145,8 +4094,7 @@ ns_draw_glyph_string (struct glyph_string *s)
{
NSColor *col = (NS_FACE_FOREGROUND (s->face) != 0
- ? ns_lookup_indexed_color (NS_FACE_FOREGROUND
(s->face),
- s->f)
+ ? [NSColor colorWithUnsignedLong:NS_FACE_FOREGROUND
(s->face)]
: FRAME_FOREGROUND_COLOR (s->f));
[col set];
@@ -4923,7 +4871,6 @@ ns_initialize_display_info (struct ns_display_info
*dpyinfo)
&& ![NSCalibratedWhiteColorSpace isEqualToString:
NSColorSpaceFromDepth
(depth)];
dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth);
- dpyinfo->color_table = [[NSMutableArray array] retain];
dpyinfo->root_window = 42; /* A placeholder. */
dpyinfo->highlight_frame = dpyinfo->ns_focus_frame = NULL;
dpyinfo->n_fonts = 0;
@@ -4984,7 +4931,6 @@ static void
ns_delete_display (struct ns_display_info *dpyinfo)
{
/* TODO... */
- [dpyinfo->color_table release];
}
@@ -5196,8 +5142,9 @@ ns_term_init (Lisp_Object display_name)
color = XCAR (color_map);
name = XCAR (color);
c = XFIXNUM (XCDR (color));
+ c |= 0xFF000000;
[cl setColor:
- [NSColor colorWithUnsignedLong:c hasAlpha:NO]
+ [NSColor colorWithUnsignedLong:c]
forKey: [NSString stringWithLispString: name]];
}
@@ -7550,9 +7497,8 @@ not_in_argv (NSString *arg)
onFirstScreen = [[w screen] isEqual:[[NSScreen screens] objectAtIndex:0]];
f = emacsframe;
wr = [w frame];
- col = ns_lookup_indexed_color (NS_FACE_BACKGROUND
- (FACE_FROM_ID (f, DEFAULT_FACE_ID)),
- f);
+ col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
+ (FACE_FROM_ID (f, DEFAULT_FACE_ID))];
if (fs_state != FULLSCREEN_BOTH)
{
@@ -8278,9 +8224,8 @@ not_in_argv (NSString *arg)
f->border_width = [self borderWidth];
- col = ns_lookup_indexed_color (NS_FACE_BACKGROUND
- (FACE_FROM_ID (f, DEFAULT_FACE_ID)),
- f);
+ col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
+ (FACE_FROM_ID (f, DEFAULT_FACE_ID))];
[self setBackgroundColor:col];
if ([col alphaComponent] != (EmacsCGFloat) 1.0)
[self setOpaque:NO];
diff --git a/src/xdisp.c b/src/xdisp.c
index e853c8c..c3acf95 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -22158,7 +22158,7 @@ extend_face_to_end_of_line (struct it *it)
&& face->underline == FACE_NO_UNDERLINE
&& !face->overline_p
&& !face->strike_through_p
- && FACE_COLOR_TO_PIXEL (face->background, f) == FRAME_BACKGROUND_PIXEL
(f)
+ && face->background == FRAME_BACKGROUND_PIXEL (f)
#ifdef HAVE_WINDOW_SYSTEM
&& !face->stipple
#endif
@@ -22392,7 +22392,7 @@ extend_face_to_end_of_line (struct it *it)
&& (it->glyph_row->used[LEFT_MARGIN_AREA]
< WINDOW_LEFT_MARGIN_WIDTH (it->w))
&& !it->glyph_row->mode_line_p
- && FACE_COLOR_TO_PIXEL (face->background, f) !=
FRAME_BACKGROUND_PIXEL (f))
+ && face->background != FRAME_BACKGROUND_PIXEL (f))
{
struct glyph *g = it->glyph_row->glyphs[LEFT_MARGIN_AREA];
struct glyph *e = g + it->glyph_row->used[LEFT_MARGIN_AREA];
@@ -22463,7 +22463,7 @@ extend_face_to_end_of_line (struct it *it)
&& (it->glyph_row->used[RIGHT_MARGIN_AREA]
< WINDOW_RIGHT_MARGIN_WIDTH (it->w))
&& !it->glyph_row->mode_line_p
- && FACE_COLOR_TO_PIXEL (face->background, f) !=
FRAME_BACKGROUND_PIXEL (f))
+ && face->background != FRAME_BACKGROUND_PIXEL (f))
{
struct glyph *g = it->glyph_row->glyphs[RIGHT_MARGIN_AREA];
struct glyph *e = g + it->glyph_row->used[RIGHT_MARGIN_AREA];
- branch scratch/ns/testing created (now e66bb00), Alan Third, 2021/08/31
- scratch/ns/testing 32fbd55 3/6: Fix macfont backend color handling, Alan Third, 2021/08/31
- scratch/ns/testing e66bb00 6/6: Allow resizing undecorated frames on macOS (bug#28512, bug#31795), Alan Third, 2021/08/31
- scratch/ns/testing f7ada2d 2/6: Further cleanup of NS color code,
Alan Third <=
- scratch/ns/testing 4ef7ac1 4/6: Make NS toolbar use NSString instead of C strings, Alan Third, 2021/08/31
- scratch/ns/testing e8bd0b7 5/6: Make NS toolbar item ID more unique (bug#50160), Alan Third, 2021/08/31
- scratch/ns/testing 9ba21bc 1/6: Simplify NS color handling, Alan Third, 2021/08/31