gui2: cleanup of the text box widget design

This reduces border size as well as removes a hack related to transparent
backgrounds and text rendering. I can't observe any issue with text AA
using semi-transparent backgrounds anymore.
This commit is contained in:
Charles Dang 2016-02-22 22:07:14 +11:00
parent 710b1fc3af
commit 67cf95a5af

View File

@ -15,19 +15,12 @@
[/rectangle]
#enddef
#
# 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 fully opaque colors that correspond to the averages
# one would get with those two macros.
#
#define _GUI_TEXTBOX_BACKGROUND_ENABLED
{_GUI_DRAW_BACKGROUND ("10, 13, 22, 255")}
{_GUI_DRAW_BACKGROUND ({GUI__BACKGROUND_COLOR_ENABLED})}
#enddef
#define _GUI_TEXTBOX_BACKGROUND_DISABLED
{_GUI_DRAW_BACKGROUND ("28, 31, 41, 255")}
{_GUI_DRAW_BACKGROUND ({GUI__BACKGROUND_COLOR_DISABLED})}
#enddef
#define _GUI_DRAW_BORDER COLOR
@ -37,17 +30,6 @@
w = "(width)"
h = "(height)"
border_thickness = 3
border_color = "55, 55, 55, 192"
[/rectangle]
[rectangle]
x = 1
y = 1
w = "(if(width < 2, 0, width - 2))"
h = "(if(height < 2, 0, height - 2))"
border_thickness = 1
border_color = {COLOR}
@ -55,17 +37,6 @@
#enddef
#define _GUI_DRAW_TEXT SIZE COLOR
[rectangle]
x = "(text_x_offset + selection_offset)"
y = "(text_y_offset)"
w = "(selection_width)"
h = "(text_font_height)"
border_thickness = 0
fill_color = "21, 53, 80, 255"
[/rectangle]
[text]
x = "(text_x_offset)"
y = "(text_y_offset)"