mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
text: Optimise get_preferred_height for single-line-mode
Don't calculate an extra layout in clutter_text_get_preferred_height for single-line strings, when it's unnecessary. There's no need to set the width of a layout when in single-line mode, as wrapping will not happen.
This commit is contained in:
parent
e1b58d9407
commit
67143bd846
@ -1998,6 +1998,9 @@ clutter_text_get_preferred_height (ClutterActor *self,
|
||||
gint logical_height;
|
||||
gfloat layout_height;
|
||||
|
||||
if (priv->single_line_mode)
|
||||
for_width = -1;
|
||||
|
||||
layout = clutter_text_create_layout (CLUTTER_TEXT (self),
|
||||
for_width, -1);
|
||||
|
||||
@ -2015,7 +2018,7 @@ clutter_text_get_preferred_height (ClutterActor *self,
|
||||
/* if we wrap and ellipsize then the minimum height is
|
||||
* going to be at least the size of the first line
|
||||
*/
|
||||
if (priv->ellipsize && priv->wrap)
|
||||
if ((priv->ellipsize && priv->wrap) && !priv->single_line_mode)
|
||||
{
|
||||
PangoLayoutLine *line;
|
||||
gfloat line_height;
|
||||
|
Loading…
Reference in New Issue
Block a user