[pango/wip/baedert/for-master2: 3/17] layout: Try to avoid some work when creating iters
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/wip/baedert/for-master2: 3/17] layout: Try to avoid some work when creating iters
- Date: Mon, 8 Jun 2020 17:21:21 +0000 (UTC)
commit 03774a47fda0231fae38f44e68e05deaf9ca95dc
Author: Timm Bäder <mail baedert org>
Date: Tue Apr 14 17:43:35 2020 +0200
layout: Try to avoid some work when creating iters
Instead of getting the logical rect and then not using it, try not to
compute it in the first place.
pango/pango-layout.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 872ccd71..ee754835 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -6183,7 +6183,6 @@ _pango_layout_get_iter (PangoLayout *layout,
PangoLayoutIter*iter)
{
int run_start_index;
- PangoRectangle logical_rect;
g_return_if_fail (PANGO_IS_LAYOUT (layout));
@@ -6207,11 +6206,25 @@ _pango_layout_get_iter (PangoLayout *layout,
iter->run = NULL;
iter->line_extents = NULL;
- pango_layout_get_extents_internal (layout,
- NULL,
- &logical_rect,
- &iter->line_extents);
- iter->layout_width = layout->width == -1 ? logical_rect.width : layout->width;
+
+ if (layout->width == -1)
+ {
+ PangoRectangle logical_rect;
+
+ pango_layout_get_extents_internal (layout,
+ NULL,
+ &logical_rect,
+ &iter->line_extents);
+ iter->layout_width = logical_rect.width;
+ }
+ else
+ {
+ pango_layout_get_extents_internal (layout,
+ NULL,
+ NULL,
+ &iter->line_extents);
+ iter->layout_width = layout->width;
+ }
iter->line_index = 0;
update_run (iter, run_start_index);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]