diff options
| author | Po Lu | 2022-01-06 14:02:43 +0800 |
|---|---|---|
| committer | Po Lu | 2022-01-06 14:02:43 +0800 |
| commit | e882dd48e3c3d6aa443383016c36f53683cd3048 (patch) | |
| tree | 47bc991af3b2dc43b865055e82b81ca6b59505f3 /src | |
| parent | 5749c57e473808b589a615ac4e4e7f7eef8da949 (diff) | |
| download | emacs-e882dd48e3c3d6aa443383016c36f53683cd3048.tar.gz emacs-e882dd48e3c3d6aa443383016c36f53683cd3048.zip | |
Fix duplicate overhang display on GNUstep
* src/nsfont.m (nsfont_draw): Stop saving DPS clip and remove
workaround for bad clipping.
* src/nsterm.m (ns_draw_glyph_string): Clip to glyph string rect
when displaying overhangs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsfont.m | 12 | ||||
| -rw-r--r-- | src/nsterm.m | 26 |
2 files changed, 13 insertions, 25 deletions
diff --git a/src/nsfont.m b/src/nsfont.m index d4ea4fa5044..f3c8a82930b 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -1222,22 +1222,10 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, | |||
| 1222 | /* render under GNUstep using DPS */ | 1222 | /* render under GNUstep using DPS */ |
| 1223 | { | 1223 | { |
| 1224 | NSGraphicsContext *context = [NSGraphicsContext currentContext]; | 1224 | NSGraphicsContext *context = [NSGraphicsContext currentContext]; |
| 1225 | DPSgsave (context); | ||
| 1226 | if (s->clip_head) | ||
| 1227 | { | ||
| 1228 | DPSrectclip (context, s->clip_head->x, 0, | ||
| 1229 | FRAME_PIXEL_WIDTH (s->f), | ||
| 1230 | FRAME_PIXEL_HEIGHT (s->f)); | ||
| 1231 | } | ||
| 1232 | [font->nsfont set]; | 1225 | [font->nsfont set]; |
| 1233 | |||
| 1234 | [col set]; | 1226 | [col set]; |
| 1235 | |||
| 1236 | DPSmoveto (context, r.origin.x, r.origin.y); | 1227 | DPSmoveto (context, r.origin.x, r.origin.y); |
| 1237 | GSShowGlyphs (context, c, len); | 1228 | GSShowGlyphs (context, c, len); |
| 1238 | DPSstroke (context); | ||
| 1239 | |||
| 1240 | DPSgrestore (context); | ||
| 1241 | } | 1229 | } |
| 1242 | 1230 | ||
| 1243 | unblock_input (); | 1231 | unblock_input (); |
diff --git a/src/nsterm.m b/src/nsterm.m index 41c311e04dc..382aa57a125 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -4063,19 +4063,22 @@ ns_draw_glyph_string (struct glyph_string *s) | |||
| 4063 | /* As prev was drawn while clipped to its own area, we | 4063 | /* As prev was drawn while clipped to its own area, we |
| 4064 | must draw the right_overhang part using s->hl now. */ | 4064 | must draw the right_overhang part using s->hl now. */ |
| 4065 | enum draw_glyphs_face save = prev->hl; | 4065 | enum draw_glyphs_face save = prev->hl; |
| 4066 | struct face *save_face = prev->face; | ||
| 4067 | 4066 | ||
| 4068 | prev->face = s->face; | 4067 | prev->hl = s->hl; |
| 4069 | NSRect r = NSMakeRect (s->x, s->y, s->width, s->height); | 4068 | NSRect r = NSMakeRect (s->x, s->y, s->width, s->height); |
| 4069 | NSRect rc; | ||
| 4070 | get_glyph_string_clip_rect (s, &rc); | ||
| 4070 | [[NSGraphicsContext currentContext] saveGraphicsState]; | 4071 | [[NSGraphicsContext currentContext] saveGraphicsState]; |
| 4071 | NSRectClip (r); | 4072 | NSRectClip (r); |
| 4073 | if (n) | ||
| 4074 | NSRectClip (rc); | ||
| 4072 | #ifdef NS_IMPL_GNUSTEP | 4075 | #ifdef NS_IMPL_GNUSTEP |
| 4073 | DPSgsave ([NSGraphicsContext currentContext]); | 4076 | DPSgsave ([NSGraphicsContext currentContext]); |
| 4074 | DPSrectclip ([NSGraphicsContext currentContext], s->x, s->y, | 4077 | DPSrectclip ([NSGraphicsContext currentContext], s->x, s->y, |
| 4075 | s->width, s->height); | 4078 | s->width, s->height); |
| 4079 | DPSrectclip ([NSGraphicsContext currentContext], NSMinX (rc), | ||
| 4080 | NSMinY (rc), NSWidth (rc), NSHeight (rc)); | ||
| 4076 | #endif | 4081 | #endif |
| 4077 | prev->num_clips = 1; | ||
| 4078 | prev->hl = s->hl; | ||
| 4079 | if (prev->first_glyph->type == CHAR_GLYPH) | 4082 | if (prev->first_glyph->type == CHAR_GLYPH) |
| 4080 | ns_draw_glyph_string_foreground (prev); | 4083 | ns_draw_glyph_string_foreground (prev); |
| 4081 | else | 4084 | else |
| @@ -4085,8 +4088,6 @@ ns_draw_glyph_string (struct glyph_string *s) | |||
| 4085 | #endif | 4088 | #endif |
| 4086 | [[NSGraphicsContext currentContext] restoreGraphicsState]; | 4089 | [[NSGraphicsContext currentContext] restoreGraphicsState]; |
| 4087 | prev->hl = save; | 4090 | prev->hl = save; |
| 4088 | prev->face = save_face; | ||
| 4089 | prev->num_clips = 0; | ||
| 4090 | } | 4091 | } |
| 4091 | ns_unfocus (s->f); | 4092 | ns_unfocus (s->f); |
| 4092 | } | 4093 | } |
| @@ -4103,19 +4104,21 @@ ns_draw_glyph_string (struct glyph_string *s) | |||
| 4103 | /* As next will be drawn while clipped to its own area, | 4104 | /* As next will be drawn while clipped to its own area, |
| 4104 | we must draw the left_overhang part using s->hl now. */ | 4105 | we must draw the left_overhang part using s->hl now. */ |
| 4105 | enum draw_glyphs_face save = next->hl; | 4106 | enum draw_glyphs_face save = next->hl; |
| 4106 | struct face *save_face = next->face; | ||
| 4107 | 4107 | ||
| 4108 | next->hl = s->hl; | 4108 | next->hl = s->hl; |
| 4109 | next->face = s->face; | ||
| 4110 | NSRect r = NSMakeRect (s->x, s->y, s->width, s->height); | 4109 | NSRect r = NSMakeRect (s->x, s->y, s->width, s->height); |
| 4110 | NSRect rc; | ||
| 4111 | get_glyph_string_clip_rect (s, &rc); | ||
| 4111 | [[NSGraphicsContext currentContext] saveGraphicsState]; | 4112 | [[NSGraphicsContext currentContext] saveGraphicsState]; |
| 4112 | NSRectClip (r); | 4113 | NSRectClip (r); |
| 4114 | NSRectClip (rc); | ||
| 4113 | #ifdef NS_IMPL_GNUSTEP | 4115 | #ifdef NS_IMPL_GNUSTEP |
| 4114 | DPSgsave ([NSGraphicsContext currentContext]); | 4116 | DPSgsave ([NSGraphicsContext currentContext]); |
| 4115 | DPSrectclip ([NSGraphicsContext currentContext], s->x, s->y, | 4117 | DPSrectclip ([NSGraphicsContext currentContext], s->x, s->y, |
| 4116 | s->width, s->height); | 4118 | s->width, s->height); |
| 4119 | DPSrectclip ([NSGraphicsContext currentContext], NSMinX (rc), | ||
| 4120 | NSMinY (rc), NSWidth (rc), NSHeight (rc)); | ||
| 4117 | #endif | 4121 | #endif |
| 4118 | next->num_clips = 1; | ||
| 4119 | if (next->first_glyph->type == CHAR_GLYPH) | 4122 | if (next->first_glyph->type == CHAR_GLYPH) |
| 4120 | ns_draw_glyph_string_foreground (next); | 4123 | ns_draw_glyph_string_foreground (next); |
| 4121 | else | 4124 | else |
| @@ -4125,10 +4128,7 @@ ns_draw_glyph_string (struct glyph_string *s) | |||
| 4125 | #endif | 4128 | #endif |
| 4126 | [[NSGraphicsContext currentContext] restoreGraphicsState]; | 4129 | [[NSGraphicsContext currentContext] restoreGraphicsState]; |
| 4127 | next->hl = save; | 4130 | next->hl = save; |
| 4128 | next->num_clips = 0; | 4131 | next->clip_head = s->next; |
| 4129 | next->face = save_face; | ||
| 4130 | next->clip_head = next; | ||
| 4131 | next->background_filled_p = 0; | ||
| 4132 | } | 4132 | } |
| 4133 | ns_unfocus (s->f); | 4133 | ns_unfocus (s->f); |
| 4134 | } | 4134 | } |