[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/ns/testing ee8e8af 4/7: Fix macfont backend color handling
From: |
Alan Third |
Subject: |
scratch/ns/testing ee8e8af 4/7: Fix macfont backend color handling |
Date: |
Sun, 14 Nov 2021 13:50:27 -0500 (EST) |
branch: scratch/ns/testing
commit ee8e8af8fca679426debd2ea9391066eb622e252
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>
Fix macfont backend color handling
* src/macfont.m (get_cgcolor): Replace use of ns_lookup_indexed_color.
(CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND):
(CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND):
(CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND): Fix call to get_cgcolor
and fix all callers.
---
src/macfont.m | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/macfont.m b/src/macfont.m
index 1426cae..8277a4f 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -598,9 +598,9 @@ mac_screen_font_shape (ScreenFontRef font, CFStringRef
string,
}
static CGColorRef
-get_cgcolor(unsigned long idx, struct frame *f)
+get_cgcolor(unsigned long color)
{
- NSColor *nsColor = ns_lookup_indexed_color (idx, f);
+ NSColor *nsColor = [NSColor colorWithUnsignedLong:color];
[nsColor set];
CGColorSpaceRef colorSpace = [[nsColor colorSpace] CGColorSpace];
NSInteger noc = [nsColor numberOfComponents];
@@ -628,21 +628,21 @@ get_cgcolor_from_nscolor (NSColor *nsColor, struct frame
*f)
return cgColor;
}
-#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face, f) \
+#define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face) \
do { \
- CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f); \
+ CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \
CGContextSetFillColorWithColor (context, refcol_) ; \
CGColorRelease (refcol_); \
} while (0)
-#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face, f) \
+#define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face) \
do { \
- CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face), f); \
+ CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face)); \
CGContextSetFillColorWithColor (context, refcol_); \
CGColorRelease (refcol_); \
} while (0)
-#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face, f) \
+#define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face) \
do { \
- CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f); \
+ CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \
CGContextSetStrokeColorWithColor (context, refcol_); \
CGColorRelease (refcol_); \
} while (0)
@@ -2933,7 +2933,7 @@ macfont_draw (struct glyph_string *s, int from, int to,
int x, int y,
CGColorRelease (colorref);
}
else
- CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face, f);
+ CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face);
CGContextFillRects (context, &background_rect, 1);
}
@@ -2949,7 +2949,7 @@ macfont_draw (struct glyph_string *s, int from, int to,
int x, int y,
CGColorRelease (colorref);
}
else
- CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face, s->f);
+ CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face);
if (macfont_info->synthetic_italic_p)
atfm = synthetic_italic_atfm;
else
@@ -2978,7 +2978,7 @@ macfont_draw (struct glyph_string *s, int from, int to,
int x, int y,
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
CGContextSetLineWidth (context, synthetic_bold_factor * font_size);
#endif
- CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face, f);
+ CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face);
}
if (no_antialias_p)
CGContextSetShouldAntialias (context, false);
- branch scratch/ns/testing created (now 6ab3dc1), Alan Third, 2021/11/14
- scratch/ns/testing 2dd414a 2/7: Simplify NS color handling, Alan Third, 2021/11/14
- scratch/ns/testing 5e4ba5c 1/7: Only set LANG if the ID is valid, Alan Third, 2021/11/14
- scratch/ns/testing 9eadfb7 5/7: Make NS toolbar use NSString instead of C strings, Alan Third, 2021/11/14
- scratch/ns/testing 7d2c360 6/7: Make NS toolbar item ID more unique (bug#50160), Alan Third, 2021/11/14
- scratch/ns/testing bc3b8f3 3/7: Further cleanup of NS color code, Alan Third, 2021/11/14
- scratch/ns/testing ee8e8af 4/7: Fix macfont backend color handling,
Alan Third <=
- scratch/ns/testing 6ab3dc1 7/7: Allow resizing undecorated frames on macOS (bug#28512, bug#31795), Alan Third, 2021/11/14