summaryrefslogtreecommitdiff
path: root/pango/pango-renderer.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-10-07 18:22:24 +0200
committerMatthias Clasen <mclasen@redhat.com>2017-10-27 16:29:14 -0400
commit1599288b4f5394a314bfadae5af56d9b60150562 (patch)
tree067813e3673a89eac9ada2c629efa3bd820820b8 /pango/pango-renderer.c
parentfa79c5fc004b8a852074fe63670b55129f81f52e (diff)
downloadpango-1599288b4f5394a314bfadae5af56d9b60150562.tar.gz
layout/renderer: Don't heap-allocate short lived layout iterators
Use the new _pango_layout_get_iter and _pango_layout_iter_destroy instead. https://bugzilla.gnome.org/show_bug.cgi?id=788643
Diffstat (limited to 'pango/pango-renderer.c')
-rw-r--r--pango/pango-renderer.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 01b96156..f82c4e48 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -24,6 +24,7 @@
#include "pango-renderer.h"
#include "pango-impl-utils.h"
+#include "pango-layout-private.h"
#define N_RENDER_PARTS 4
@@ -162,7 +163,7 @@ pango_renderer_draw_layout (PangoRenderer *renderer,
int x,
int y)
{
- PangoLayoutIter *iter;
+ PangoLayoutIter iter;
g_return_if_fail (PANGO_IS_RENDERER (renderer));
g_return_if_fail (PANGO_IS_LAYOUT (layout));
@@ -179,7 +180,7 @@ pango_renderer_draw_layout (PangoRenderer *renderer,
pango_renderer_activate (renderer);
- iter = pango_layout_get_iter (layout);
+ _pango_layout_get_iter (layout, &iter);
do
{
@@ -187,19 +188,19 @@ pango_renderer_draw_layout (PangoRenderer *renderer,
PangoLayoutLine *line;
int baseline;
- line = pango_layout_iter_get_line_readonly (iter);
+ line = pango_layout_iter_get_line_readonly (&iter);
- pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
- baseline = pango_layout_iter_get_baseline (iter);
+ pango_layout_iter_get_line_extents (&iter, NULL, &logical_rect);
+ baseline = pango_layout_iter_get_baseline (&iter);
pango_renderer_draw_layout_line (renderer,
line,
x + logical_rect.x,
y + baseline);
}
- while (pango_layout_iter_next_line (iter));
+ while (pango_layout_iter_next_line (&iter));
- pango_layout_iter_free (iter);
+ _pango_layout_iter_destroy (&iter);
pango_renderer_deactivate (renderer);
}