treeview: Prevent fuzzy centered expander arrows
We want expander arrows to be vertically centered in their row, so we pass the cell area's height to the renderer. However, if the cell area's height is an odd number while the "expander-size" style property is an even number, or vice versa, the arrow will be centered in a half pixel, and fuzzily rendered. So, round the render height to the same parity as the expander-size. (This is not necessary for the arrow width because it's assumed equal to the "expander-size" style-property.)
This commit is contained in:
parent
5d46f3c2e7
commit
90a006b362
@ -10367,6 +10367,17 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
|
||||
gtk_style_context_set_state (context, state);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_EXPANDER);
|
||||
|
||||
/* Make sure area.height has the same parity as the "expander-size" style
|
||||
* property (which area.width is assumed to be exactly equal to). This is done
|
||||
* to avoid the arrow being vertically centered in a half-pixel, which would
|
||||
* result in a fuzzy rendering.
|
||||
*/
|
||||
if (area.height % 2 != area.width % 2)
|
||||
{
|
||||
area.y += 1;
|
||||
area.height -= 1;
|
||||
}
|
||||
|
||||
gtk_render_expander (context, cr,
|
||||
area.x, area.y,
|
||||
area.width, area.height);
|
||||
|
Loading…
Reference in New Issue
Block a user