summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-07-08 18:00:48 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-07-08 18:00:48 +0000
commit583a4c4e22f6e97a9cedfcd5bf17802582a39919 (patch)
tree3cabfe6c859b0c88f4d2188e711b659c4f6e459d
parentb935a4bd82366ca770be6ce6f64f2aefce8e1a65 (diff)
downloadpango-583a4c4e22f6e97a9cedfcd5bf17802582a39919.tar.gz
Part of Bug 135683 – Cache glyphstring extents
2006-07-08 Behdad Esfahbod <behdad@gnome.org> Part of Bug 135683 – Cache glyphstring extents * pango/pango-layout.c (pango_layout_line_index_to_x), (pango_layout_line_x_to_index), (pango_layout_line_get_x_ranges): Use pango_glyph_string_get_width in most places in PangoLayout.
-rw-r--r--ChangeLog8
-rw-r--r--pango/pango-layout.c30
2 files changed, 16 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 18ad502f..e10be5ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,14 @@
Part of Bug 135683 – Cache glyphstring extents
+ * pango/pango-layout.c (pango_layout_line_index_to_x),
+ (pango_layout_line_x_to_index), (pango_layout_line_get_x_ranges):
+ Use pango_glyph_string_get_width in most places in PangoLayout.
+
+2006-07-08 Behdad Esfahbod <behdad@gnome.org>
+
+ Part of Bug 135683 – Cache glyphstring extents
+
* docs/pango-sections.txt:
* docs/tmpl/glyphs.sgml:
* pango/pango.def:
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index c95b6390..69e6b95d 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -1168,17 +1168,9 @@ pango_layout_line_index_to_x (PangoLayoutLine *line,
}
if (!properties.shape_set)
- {
- PangoRectangle logical_rect;
-
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
- NULL, &logical_rect);
- width += logical_rect.width;
- }
+ width += pango_glyph_string_get_width (run->glyphs, run->item->analysis.font);
else
- {
- width += properties.shape_logical_rect->width;
- }
+ width += properties.shape_logical_rect->width;
run_list = run_list->next;
}
@@ -3577,17 +3569,17 @@ pango_layout_line_x_to_index (PangoLayoutLine *line,
while (tmp_list)
{
PangoLayoutRun *run = tmp_list->data;
- PangoRectangle logical_rect;
ItemProperties properties;
+ int logical_width;
pango_layout_get_item_properties (run->item, &properties);
if (properties.shape_set)
- logical_rect = *properties.shape_logical_rect;
+ logical_width = properties.shape_logical_rect->width;
else
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font, NULL, &logical_rect);
+ logical_width = pango_glyph_string_get_width (run->glyphs, run->item->analysis.font);
- if (x_pos >= start_pos && x_pos < start_pos + logical_rect.width)
+ if (x_pos >= start_pos && x_pos < start_pos + logical_width)
{
int offset;
gboolean char_trailing;
@@ -3650,7 +3642,7 @@ pango_layout_line_x_to_index (PangoLayoutLine *line,
return TRUE;
}
- start_pos += logical_rect.width;
+ start_pos += logical_width;
tmp_list = tmp_list->next;
}
@@ -3790,13 +3782,7 @@ pango_layout_line_get_x_ranges (PangoLayoutLine *line,
}
if (tmp_list->next)
- {
- PangoRectangle run_logical;
-
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
- NULL, &run_logical);
- accumulated_width += run_logical.width;
- }
+ accumulated_width += pango_glyph_string_get_width (run->glyphs, run->item->analysis.font);
tmp_list = tmp_list->next;
}