}
void
-x_set_cr_source_with_gc_foreground (struct frame *f, GC gc)
+x_set_cr_source_with_gc_foreground (struct frame *f, GC gc,
+ bool respect_alpha_background)
{
XGCValues xgcv;
XColor color;
+ unsigned int depth;
XGetGCValues (FRAME_X_DISPLAY (f), gc, GCForeground, &xgcv);
color.pixel = xgcv.foreground;
x_query_colors (f, &color, 1);
- cairo_set_source_rgb (FRAME_CR_CONTEXT (f), color.red / 65535.0,
- color.green / 65535.0, color.blue / 65535.0);
+ depth = FRAME_DISPLAY_INFO (f)->n_planes;
+
+ if (f->alpha_background < 1.0 && depth == 32
+ && respect_alpha_background)
+ {
+ cairo_set_source_rgba (FRAME_CR_CONTEXT (f), color.red / 65535.0,
+ color.green / 65535.0, color.blue / 65535.0,
+ f->alpha_background);
+
+ cairo_set_operator (FRAME_CR_CONTEXT (f), CAIRO_OPERATOR_SOURCE);
+ }
+ else
+ cairo_set_source_rgb (FRAME_CR_CONTEXT (f), color.red / 65535.0,
+ color.green / 65535.0, color.blue / 65535.0);
}
void
-x_set_cr_source_with_gc_background (struct frame *f, GC gc)
+x_set_cr_source_with_gc_background (struct frame *f, GC gc,
+ bool respect_alpha_background)
{
XGCValues xgcv;
XColor color;
depth = FRAME_DISPLAY_INFO (f)->n_planes;
- if (f->alpha_background < 1.0 && depth == 32)
+ if (f->alpha_background < 1.0 && depth == 32
+ && respect_alpha_background)
{
cairo_set_source_rgba (FRAME_CR_CONTEXT (f), color.red / 65535.0,
color.green / 65535.0, color.blue / 65535.0,
else
cairo_set_source_rgb (FRAME_CR_CONTEXT (f), color.red / 65535.0,
color.green / 65535.0, color.blue / 65535.0);
-
}
static const cairo_user_data_key_t xlib_surface_key, saved_drawable_key;
cairo_rectangle (cr, dest_x, dest_y, width, height);
else
{
- x_set_cr_source_with_gc_background (f, gc);
+ x_set_cr_source_with_gc_background (f, gc, false);
cairo_rectangle (cr, dest_x, dest_y, width, height);
cairo_fill_preserve (cr);
}
}
else
{
- x_set_cr_source_with_gc_foreground (f, gc);
+ x_set_cr_source_with_gc_foreground (f, gc, false);
cairo_clip (cr);
cairo_mask (cr, image);
}
regarded as Pixmap of unspecified size filled with ones. */
|| (xgcv.stipple & ((Pixmap) 7 << (sizeof (Pixmap) * CHAR_BIT - 3))))
{
- x_set_cr_source_with_gc_foreground (f, gc);
+ x_set_cr_source_with_gc_foreground (f, gc, respect_alpha_background);
cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
}
{
eassert (xgcv.fill_style == FillOpaqueStippled);
eassert (xgcv.stipple != None);
- x_set_cr_source_with_gc_background (f, gc);
+ x_set_cr_source_with_gc_background (f, gc, respect_alpha_background);
cairo_rectangle (cr, x, y, width, height);
cairo_fill_preserve (cr);
cairo_pattern_t *pattern = x_bitmap_stipple (f, xgcv.stipple);
if (pattern)
{
- x_set_cr_source_with_gc_foreground (f, gc);
+ x_set_cr_source_with_gc_foreground (f, gc, respect_alpha_background);
cairo_clip (cr);
cairo_mask (cr, pattern);
}
cairo_t *cr;
cr = x_begin_cr_clip (f, gc);
- x_set_cr_source_with_gc_background (f, gc);
+ x_set_cr_source_with_gc_background (f, gc, respect_alpha_background);
cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
x_end_cr_clip (f);
cairo_t *cr;
cr = x_begin_cr_clip (f, gc);
- x_set_cr_source_with_gc_foreground (f, gc);
+ x_set_cr_source_with_gc_foreground (f, gc, false);
cairo_rectangle (cr, x + 0.5, y + 0.5, width, height);
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
cairo_t *cr;
cr = x_begin_cr_clip (f, NULL);
- x_set_cr_source_with_gc_background (f, f->output_data.x->normal_gc);
+ x_set_cr_source_with_gc_background (f, f->output_data.x->normal_gc, true);
cairo_paint (cr);
x_end_cr_clip (f);
#else
cairo_t *cr;
cr = x_begin_cr_clip (f, gc);
- x_set_cr_source_with_gc_foreground (f, gc);
+ x_set_cr_source_with_gc_foreground (f, gc, false);
cairo_move_to (cr, top_p ? x : x + height, y);
cairo_line_to (cr, x, y + height);
cairo_line_to (cr, top_p ? x + width - height : x + width, y + height);
int i;
cr = x_begin_cr_clip (f, gc);
- x_set_cr_source_with_gc_background (f, gc);
+ x_set_cr_source_with_gc_background (f, gc, false);
for (i = 0; i < CORNER_LAST; i++)
if (corners & (1 << i))
{
int xoffset, n;
cr = x_begin_cr_clip (f, gc);
- x_set_cr_source_with_gc_foreground (f, gc);
+ x_set_cr_source_with_gc_foreground (f, gc, false);
cairo_rectangle (cr, x, y, width, height);
cairo_clip (cr);
eassert (width > 0 && height > 0);
cr = x_begin_cr_clip (f, NULL);
- x_set_cr_source_with_gc_background (f, f->output_data.x->normal_gc);
+ x_set_cr_source_with_gc_background (f, f->output_data.x->normal_gc,
+ true);
cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
x_end_cr_clip (f);