Premultiply background color by alpha for images
* src/xterm.c (x_query_frame_background_color): Premultiply colors as X wants them when built without Cairo.
This commit is contained in:
parent
4c2701fad1
commit
9844b152a5
1 changed files with 22 additions and 0 deletions
22
src/xterm.c
22
src/xterm.c
|
@ -3146,13 +3146,35 @@ static void
|
|||
x_query_frame_background_color (struct frame *f, XColor *bgcolor)
|
||||
{
|
||||
unsigned long background = FRAME_BACKGROUND_PIXEL (f);
|
||||
#ifndef USE_CAIRO
|
||||
XColor bg;
|
||||
#endif
|
||||
|
||||
if (FRAME_DISPLAY_INFO (f)->alpha_bits)
|
||||
{
|
||||
#ifdef USE_CAIRO
|
||||
background = (background & ~FRAME_DISPLAY_INFO (f)->alpha_mask);
|
||||
background |= (((unsigned long) (f->alpha_background * 0xffff)
|
||||
>> (16 - FRAME_DISPLAY_INFO (f)->alpha_bits))
|
||||
<< FRAME_DISPLAY_INFO (f)->alpha_offset);
|
||||
#else
|
||||
if (FRAME_DISPLAY_INFO (f)->alpha_bits
|
||||
&& f->alpha_background < 1.0)
|
||||
{
|
||||
bg.pixel = background;
|
||||
x_query_colors (f, &bg, 1);
|
||||
bg.red *= f->alpha_background;
|
||||
bg.green *= f->alpha_background;
|
||||
bg.blue *= f->alpha_background;
|
||||
|
||||
background = x_make_truecolor_pixel (FRAME_DISPLAY_INFO (f),
|
||||
bg.red, bg.green, bg.blue);
|
||||
background &= ~FRAME_DISPLAY_INFO (f)->alpha_mask;
|
||||
background |= (((unsigned long) (f->alpha_background * 0xffff)
|
||||
>> (16 - FRAME_DISPLAY_INFO (f)->alpha_bits))
|
||||
<< FRAME_DISPLAY_INFO (f)->alpha_offset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bgcolor->pixel = background;
|
||||
|
|
Loading…
Add table
Reference in a new issue