diff options
| author | Alan Third | 2021-08-21 19:39:39 +0100 |
|---|---|---|
| committer | Alan Third | 2021-12-22 20:48:19 +0000 |
| commit | 308ad05d37a2d230c65a8799e193e25f4f8ba540 (patch) | |
| tree | 71cdd46e4dfcb53c1a4f2d8aa8bd642c6f237852 /src | |
| parent | 11c0b2550331df6b7f812c61cb4113c42ea99ad7 (diff) | |
| download | emacs-308ad05d37a2d230c65a8799e193e25f4f8ba540.tar.gz emacs-308ad05d37a2d230c65a8799e193e25f4f8ba540.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/macfont.m | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/macfont.m b/src/macfont.m index ce7a5ec8cda..3f87c1be76d 100644 --- a/src/macfont.m +++ b/src/macfont.m | |||
| @@ -598,9 +598,9 @@ mac_screen_font_shape (ScreenFontRef font, CFStringRef string, | |||
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | static CGColorRef | 600 | static CGColorRef |
| 601 | get_cgcolor(unsigned long idx, struct frame *f) | 601 | get_cgcolor(unsigned long color) |
| 602 | { | 602 | { |
| 603 | NSColor *nsColor = ns_lookup_indexed_color (idx, f); | 603 | NSColor *nsColor = [NSColor colorWithUnsignedLong:color]; |
| 604 | [nsColor set]; | 604 | [nsColor set]; |
| 605 | CGColorSpaceRef colorSpace = [[nsColor colorSpace] CGColorSpace]; | 605 | CGColorSpaceRef colorSpace = [[nsColor colorSpace] CGColorSpace]; |
| 606 | NSInteger noc = [nsColor numberOfComponents]; | 606 | NSInteger noc = [nsColor numberOfComponents]; |
| @@ -628,21 +628,21 @@ get_cgcolor_from_nscolor (NSColor *nsColor, struct frame *f) | |||
| 628 | return cgColor; | 628 | return cgColor; |
| 629 | } | 629 | } |
| 630 | 630 | ||
| 631 | #define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face, f) \ | 631 | #define CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND(context, face) \ |
| 632 | do { \ | 632 | do { \ |
| 633 | CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f); \ | 633 | CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \ |
| 634 | CGContextSetFillColorWithColor (context, refcol_) ; \ | 634 | CGContextSetFillColorWithColor (context, refcol_) ; \ |
| 635 | CGColorRelease (refcol_); \ | 635 | CGColorRelease (refcol_); \ |
| 636 | } while (0) | 636 | } while (0) |
| 637 | #define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face, f) \ | 637 | #define CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND(context, face) \ |
| 638 | do { \ | 638 | do { \ |
| 639 | CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face), f); \ | 639 | CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (face)); \ |
| 640 | CGContextSetFillColorWithColor (context, refcol_); \ | 640 | CGContextSetFillColorWithColor (context, refcol_); \ |
| 641 | CGColorRelease (refcol_); \ | 641 | CGColorRelease (refcol_); \ |
| 642 | } while (0) | 642 | } while (0) |
| 643 | #define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face, f) \ | 643 | #define CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND(context, face) \ |
| 644 | do { \ | 644 | do { \ |
| 645 | CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face), f); \ | 645 | CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (face)); \ |
| 646 | CGContextSetStrokeColorWithColor (context, refcol_); \ | 646 | CGContextSetStrokeColorWithColor (context, refcol_); \ |
| 647 | CGColorRelease (refcol_); \ | 647 | CGColorRelease (refcol_); \ |
| 648 | } while (0) | 648 | } while (0) |
| @@ -2933,7 +2933,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 2933 | CGColorRelease (colorref); | 2933 | CGColorRelease (colorref); |
| 2934 | } | 2934 | } |
| 2935 | else | 2935 | else |
| 2936 | CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face, f); | 2936 | CG_SET_FILL_COLOR_WITH_FACE_BACKGROUND (context, face); |
| 2937 | CGContextFillRects (context, &background_rect, 1); | 2937 | CGContextFillRects (context, &background_rect, 1); |
| 2938 | } | 2938 | } |
| 2939 | 2939 | ||
| @@ -2949,7 +2949,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 2949 | CGColorRelease (colorref); | 2949 | CGColorRelease (colorref); |
| 2950 | } | 2950 | } |
| 2951 | else | 2951 | else |
| 2952 | CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face, s->f); | 2952 | CG_SET_FILL_COLOR_WITH_FACE_FOREGROUND (context, face); |
| 2953 | if (macfont_info->synthetic_italic_p) | 2953 | if (macfont_info->synthetic_italic_p) |
| 2954 | atfm = synthetic_italic_atfm; | 2954 | atfm = synthetic_italic_atfm; |
| 2955 | else | 2955 | else |
| @@ -2978,7 +2978,7 @@ macfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 2978 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 | 2978 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 |
| 2979 | CGContextSetLineWidth (context, synthetic_bold_factor * font_size); | 2979 | CGContextSetLineWidth (context, synthetic_bold_factor * font_size); |
| 2980 | #endif | 2980 | #endif |
| 2981 | CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face, f); | 2981 | CG_SET_STROKE_COLOR_WITH_FACE_FOREGROUND (context, face); |
| 2982 | } | 2982 | } |
| 2983 | if (no_antialias_p) | 2983 | if (no_antialias_p) |
| 2984 | CGContextSetShouldAntialias (context, false); | 2984 | CGContextSetShouldAntialias (context, false); |