diff options
| author | Po Lu | 2022-01-31 21:12:14 +0800 |
|---|---|---|
| committer | Po Lu | 2022-01-31 21:13:41 +0800 |
| commit | 6da021fce86a06a97b0bff76f69aa57759533dc9 (patch) | |
| tree | aa19106ad7235be20a13ca604767a18e7742a5b4 /src | |
| parent | fd42ba3adb557091d251fc1c72634a20f2cb0db6 (diff) | |
| download | emacs-6da021fce86a06a97b0bff76f69aa57759533dc9.tar.gz emacs-6da021fce86a06a97b0bff76f69aa57759533dc9.zip | |
Fix artifacting on PGTK when bits are copied with an alpha channel
* src/pgtkterm.c (x_draw_stretch_glyph_string): Draw background
respecting `alpha-background'.
(pgtk_copy_bits): Use CAIRO_OPERATOR_SOURCE to draw onto the
destination surface.
Diffstat (limited to 'src')
| -rw-r--r-- | src/pgtkterm.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c index 9bb611e4c58..c0b76b077ca 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c | |||
| @@ -2381,7 +2381,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2381 | else | 2381 | else |
| 2382 | { | 2382 | { |
| 2383 | pgtk_fill_rectangle (s->f, color, x, y, w, h, | 2383 | pgtk_fill_rectangle (s->f, color, x, y, w, h, |
| 2384 | false); | 2384 | true); |
| 2385 | } | 2385 | } |
| 2386 | 2386 | ||
| 2387 | pgtk_end_cr_clip (s->f); | 2387 | pgtk_end_cr_clip (s->f); |
| @@ -2966,17 +2966,20 @@ pgtk_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, | |||
| 2966 | } | 2966 | } |
| 2967 | 2967 | ||
| 2968 | static void | 2968 | static void |
| 2969 | pgtk_copy_bits (struct frame *f, cairo_rectangle_t * src_rect, | 2969 | pgtk_copy_bits (struct frame *f, cairo_rectangle_t *src_rect, |
| 2970 | cairo_rectangle_t * dst_rect) | 2970 | cairo_rectangle_t *dst_rect) |
| 2971 | { | 2971 | { |
| 2972 | cairo_t *cr; | 2972 | cairo_t *cr; |
| 2973 | GdkWindow *window; | ||
| 2973 | cairo_surface_t *surface; /* temporary surface */ | 2974 | cairo_surface_t *surface; /* temporary surface */ |
| 2974 | 2975 | ||
| 2976 | window = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); | ||
| 2977 | |||
| 2975 | surface = | 2978 | surface = |
| 2976 | cairo_surface_create_similar (FRAME_CR_SURFACE (f), | 2979 | gdk_window_create_similar_surface (window, CAIRO_CONTENT_COLOR_ALPHA, |
| 2977 | CAIRO_CONTENT_COLOR_ALPHA, | 2980 | FRAME_CR_SURFACE_DESIRED_WIDTH (f), |
| 2978 | (int) src_rect->width, | 2981 | FRAME_CR_SURFACE_DESIRED_HEIGHT |
| 2979 | (int) src_rect->height); | 2982 | (f)); |
| 2980 | 2983 | ||
| 2981 | cr = cairo_create (surface); | 2984 | cr = cairo_create (surface); |
| 2982 | cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), -src_rect->x, | 2985 | cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), -src_rect->x, |
| @@ -2988,6 +2991,7 @@ pgtk_copy_bits (struct frame *f, cairo_rectangle_t * src_rect, | |||
| 2988 | 2991 | ||
| 2989 | cr = pgtk_begin_cr_clip (f); | 2992 | cr = pgtk_begin_cr_clip (f); |
| 2990 | cairo_set_source_surface (cr, surface, dst_rect->x, dst_rect->y); | 2993 | cairo_set_source_surface (cr, surface, dst_rect->x, dst_rect->y); |
| 2994 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); | ||
| 2991 | cairo_rectangle (cr, dst_rect->x, dst_rect->y, dst_rect->width, | 2995 | cairo_rectangle (cr, dst_rect->x, dst_rect->y, dst_rect->width, |
| 2992 | dst_rect->height); | 2996 | dst_rect->height); |
| 2993 | cairo_clip (cr); | 2997 | cairo_clip (cr); |