… | |
… | |
567 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
567 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
568 | { |
568 | { |
569 | #if XFT |
569 | #if XFT |
570 | XRenderPictFormat *format; |
570 | XRenderPictFormat *format; |
571 | |
571 | |
572 | // FUCKING Xft gets it wrong, of course, so work around it |
572 | // FUCKING Xft gets it wrong, of course, so work around it. |
573 | // transparency users should eat shit and die, and then |
573 | // Transparency users should eat shit and die, and then |
574 | // XRenderQueryPictIndexValues themselves plenty. |
574 | // XRenderQueryPictIndexValues themselves plenty. |
575 | if ((screen->visual->c_class == TrueColor || screen->visual->c_class == DirectColor) |
575 | if ((screen->visual->c_class == TrueColor) |
576 | && (format = XRenderFindVisualFormat (screen->xdisp, screen->visual))) |
576 | && (format = XRenderFindVisualFormat (screen->xdisp, screen->visual))) |
577 | { |
577 | { |
578 | // the fun lies in doing everything manually... |
578 | // the fun lies in doing everything manually... |
579 | c.color.red = color.r; |
579 | c.color.red = color.r; |
580 | c.color.green = color.g; |
580 | c.color.green = color.g; |
… | |
… | |
602 | #else |
602 | #else |
603 | c.red = color.r; |
603 | c.red = color.r; |
604 | c.green = color.g; |
604 | c.green = color.g; |
605 | c.blue = color.b; |
605 | c.blue = color.b; |
606 | |
606 | |
607 | if (screen->visual->c_class == TrueColor || screen->visual->c_class == DirectColor) |
607 | if (screen->visual->c_class == TrueColor) |
608 | { |
608 | { |
609 | c.pixel = (color.r * (screen->visual->red_mask >> ctz (screen->visual->red_mask )) |
609 | c.pixel = (color.r * (screen->visual->red_mask >> ctz (screen->visual->red_mask )) |
610 | / rgba::MAX_CC) << ctz (screen->visual->red_mask ) |
610 | / rgba::MAX_CC) << ctz (screen->visual->red_mask ) |
611 | | (color.g * (screen->visual->green_mask >> ctz (screen->visual->green_mask)) |
611 | | (color.g * (screen->visual->green_mask >> ctz (screen->visual->green_mask)) |
612 | / rgba::MAX_CC) << ctz (screen->visual->green_mask) |
612 | / rgba::MAX_CC) << ctz (screen->visual->green_mask) |