gui2/ttext_box: Workaround text AA issue with transparent background

... by making it not transparent.

For some reason, on Linux the antialiasing of the textbox text contents
looks slightly off when the background is a transparent (a != 255)
color. This does not happen when a solid color (a == 255) is used
instead.

Since Cairo AA is broken horribly with ClearType on Windows atm I'm not
really sure this specific bug also happens there.

To keep the intended effect of ebc214ff12,
I took a couple of screenshots of the textbox widget in both its enabled
and disabled states and averaged the background colors with the GIMP to
get an approximation of the result of blending the transparent overlay
from the GUI__BACKGROUND_COLOR_* macros with the standard dialog
background.
This commit is contained in:
Ignacio R. Morelle 2014-02-21 00:06:32 -03:00
parent 287a086e3b
commit f28e74c0bd

View file

@ -3,6 +3,21 @@
### Definition of a single line text box.
###
#
# Text antialiasing doesn't work as expected when rendering over a rectangle
# filled with an alpha < 255 color, so instead of using
# GUI__BACKGROUND_COLOR_ENABLED and GUI__BACKGROUND_COLOR_DISABLED for the
# textbox background, use a fully opaque color that corresponds to the averages
# one would get with those two macros.
#
#define _GUI_TEXTBOX_BACKGROUND_COLOR_ENABLED
"10, 13, 22, 255"
#enddef
#define _GUI_TEXTBOX_BACKGROUND_COLOR_DISABLED
"28, 31, 41, 255"
#enddef
#define _GUI_DRAW_BACKGROUND COLOR
[rectangle]
x = 0
@ -97,7 +112,7 @@
[draw]
{_GUI_DRAW_BACKGROUND ({GUI__BACKGROUND_COLOR_ENABLED})}
{_GUI_DRAW_BACKGROUND ({_GUI_TEXTBOX_BACKGROUND_COLOR_ENABLED})}
{_GUI_DRAW_BORDER ({GUI__FONT_COLOR_ENABLED__TITLE}) }
@ -111,7 +126,7 @@
[draw]
{_GUI_DRAW_BACKGROUND ({GUI__BACKGROUND_COLOR_DISABLED})}
{_GUI_DRAW_BACKGROUND ({_GUI_TEXTBOX_BACKGROUND_COLOR_DISABLED})}
{_GUI_DRAW_BORDER ({GUI__FONT_COLOR_DISABLED__TITLE}) }
@ -125,7 +140,7 @@
[draw]
{_GUI_DRAW_BACKGROUND ({GUI__BACKGROUND_COLOR_ENABLED})}
{_GUI_DRAW_BACKGROUND ({_GUI_TEXTBOX_BACKGROUND_COLOR_ENABLED})}
{_GUI_DRAW_BORDER ({GUI__FONT_COLOR_ENABLED__TITLE}) }
@ -156,3 +171,5 @@
#undef _GUI_DRAW_TEXT
#undef _GUI_DRAW_BORDER
#undef _GUI_DRAW_BACKGROUND
#undef _GUI_TEXTBOX_BACKGROUND_COLOR_ENABLED
#undef _GUI_TEXTBOX_BACKGROUND_COLOR_DISABLED