diff options
author | Chris Lord <chris@linux.intel.com> | 2010-11-25 15:11:42 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2010-11-29 16:42:51 +0000 |
commit | 96490803f274d451fed2455d9bddb8571c4ebda0 (patch) | |
tree | e790c1ffa051d0b3cfa145666d1e4c1610860e65 | |
parent | 4be2421a63bd49b961bbcf556761da98337e4614 (diff) | |
download | clutter-96490803f274d451fed2455d9bddb8571c4ebda0.tar.gz |
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.
(cherry picked from commit 67143bd846c2b39ce94779d7ab2b5bd48e58d1cd)
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
-rw-r--r-- | clutter/clutter-text.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 3bf729d76..d34db054c 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -1987,6 +1987,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); @@ -2004,7 +2007,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; |